This directory holds the code for the Implement Mobile App with React Native, Expo, and Medusa guide.
This codebase only includes the express checkout storefront and doesn't include the Medusa application. You can learn how to install it by following this guide.
- Clone the repository and change to the
react-native-expodirectory:
git clone https://github.com/medusajs/examples.git
cd examples/react-native-expo2. Rename the .env.template file to .env and set the following variables:
EXPO_PUBLIC_MEDUSA_PUBLISHABLE_API_KEY=
EXPO_PUBLIC_MEDUSA_URL=Where:
EXPO_PUBLIC_MEDUSA_URLis the URL to your Medusa application server. If the Medusa application is running locally, it should be a local IP. For examplehttp://192.168.1.100:9000.EXPO_PUBLIC_MEDUSA_PUBLISHABLE_API_KEYis the publishable key for your Medusa application. You can retrieve it from the Medusa Admin by going to Settings > Publishable API Keys.
3. Install dependencies:
npm install4. While the Medusa application is running, start the Expo server:
npm run startYou can then test the app on a simulator or with Expo Go.
If you're testing the app on the web, make sure to add localhost:8081 (default Expo server URL) to the Medusa application's STORE_CORS and AUTH_CORS environment variables:
STORE_CORS=previous_values...,http://localhost:8081
AUTH_CORS=previous_values...,http://localhost:8081