This is a simple e-commerce mobile application built with React Native.
- Node.js (v18 or later)
- npm or yarn
- React Native CLI
- Android Studio (for Android development)
- Xcode (for iOS development)
-
Navigate to the project directory:
cd ToddleEcommerce -
Install JavaScript dependencies:
npm install
-
Install iOS dependencies (for iOS development):
First, ensure you have CocoaPods installed. If not, you can install it using Homebrew:
brew install cocoapods
Then, navigate to the
iosdirectory and install the pods:cd ios && pod install
- Make sure you have an Android emulator running or a device connected.
- Run the following command from the project root (
ToddleEcommerce):npm run android
- Make sure you have an iOS simulator running or a device connected.
- Run the following command from the project root (
ToddleEcommerce):npm run ios
The application uses placeholder icons. To see the intended icons, you will need to add the following files to the ToddleEcommerce/src/assets/icons directory:
menu.pngcart.pngfilter.pngsearch.png
These errors indicate that your Android development environment is not set up correctly. Follow these steps to fix it:
-
Install a Java Development Kit (JDK): React Native requires a specific version of the JDK. We recommend using OpenJDK 11. You can install it via Homebrew:
brew tap homebrew/cask-versions brew install --cask zulu11
-
Set up Environment Variables: You need to set the
JAVA_HOMEandANDROID_HOMEenvironment variables. Add the following lines to your shell configuration file (e.g.,~/.zshrcor~/.bash_profile):export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/platform-tools export JAVA_HOME=$(/usr/libexec/java_home -v 11) export PATH=$JAVA_HOME/bin:$PATH
After adding these lines, reload your shell configuration:
source ~/.zshrc # or source ~/.bash_profile
-
Verify the Setup: Run
npx react-native doctorto check if your environment is configured correctly. It will help you identify and fix any remaining issues.
For more detailed instructions, please refer to the official React Native Environment Setup guide.