I am trying to upload image using expo image picker but when click button and select image it gives unhandled promise rejection _expo.default.launchImageLibraryAsync error
already added camera storage permissions in app json
import React from 'react';
import { StyleSheet, Text, TouchableOpacity, View, Image } from 'react-native';
import Expo from 'expo';
import ImagePicker from 'expo';
import * as Permissions from 'expo-permissions';
export default class App extends React.Component {
state = {
image: null,
};
selectPicture = async () => {
await Permissions.askAsync(Permissions.CAMERA_ROLL);
const { cancelled, uri } = await ImagePicker.launchImageLibraryAsync({
aspect: 1,
allowsEditing: true,
});
if (!cancelled) this.setState({ image: uri });
};
takePicture = async () => {
await Permissions.askAsync(Permissions.CAMERA);
const { cancelled, uri } = await ImagePicker.launchCameraAsync({
allowsEditing: false,
});
this.setState({ image: uri });
};
render() {
return (
<View style={styles.container}>
<Image style={styles.image} source={{ uri: this.state.image }} />
<View style={styles.row}>
<Button onPress={this.selectPicture}>Gallery</Button>
<Button onPress={this.takePicture}>Camera</Button>
</View>
</View>
);
}
}
const Button = ({ onPress, children }) => (
<TouchableOpacity style={styles.button} onPress={onPress}>
<Text style={styles.text}>{children}</Text>
</TouchableOpacity>
);
want to upload image