Skip to content

Conversation

@jlapp9
Copy link
Contributor

@jlapp9 jlapp9 commented Feb 6, 2026

Summary

Fix for #518.

On Android, when passing an initial or static value for the flashMode or torchMode props that should result in the flash turning on, the value is not actually applied to the camera and the flash does not turn on. With a simple example such as: <Camera torchMode="on" /> the flash/torch does not turn on. Similarly <Camera flashMode="on" /> (or "auto" in a low-light environment) does not turn the flash on during photo capture. The same goes for a state variable with an initial value that should turn the flash on such as:

const [torchMode, setTorchMode] = useState(true);
return <Camera torchMode={torchMode} />;

However changing those values based on user input (i.e. using a state variable) or even a setTimeout() in a useEffect() like one of the proposed workarounds in #518 after the camera has initialized does work.

This PR resolves that issue by setting the flashMode and torchMode after the camera has initialized.

How did you test this change?

Tested on a few different Android devices using the examples above.

@jlapp9
Copy link
Contributor Author

jlapp9 commented Feb 6, 2026

The build is failing, but I don't think it's due to my change. If it is, please let me know and I will address it.

@jlapp9 jlapp9 marked this pull request as ready for review February 6, 2026 16:40
@jlapp9 jlapp9 mentioned this pull request Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant