Adding the Photo Picker component with Amplify Storage with Expo and React Native
In this section, we will add the Photo Picker component to our Expo and React Native apps to let the user upload photos to Amplify Storage (an S3 Bucket). The steps will be similar between Expo and React Native, but the component will be slightly different.
To let the user upload their image to Amplify Storage, we need to add the image picker library to the project:
- For the Expo app, install the specific image picker library that is developed by Expo called
expo-image-picker
by running the following command:expo install expo-image-picker
- For the React Native app, install the community-made image called
react-native-image-picker
by running the following two commands:yarn add react-native-image-picker npx pod-install
- Once you have installed the image picker for your React Native project, recompile the project with the
yarn ios
andyarn android
commands to see if it works. - If you try...