Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DevanshPaliwal authored Aug 2, 2024
1 parent d061cb2 commit 3cd2751
Show file tree
Hide file tree
Showing 28 changed files with 15,446 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Weather App/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StatusBar } from "react-native";
import { StyleSheet,Text,View,SafeAreaView } from "react-native";
import AppNavigation from "./navigation/appNavigation";

export default function App(){
return(
<AppNavigation/>
)
}
31 changes: 31 additions & 0 deletions Weather App/api/weather.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import axios from "axios";

let apiKey="153ab2c85b5646d9a58162344241905"

const forecastEndpoint=params=>`http://api.weatherapi.com/v1/forecast.json?key=${apiKey}&q=${params.city}&days=7&aqi=no&alerts=no
`
const locationsEndpoint=params=>`http://api.weatherapi.com/v1/search.json?key=${apiKey}&q=${params.city}`

const apiCall = async(endpoint)=>{
const options={
method:'GET',
url:endpoint
}
try {
const response = await axios.request(options)
return response.data
} catch (error) {
console.log('error: ',error)
return null
}
}

export const fetchForecast = params =>{
let forecastUrl=forecastEndpoint(params)
return apiCall(forecastUrl)
}

export const fetchLocation = params =>{
let locationUrl=locationsEndpoint(params)
return apiCall(locationUrl)
}
Binary file added Weather App/assets/icons/apple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/icons/drop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/icons/facebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/icons/google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/icons/sun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/icons/wind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/emptyStar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/fullStar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/heavyrain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/mist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/moderaterain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/partlycloudy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Weather App/assets/images/sun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Weather App/constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export const weatherImages={
'Partly Cloudy ':require('../assets/images/partlycloudy.png'),
'Partly cloudy':require('../assets/images/partlycloudy.png'),
'Moderate rain':require('../assets/images/moderaterain.png'),
'Patchy rain possible':require('../assets/images/moderaterain.png'),
'Patchy rain nearby':require('../assets/images/moderaterain.png'),
'Sunny':require('../assets/images/sun.png'),
'Clear':require('../assets/images/sun.png'),
'Overcast':require('../assets/images/cloud.png'),
'Cloudy':require('../assets/images/cloud.png'),
'Light rain':require('../assets/images/moderaterain.png'),
'Moderate rain at times':require('../assets/images/moderaterain.png'),
'Heavy rain':require('../assets/images/heavyrain.png'),
'Heavy rain at times':require('../assets/images/heavyrain.png'),
'Moderate or heavy freezing rain':require('../assets/images/heavyrain.png'),
'Moderate or heavy rain shower':require('../assets/images/heavyrain.png'),
'Moderate or heavy rain with thunder':require('../assets/images/heavyrain.png'),
'Mist':require('../assets/images/mist.png'),
'other':require('../assets/images/moderaterain.png'),

}
9 changes: 9 additions & 0 deletions Weather App/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @format
*/

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
21 changes: 21 additions & 0 deletions Weather App/navigation/appNavigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import { NavigationContainer } from '@react-navigation/native'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import HomeScreen from '../screens/HomeScreen'
import { LogBox } from 'react-native'

const Stack=createNativeStackNavigator()

LogBox.ignoreLogs([
'Non-serializable values were found in the navigation state',
])

export default function AppNavigation() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" options={{headerShown:false}} component={HomeScreen}/>
</Stack.Navigator>
</NavigationContainer>
)
}
Loading

0 comments on commit 3cd2751

Please sign in to comment.