Ritabrata Goswami
Ritabrata Goswami

Reputation: 37

Why flash='on' is not turning on flash light in expo-camera?

Here below is my expo-camera JSX code,

{hasPermissionShop ? (

                <CameraView
                    ref={cameraRef}
                    facing='back'
                    style={{ 
                        width: '90%',
                        height: '60%',
                        justifyContent: 'flex-end', 
                        alignItems: 'center' 
                        }}
                    // enableTorch={true}
                    flash='on'
                >
                    <Pressable onPress={()=>captureShopImage()} style={{ marginBottom: 20 }}>
                        <Ionicons name="camera" size={50} color="#00802b" />
                        <Text style={{ 
                            color: '#00802b', 
                            textAlign: 'center' }}>Capture</Text>
                    </Pressable>
                </CameraView>
            ) : (  

                    <View style={Styles.ModelContainer}>
                        <Text style={Styles.ModelHdr}>Upload Image</Text>

                        <View style={{ 
                                flexDirection: 'row', 
                                marginTop: 10, 
                                justifyContent: 'space-around',
                                paddingHorizontal: 3 }}>
                            <View style={{ alignItems: 'center' }}>
                                <Pressable onPress={() => {requestShopImgPermission()}}>
                                    <Ionicons name="camera" size={50} color="black" />
                                </Pressable>
                                <Text>Use Camera</Text>
                            </View>
                            <View style={{ alignItems: 'center', marginLeft: 70 }}>
                                <Pressable onPress={() => {uploadShopImgFromFolder()}} >
                                    <Ionicons name="images" size={50} color="black" />
                                </Pressable>
                                <Text>Use Folder</Text>
                            </View>
                        </View>

                        <Pressable 
                            onPress={()=>CloseShopImg()}
                            style={Styles.ModelCloseBtnContainer}
                        >
                            <Text style={Styles.ModelCloseTxt}>Close</Text>
                        </Pressable>
                    </View>

            )}

Every time i have to use enableTourch which keep turning on the light even when i'm not taking photo. I want to specifically turn on the light when user clicking on camera icon. Expo doc also says to use flash set to 'on'. I'm using latest android version 14. Please tell me if i'm missing anything on this.

Upvotes: 0

Views: 66

Answers (0)

Related Questions