I am utilizing the newest model of Expo Digital camera in my expo react native mission and lately the digital camera has simply been performing a lot worse than earlier than. I’ve tried recreating the problem right here:
import React, { useState, useRef } from 'react';
import { View, StyleSheet, Textual content, TouchableOpacity } from 'react-native';
import { CameraView, useCameraPermissions } from 'expo-camera';
import { useRoute } from '@react-navigation/native';
export default perform CameraScreen() {
const [hasPermission, requestPermission] = useCameraPermissions();
const [isRecording, setIsRecording] = useState(false);
const [cameraRef, setCameraRef] = useState(null);
const [msg, setMsg] = useState('')
const isVideo = false
// const route = useRoute();
// const { web page, photoID, id, isVideo } = route.params || {};
const handleCapture = async () => {
if (cameraRef) {
if (isVideo) {
if (isRecording) {
setIsRecording(false);
// Cease recording with out anticipating a return worth
await cameraRef.stopRecording();
console.log('Stopped recording.');
setMsg('Stopped recording.')
} else {
console.log('Recording video...');
setMsg('Recording video...')
setIsRecording(true);
attempt {
// Begin recording and get the video knowledge
const videoData = await cameraRef.recordAsync();
console.log('Video recorded:', videoData.uri);
setMsg('Video recorded: ', videoData.uri)
} catch (error) {
setMsg('Error recording video:', error)
console.error('Error recording video:', error);
}
}
} else {
attempt {
const photoData = await cameraRef.takePictureAsync();
console.log('Photograph taken:', photoData.uri);
setMsg('Photograph taken: ', photoData.url)
} catch (error) {
setMsg('Error taking picture: ', error)
console.error('Error taking picture:', error);
}
}
}
};
if (!hasPermission) {
// Permissions are nonetheless loading or not granted
return (
We want your permission to indicate the digital camera
Grant Permission
);
}
return (
setCameraRef(ref)}
mode={isVideo ? 'video' : 'image'}
>
{msg}
{isVideo ? (isRecording ? 'Cease Recording' : 'Document Video') : 'Take Photograph'}
);
}
const kinds = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'middle',
backgroundColor: '#000',
},
digital camera: {
flex: 1,
},
buttonContainer: {
flex: 1,
backgroundColor: 'clear',
justifyContent: 'flex-end',
},
button: {
alignSelf: 'middle',
backgroundColor: 'white',
padding: 10,
borderRadius: 5,
marginBottom: 20,
},
textual content: {
fontSize: 18,
coloration: '#000',
},
});
My digital camera web page will simply randomly turn out to be unresponsive after I navigate to it for no purpose. The one repair is to navigate again and reopen the web page till the buttons work once more. This occurs throughout each apps I’ve developed.
I’ve tried twice to simply recreate the web page, every time with much less options, however it’s at all times the identical end result. Whether or not it is a picture or a video doesn’t matter. 50% of the time the button will work and can report a video or seize a photograph, the opposite 50% of the time, the buttons are fully unresponsive. In my first and second makes an attempt on the digital camera web page, I had a TouchableWithoutFeedback, like this:
the place the handleTapFocus would log ‘tapped’ to the console (and present up as textual content on the display screen when testing my native iOS construct). At any time when the web page was unresponsive, it wasn’t simply the report button, but additionally my flip digital camera button, flash, and this touchable suggestions that every one simply wouldn’t reply or give any suggestions.
Observe: The difficulty didn’t happen inside Expo or in my improvement construct. Solely after I constructed the app for iOS utilizing EAS and submitted to Testflight to obtain did this difficulty happen. Additionally happens in my different iOS app that is on the App Retailer.