- Newest
- Most votes
- Most comments
I understand your frustration with deploying a React Native app using Amplify Gen 2. Unfortunately, as of now, Amplify Gen 2 does not have official support for React Native CLI projects. It's primarily designed for web applications and Expo-based React Native projects.
For a React Native CLI project, you would need to use Amplify Gen 1, which has better support for React Native CLI projects. If you're set on using Amplify Gen 2, you might need to consider switching to an Expo-based project or a web-based React application.
However, if you want to try configuring the amplify.yml file for a React Native CLI project with Amplify Gen 2, here's a potential configuration:
version: 1 backend: phases: build: commands: - amplify push --yes frontend: phases: preBuild: commands: - npm install build: commands: - npm run build artifacts: baseDirectory: android/app/build/outputs/apk/release files: - '**/*' cache: paths: - node_modules/**/*
This configuration assumes you're building an Android app. For iOS, you'd need to adjust the baseDirectory under artifacts.
Please note that this configuration might not work perfectly due to the lack of official support for React Native CLI in Amplify Gen 2. You might encounter issues during the build process.
Given the challenges you're facing, I would recommend considering these options:
- Use Amplify Gen 1, which has better support for React Native CLI projects.
- Convert your project to use Expo, which is better supported by Amplify Gen 2.
- Consider using Amplify Gen 2 for the backend services only, and handle the React Native app deployment separately.
If you decide to stick with Amplify Gen 1, you'll find more comprehensive documentation and support for React Native CLI projects. The setup process would involve initializing your Amplify project with amplify init and then adding the necessary features like authentication, API, or storage using the respective Amplify CLI commands.
I apologize that I can't provide a perfect solution for using React Native CLI with Amplify Gen 2. The technology is still evolving, and hopefully, better support for React Native CLI projects will be available in future updates of Amplify Gen 2.
Sources
Deploying a web application using AWS Amplify Gen 2 with GitLab as the Repository on AWS | Front-End Web & Mobile
Tutorial - Add authentication - React Native - AWS Amplify Docs
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 3 years ago

If I understand well I can use Amplify Gen 2 with react native cli only I cannot deploy the app using Amplify but I can use the services? In addition if I want to use Amplify Gen 2 for the backend services only and the front end to be in react native I can also access the backend without any problem although in the package.json of the front there wont be any amplify? In addition I deploy only the front to the appstore and the backend deploy to the amplify?