react-native qr code scanner code example
Example: react native qrcode scanner permission
_requestPermission = permission => {var optionsif (permission == 'location') { options = this.state.isAlways ? 'always' : 'whenInUse'}Permissions.request(permission, options) .then(res => { this.setState({ status: { ...this.state.status, [permission]: res }, }) if (res != 'authorized') { var buttons = [{ text: 'Cancel', style: 'cancel' }] if (this.state.canOpenSettings) buttons.push({text: 'Open Settings', onPress: this._openSettings, })Alert.alert( 'Whoops!','There was a problem getting your permission. Please enable it from settings.',buttons,) } }) .catch(e => console.warn(e)) }