set cameraBarCodeReadListener before async work
This commit is contained in:
parent
8b25689456
commit
4254d5d227
|
@ -114,12 +114,12 @@ export default class Camera extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentWillMount() {
|
async componentWillMount() {
|
||||||
|
this.cameraBarCodeReadListener = NativeAppEventEmitter.addListener('CameraBarCodeRead', this.props.onBarCodeRead);
|
||||||
|
|
||||||
if (Camera.checkDeviceAuthorizationStatus) {
|
if (Camera.checkDeviceAuthorizationStatus) {
|
||||||
const isAuthorized = await Camera.checkDeviceAuthorizationStatus();
|
const isAuthorized = await Camera.checkDeviceAuthorizationStatus();
|
||||||
this.setState({ isAuthorized });
|
this.setState({ isAuthorized });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cameraBarCodeReadListener = NativeAppEventEmitter.addListener('CameraBarCodeRead', this.props.onBarCodeRead);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
|
Loading…
Reference in New Issue