Turn flashlight on/off In QRcodeScanner React native
I have follow the tutorial above, but still not working. It doesn't turn on the flash on pressing the touch opacity.
The issue is the same as the problem send, but the solution for him not work for me, don't know why.
UPDATE I have found a solution, if the other post not work for you, you should try this step by step. Probably it will merged in a future PR in react-native-qrcode-scanner, but for now this should solve.
import QRCodeScanner from "react-native-qrcode-scanner";
import { RNCamera } from "react-native-camera"
Props on QRCodeScanner:
cameraStyle={{ height: SCREEN_HEIGHT }}
cameraProps{{ flashMode: this.state.isFlashOn ? RNCamera.Constants.FlashMode.torch : RNCamera.Constants.FlashMode.off, captureAudio: false }}
customerMarker={this.renderCustomMarker} />
The Button:
<TouchOpacity activeOpacity={1} onPress={() => {
this.setState({isFlashOn: !this.state.isFlashOn});
this.scanner.reactivate();
}}>