How to use the react-native-permissions.request function in react-native-permissions

To help you get started, we’ve selected a few react-native-permissions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github UCSD / campus-mobile / app / containers / pushNotificationContainer.js View on Github external
getPermission = () => {
		Permissions.request('notification')
			.then((response) => {
				// if authorized, act
				if (response === 'authorized') {
					this.getNotificationToken()
				}
			})
	}
github joe307bad / points / Native.Points / app / upload / components / index.tsx View on Github external
public componentDidMount() {
        // @ts-ignore
        this.uploadPreview = this.refs.uploadPreview.refs.uploadPreviewModal;

        Permissions.request('camera');
        Permissions.request('photo');
    }
github berty / berty / js / packages / components / chat / record / RecordComponent.tsx View on Github external
const acquireMicPerm = async (): Promise => {
	try {
		const status = await check(
			Platform.OS === 'ios' ? PERMISSIONS.IOS.MICROPHONE : PERMISSIONS.ANDROID.RECORD_AUDIO,
		)
		if (status === RESULTS.GRANTED) {
			return MicPermStatus.GRANTED
		}

		try {
			const status = await request(
				Platform.OS === 'ios' ? PERMISSIONS.IOS.MICROPHONE : PERMISSIONS.ANDROID.RECORD_AUDIO,
			)

			if (status === RESULTS.GRANTED) {
				return MicPermStatus.NEWLY_GRANTED
			}

			return MicPermStatus.DENIED
		} catch (err) {
			console.log(err)
		}
	} catch (err) {
		console.log(err)
	}

	return MicPermStatus.UNDEFINED
github goldennetwork / golden-wallet-react-native / app / modules / ScanQRCode / index.js View on Github external
requestCameraPermissionAndroid() {
    return Permissions.request('camera').then((res) => {
      if (res == 'authorized') {
        this.resetCamera()
      }
    })
  }
github pillarwallet / pillarwallet / src / screens / Users / AddOrEditUser.js View on Github external
openCamera = async () => {
    const statusPhoto = await Permissions.request('photo');
    const statusCamera = await Permissions.request('camera');
    this.setState({
      permissionsGranted: statusPhoto === 'authorized' && statusCamera === 'authorized',
      visibleModal: 'camera',
    });
  };
github EdgeApp / edge-react-gui / src / modules / UI / permissions.ios.js View on Github external
export const requestCameraPermission = () => Permissions.request('camera')
  .then((permission) => permission === 'authorized')
github goldennetwork / golden-wallet-react-native / app / modules / SendTransaction / screen / ScanQRCodeScreen.js View on Github external
Permissions.check('camera').then((response) => {
      if (response === 'denied') {
        if (Platform.OS === 'android') return
        this.showPopupPermissionCamera()
      } else if (response === 'undetermined') {
        Permissions.request('camera', {
          rationale: {
            title: 'Camera Permission',
            message: '"Golden" needs permission to access your device’s camera to scan QRCode'
          }
        }).then((res) => {
          if (res === 'denied') {
            if (Platform.OS === 'android') return
            this.showPopupPermissionCamera()
          }
        })
      }
    })
  }
github guardian / editions / projects / Apps / editionsSrc / src / helpers / location-permission.ts View on Github external
const requestLocationPermission = async (
        apolloClient: ApolloClient,
    ): Promise => {
        promise = request(LOCATION_PERMISSION)
        const result = await promise
        apolloClient.writeData({
            data: {
                locationPermissionStatus: result,
            },
        })
        refreshWeather(apolloClient)
        return result
    }
github UCSD / campus-mobile / app / sagas / locationSaga.js View on Github external
function getPermission(type) {
	return Permissions.request(type)
}