How to use the expo-permissions.CAMERA_ROLL function in expo-permissions

To help you get started, we’ve selected a few expo-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 SCasarotto / casarotto-chat / src / pages / Profile / Profile.js View on Github external
handleTakeImage = () => {
		Permissions.askAsync(Permissions.CAMERA_ROLL, Permissions.CAMERA)
			.then((response) => {
				const { status } = response
				if (status === 'granted') {
					ImagePicker.launchCameraAsync({
						allowsEditing: true,
						aspect: [1, 1],
						base64: true,
						quality: 0.5,
					})
						.then((response) => {
							if (!response.cancelled) {
								this.props.uploadImage(response.uri)
							}
						})
						.catch((error) => console.log(error))
				}
github expo / expo / apps / storybook / stories / APIs / Permissions.stories.jsx View on Github external
renderSinglePermissionsButtons() {
    const permissions = [
      ['CAMERA', Permissions.CAMERA],
      ['AUDIO_RECORDING', Permissions.AUDIO_RECORDING],
      ['LOCATION', Permissions.LOCATION],
      ['USER_FACING_NOTIFICATIONS', Permissions.USER_FACING_NOTIFICATIONS],
      ['NOTIFICATIONS', Permissions.NOTIFICATIONS],
      ['CONTACTS', Permissions.CONTACTS],
      ['SYSTEM_BRIGHTNESS', Permissions.SYSTEM_BRIGHTNESS],
      ['CAMERA_ROLL', Permissions.CAMERA_ROLL],
      ['CALENDAR', Permissions.CALENDAR],
      ['REMINDERS', Permissions.REMINDERS],
    ];
    return permissions.map(([permissionName, permissionType]) => (
github expo / expo / home / utils / ImageSelectionUtils.ts View on Github external
async function ensurePermissionsAsync(): Promise {
  const { status } = await Permissions.askAsync(Permissions.CAMERA, Permissions.CAMERA_ROLL);
  if (status !== Permissions.PermissionStatus.GRANTED) {
    alert(
      'Cannot select a banner photo without media access! Please enable the "Camera" & "Camera Roll" permission in your system settings.'
    );
    return false;
  }
  return true;
}
github akveo / kittenTricks / src / containers / layouts / messaging / chat2 / chat2.container.tsx View on Github external
private onAddButtonPress = (): void => {
    Permissions.askAsync(Permissions.CAMERA_ROLL)
      .then(this.onCameraPermissionResponse);
  };
github Vivify-Ideas / expo-boilerplate / screens / main / profile / EditProfile.js View on Github external
const openImagePickerModal = async () => {
    const cameraRollPermissions = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    const hasCameraRollPermission = cameraRollPermissions.status === PERMISSIONS_STATUS.GRANTED;
    const cameraPermissions = await Permissions.askAsync(Permissions.CAMERA);
    const hasCameraPermission = cameraPermissions.status === PERMISSIONS_STATUS.GRANTED;

    toggleImagePicker(hasCameraPermission && hasCameraRollPermission);
    togglePermissionsModal(!(hasCameraPermission && hasCameraRollPermission));
  };
github expo / expo / apps / native-component-list / src / screens / ImageManipulatorScreen.tsx View on Github external
_pickPhoto = async () => {
    const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    if (status !== 'granted') {
      alert('Permission to CAMERA_ROLL not granted!');
      return;
    }
    const result = await ImagePicker.launchImageLibraryAsync({
      allowsEditing: false,
    });
    if (result.cancelled) {
      alert('No image selected!');
      return;
    }
    this.setState({ image: result });
  }
github expo / expo / apps / native-component-list / src / screens / PermissionsScreen.tsx View on Github external
renderSinglePermissionsButtons() {
    const permissions: Array<[string, Permissions.PermissionType]> = [
      ['CAMERA', Permissions.CAMERA],
      ['AUDIO_RECORDING', Permissions.AUDIO_RECORDING],
      ['LOCATION', Permissions.LOCATION],
      ['USER_FACING_NOTIFICATIONS', Permissions.USER_FACING_NOTIFICATIONS],
      ['NOTIFICATIONS', Permissions.NOTIFICATIONS],
      ['CONTACTS', Permissions.CONTACTS],
      ['SYSTEM_BRIGHTNESS', Permissions.SYSTEM_BRIGHTNESS],
      ['CAMERA_ROLL', Permissions.CAMERA_ROLL],
      ['CALENDAR', Permissions.CALENDAR],
      ['REMINDERS', Permissions.REMINDERS],
    ];
    return permissions.map(([permissionName, permissionType]) => (
github expo / examples / with-formdata-image-upload / app / App.js View on Github external
_pickImage = async () => {
    await this._askPermission(
      Permissions.CAMERA_ROLL,
      'We need the camera-roll permission to read pictures from your phone...'
    );
    let pickerResult = await ImagePicker.launchImageLibraryAsync({
      allowsEditing: true,
      aspect: [4, 3],
    });

    this._handleImagePicked(pickerResult);
  };
github expo / expo / apps / native-component-list / src / screens / Camera / GalleryScreen.web.tsx View on Github external
saveToGallery = async () => {
    const photos = this.state.selected;

    if (photos.length > 0) {
      const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);

      if (status !== 'granted') {
        throw new Error('Denied CAMERA_ROLL permissions!');
      }

      const promises = photos.map(photoUri => {
        return MediaLibrary.createAssetAsync(photoUri);
      });

      await Promise.all(promises);
      alert('Successfully saved photos to user\'s gallery!');
    } else {
      alert('No photos to save!');
    }
  }
github expo / expo / apps / native-component-list / src / screens / Camera / GalleryScreen.tsx View on Github external
saveToGallery = async () => {
    const photos = this.state.selected;

    if (photos.length > 0) {
      const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);

      if (status !== 'granted') {
        throw new Error('Denied CAMERA_ROLL permissions!');
      }

      const promises = photos.map(photoUri => {
        return MediaLibrary.createAssetAsync(photoUri);
      });

      await Promise.all(promises);
      alert('Successfully saved photos to user\'s gallery!');
    } else {
      alert('No photos to save!');
    }
  }