Error:
ANDROID ONLY
Fail to connect to camera service error. See below for screen shot.
Steps to Reproduce:
Camera installed in 2nd screen in a stack navigator. Stack has 3 screens.
For example: Get ready (1st screen) >> camera (2nd screen) >> result (3rd screen)
The first time you navigate this work flow, it works flawlessly. If you navigate this flow a 2nd time, you get an error.
Alternative Installation attempts (all with the same error):
-
Tried installing as a modal
-
Tried installing as a stand alone sceene in it’s own stack navigator
-
Tried installing as a sceene in tab navigator
-
Tried installing as imported component
-
Tried installing in newly created expo base project
Environment:
Android: 5.01, 7.10 (device and simulator)
“expo”: “^21.0.0”
“react”: “16.0.0-alpha.12”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz”,
“react-navigation”: “^1.0.0-beta.13”,
“react-redux”: “^5.0.5”,
“redux”: “^3.7.2”,
“redux-persist”: “^4.10.0”,
“redux-thunk”: “^2.2.0”,
Installation:
We’re using the basic example provided here.
With the “snap” method as well. See code below.
Desired Outcome:
This is a medial app. I want to be able to shoot sequential pictures and videos (up to 5) of wounds without error. I would prefer to accomplish this within expo. I’m trying to avoid ejecting the app to fix this issue.
Any help would be greatly appreciated
Code:
_snap = async () => {
const { navigate } = this.props.navigation;
if (this.refs.theCamera) {
Vibration.vibrate();
let result = await this.refs.theCamera.takePictureAsync();
if (!result.cancelled) {
this.props.setFilePath(result.uri);
navigate("WoundVarify");
}
}
};
render(); {
return (
<View style={{ flex: 1, backgroundColor: '#fff' }}>
{ this.state.hasCameraPermission &&
<Camera
ref="theCamera"
style={{ flex: 1 }}
type={this.state.type}
>
<View style={{ flex: 1, backgroundColor: 'transparent' }}>
<TouchableOpacity
style={{ flex: 1 }}
onPress={() => {
this._snap()
}}
>
<Image source={background} style={styles.backgroundImage}>
<View style={{ flex: 1, backgroundColor: 'transparent', alignSelf: 'center' }}>
<Text style={{ fontSize: 20, marginTop: 10, color: 'white' }}>
CLICK TO TAKE PICTURE
</Text>
</View>
</Image>
</TouchableOpacity>
</View>
</Camera>
}
</View>
);
}
Assets: