This is a simple weather application built with React Native and Expo. It fetches weather data from the WeatherAPI.
To run this project locally, follow these steps:
First, you need to install Node.js and npm. Download the prebuilt installer from the Node.js website and follow the installation instructions.
Open your terminal and run the following command to create a new Expo app using the template:
npx create-expo-app --template
Change to your app directory with the following command:
cd yourAppName
To use Heroicons in your app, install react-native-heroicons
and react-native-svg
:
npm install react-native-heroicons react-native-svg
Next, install react-native-progress
to display progress indicators in your app:
npm install react-native-progress
Install axios
to make HTTP requests to fetch weather data:
npm install axios
a. Install NativeWind
npm install nativewind
b. Install TailwindCSS
Install TailwindCSS as a development dependency:
npm install --save-dev [email protected]
c. Initialize TailwindCSS
Run the following command to create a TailwindCSS configuration file:
npx tailwindcss init
d. Configure TailwindCSS
Replace the contents of tailwind.config.js
with the following configuration:
// tailwind.config.js
module.exports = {
content: ["./App.{js,jsx,ts,tsx}", "./screens/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
}
e. Configure Babel
Replace the contents of babel.config.js
with the following configuration:
// babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: ["nativewind/babel"],
};
};
Finally, start the Expo development server with the following command:
npx expo start
If you need to use the tunnel option, use:
npx expo start --tunnel
After starting the development server, you can run the app on a physical device using the Expo Go app.
This project is licensed under the MIT License - see the LICENSE file for details.