Skip to content

A cross-platform React Native weather SDK with native Android (Kotlin) and iOS (Swift) integrations, providing easy-to-use methods to fetch weather data by city name or coordinates.

License

Notifications You must be signed in to change notification settings

Ronak55/react-native-weather-sdk

react-native-weather-sdk

A cross-platform React Native SDK to fetch weather data using native Android and iOS integrations. Supports fetching by city name or latitude/longitude.

πŸ“‹ Features

βœ… Cross-platform support (Android & iOS)
βœ… Native integration for better performance
βœ… Easy-to-use API for fetching weather data
βœ… Works with both city names and coordinates


πŸ“¦ Installation

# Using npm
npm install react-native-weather-sdk

# Using yarn
yarn add react-native-weather-sdk

# Using pnpm
pnpm add react-native-weather-sdk

βš™οΈ Setup

1. Android

Open android/app/build.gradle and ensure the minimum SDK version is set:

android {
    defaultConfig {
        minSdkVersion 21
    }
}

2. iOS

Navigate to the ios folder and install pods:

cd ios
pod install

πŸš€ Usage Examples

1. Fetch Weather by City

import WeatherSDK from 'react-native-weather-sdk';

async function getWeatherByCity() {
  try {
    const weather = await WeatherSDK.fetchWeatherByCity('London');
    console.log(weather);
  } catch (error) {
    console.error(error);
  }
}

2. Fetch Weather by Coordinates

import WeatherSDK from 'react-native-weather-sdk';

async function getWeatherByCoordinates() {
  try {
    const weather = await WeatherSDK.fetchWeatherByCoordinates(51.5074, -0.1278);
    console.log(weather);
  } catch (error) {
    console.error(error);
  }
}

πŸ“‚ Example Project

An example React Native app using this SDK is available in the examples/ folder. It demonstrates:

βœ… State management
βœ… API integration
βœ… UI display of weather data

Run this code:

cd examples
npm install
npm run android   # for Android
npm run ios       # for iOS

πŸ›  API Reference

1. Fetches data for the given city

WeatherSDK.fetchWeatherByCity(cityName: string): Promise<object>

2. Fetches weather data for the given latitude and longitude.

WeatherSDK.fetchWeatherByCoordinates(lat: number, lon: number): Promise<object>

πŸ‘¨β€πŸ’» Maintainers

This module is developed and maintained by Ronak Bothra

If you need any help with this module, or anything else, feel free to email me at rj.rjain567@gmail.com πŸ™πŸ»

πŸ“„ License

MIT License Β© 2025

About

A cross-platform React Native weather SDK with native Android (Kotlin) and iOS (Swift) integrations, providing easy-to-use methods to fetch weather data by city name or coordinates.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published