set cameraBarCodeReadListener before async work

This commit is contained in:
Zack 2016-02-15 15:15:24 -08:00
parent 8b25689456
commit 4254d5d227
1 changed files with 2 additions and 2 deletions

View File

@ -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() {