How to use the expo.Permissions.CAMERA_ROLL function in expo

To help you get started, we’ve selected a few expo 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 BrightID / BrightID / brightID-expo / src / AppBootstrap.js View on Github external
bootstrapAsync = async () => {
    // bootstrap the application
    // async storage key 'userData' : {
    // userToken: String,
    // nameornym: String,
    // avatarUri: String
    // }

    try {
      // add user permssions
      const cam = await Permissions.getAsync(Permissions.CAMERA);
      const camr = await Permissions.getAsync(Permissions.CAMERA_ROLL);
      // console.warn(cam);
      // console.warn(camr);
      // load font
      await Font.loadAsync({
        EurostileRegular: require('../assets/fonts/EurostileRegular.ttf'),
        'ApexNew-Book': require('../assets/fonts/ApexNew-Book.otf'),
        'ApexNew-Medium': require('../assets/fonts/ApexNew-Medium.otf'),
        'ApexNew-Light': require('../assets/fonts/ApexNew-Light.otf'),
      });

      // load user data
      let userData = await AsyncStorage.getItem('userData');
      if (userData !== null) {
        userData = JSON.parse(userData);
        store.dispatch(setUpDefault(userData));
      } else {
github npatta01 / mobile-deep-learning-classifier / screens / HomeScreen.js View on Github external
_verifyPermissions = async () => {
        console.log("Verifying Permissions");
        const { status, expires, permissions } = await Permissions.getAsync(Permissions.CAMERA, Permissions.CAMERA_ROLL);

        if (status !== 'granted') {
            const { status, permissions }  = await Permissions.askAsync(Permissions.CAMERA, Permissions.CAMERA_ROLL)
           
            if (status === 'granted') {
                console.log("Permissions granted");
                return true
            } else {
                alert('Hey! You have not enabled selected permissions');
                return false
            }

        }else{
            return true;
        }
    };
github imnapo / react-native-cn-richtext-editor / expo-demo / App.js View on Github external
askPermissionsAsync = async () => {
        const camera = await Permissions.askAsync(Permissions.CAMERA);
        const cameraRoll = await Permissions.askAsync(Permissions.CAMERA_ROLL);

        this.setState({
        hasCameraPermission: camera.status === 'granted',
        hasCameraRollPermission: cameraRoll.status === 'granted'
        });
    };
github elliotBraem / CupSave / src / components / ChangeProfilePicture.js View on Github external
handleChooseProfilePictureChange = async () => {
    const {status} = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    if (status === 'granted') {
      const result = await ImagePicker.launchImageLibraryAsync({
        mediaType: 'photo',
        allowsEditing: true,
      });

      if (!result.cancelled) {
        this.setState({
          avatar: result.uri,
          newAvatar: true,
        });
      } else {
        this.setState({errorMessage: 'Location permission not granted'});
      }
    }
  };
github jamland / instabyte / src / components / Post / DeviceGallery.js View on Github external
async componentDidMount() {
    this.setState({isMounted: true});

    const {status} = await Permissions.getAsync(Permissions.CAMERA_ROLL);

    if (this.state.isMounted) {
      this.setState({ hasCameraRollPermission: status === 'granted' });

      if (status === 'granted') {
        this.getPhotos();
      } else {
        const {status} = await Permissions.askAsync(Permissions.CAMERA_ROLL);
        if (status === 'granted') {
          this.setState({ hasCameraRollPermission: true });
          this.getPhotos();
        }
      }
    }
  }
github watanabeyu / expo-firebase-instagram / src / screens / TakeScreen / index.js View on Github external
onTabPress = async (mode = 'photo', headerTitle = I18n.t('Take.tab2')) => {
    const { flashMode } = this.state;
    const { navigation } = this.props;

    if (mode !== 'library') {
      this.setState({
        mode,
        flashMode: (mode === 'photo') ? flashMode : Camera.Constants.FlashMode.off,
      });

      navigation.setParams({
        headerTitle,
      });
    } else {
      const permissions = Permissions.CAMERA_ROLL;
      const { status } = await Permissions.askAsync(permissions);

      if (status) {
        const photo = await ImagePicker.launchImageLibraryAsync({
          allowsEditing: true,
          aspect: [1, 1],
        });

        if (!photo.cancelled) {
          navigation.push('TakePublish', { mode: 'photo', photo });
        }
      }
    }
  }