This React Native application retrieves a list of Pokemon from a given API and displays their details upon selection. The app uses Redux Toolkit, RTK Query, and React Navigation for state management, data fetching, and navigation respectively. Unit tests are written using Jest and React Testing Library.
- Fetch and display a list of Pokemon.
- Show detailed information about a selected Pokemon.
- Persistently store the Pokemon list.
- Navigation between Home and Detail screens.
- Unit tests with over 60% coverage.
Before you begin, ensure you have met the following requirements:
- You have installed Node.js.
- You have installed npm.
- You have installed React Native CLI.
- You have installed Android Studio or Xcode.
-
Clone the repository:
-
Install dependencies:
npm install
-
Set up environment variables:
Create a
.env
file in the root directory and add the following line:API_URL=https://pokeapi.co/api/v2/pokemon/
-
Set up Android development environment:
Add local.properties
file in the android
directory to include the path to your Android SDK:
sdk.dir=C://Users//USERNAME//AppData//Local//Android//Sdk
Replace USERNAME
with your actual Windows username. For macOS/Linux, the path might be different.
-
Start the Android emulator or connect an Android device.
-
Run the following command:
npm run android
To run the unit tests, execute:
npm run test
- Renders loading state correctly
- Renders error state correctly
- Renders list of Pokemon correctly
- Navigates to detail screen when Pokemon is pressed
- Renders loading state correctly
- Renders error state correctly
- Sets navigation title to Pokemon's name with the first letter capitalized
- Handles empty data gracefully