React Native Weather App using Redux Toolkit# WeatherApp
This is a React Native project that fetches and displays weather data from an external API. The app supports both iOS and Android and includes features such as city search, weather details display, state management using Redux Toolkit, and dark mode support via the React Native Appearance API.
Note: Ensure you have completed the Set Up Your Environment guide before proceeding.
git clone https://github.com/your-repo/weather-app.git
cd weather-appnpm install
# OR
yarn installMetro is the JavaScript build tool for React Native. Run the following command to start Metro:
npm start
# OR
yarn startnpx react-native run-androidMake sure CocoaPods dependencies are installed:
cd ios
pod install
cd ..Then run:
npx react-native run-ios- City Search: Enter a city name to fetch and display real-time weather data.
- Weather Details:
- City Name
- Current Temperature
- Weather Condition (e.g., Sunny, Cloudy)
- Weather Icon
- Error Handling: Displays an error message if the city is not found.
- State Management: Uses Redux Toolkit for managing app state.
- Persistent Data: Stores the last searched city using AsyncStorage.
- Dark Mode: Supports light and dark themes using the React Native Appearance API.
- The app uses Redux Toolkit for efficient state management.
- The
weatherSlice.tsfile contains the reducer and actions for fetching and storing weather data. - The
store.tsfile configures the Redux store and integrates the weather slice.
- The app fetches weather data from the OpenWeatherMap API using Redux Async Thunks (
fetchWeather). - API calls are managed in a separate service file (
weatherService.ts) for modularity.
- The app dynamically switches themes based on system preferences.
- Uses
AppearanceAPI to detect the current color scheme and toggle between light and dark themes.
If you encounter issues, refer to:
- React Native Troubleshooting Guide
- Check for missing dependencies and install them using
npm installoryarn install - Ensure you have the correct version of Node.js and React Native CLI installed.