Controlling Torch

I am creating a strobe light app. The app will control the native torch (flashlight) without using the camera or taking a photo. Does expo have a function for switching the phone light on and off? I have looked through the docs, but could not find anything without using the camera.

Hey @torihuang,

As far as I am aware, we do not have anything within the Expo SDK that allows you to control the device’s flashlight. You’re welcome and encouraged to create a Feature Request on our Canny page (!

In the mean time, if this is a blocker for you, you have the option to detach your Expo project and use ExpoKit which would allow you to then use this library

*** One of our team members did mention that it’s theoretically possible for you to leverage the Camera component to use the torch functionality and just not render the camera on screen at all. Not at all a clean solution and would most likely be detrimental to your app’s performance and battery consumption, but it is a possibility. ***

One final caveat: Apple has a history of rejecting apps that only utilize flashlight functionality. Just want you to be aware of that.




This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.