Expo camera double tap to take picture on IOS

The code works fine on Android. But on IOS it takes two taps to take the picture. The weirdest thing was I added a spinner as well to see if the tap get registered. It does. It starts spinning but then won’t take the picture. This code works flawlessly on Android. TouchableOpacity,TouchableWithoutFeedback all work fine else where throughout the app. So I guess it’s something with the takePictureAsync() function on the IOS. This is my code below

The Camera Component

     <View style={{borderRadius:20,overflow:'hidden',height:'75%',width:'90%',elevation:10,marginTop:40}}>
                        <Camera ref={ref => { this.camera = ref }} style={{ height: '100%', width: '100%' }} type={this.state.type}>
                        </Camera>
                        </View>
                           <View style={{paddingTop:20}}>             
                 
                                <TouchableWithoutFeedback
                                    style={{ alignSelf: 'center' }}
                                    onPress={this.takePicture}>
                                  
                                        <Image source={require('../../assets/camera.png')}
                                            style={{ height: 60, width: 60 }} />
                                  
                                </TouchableWithoutFeedback>
                      
                        </View>

The TakePictureFunction


    takePicture = async () => {
        console.log("Pressed " + this.camera)
        if (this.camera) {
            console.log("Camera")
       
            let photo = await this.camera.takePictureAsync();
            this.setState({ imageUri: photo.uri })
        }
    }

I’ve tried using all the touchable’s still doesnt work in ios. Any ideas. Thank you

Hey @omairnabiel,

This is a known issue. You can follow it’s status here: https://github.com/expo/expo/issues/2288

We’ve begun performing an extensive SDK audit so hopefully we can get the Camera API issue remedied soon.

Cheers,

Adam

Thanks for the quick response. How will I know when it’s done. :smiley:

Your best bet would be to subscribe to that issues thread I posted so you get notifications when there is an update to it.

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