Skip to content

Commit

Permalink
Add City interface to Home types
Browse files Browse the repository at this point in the history
  • Loading branch information
ozturksirin committed Mar 30, 2024
1 parent a5e6cee commit 8c2f7a6
Showing 2 changed files with 61 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/screens/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
import { View } from "react-native";
import { AppInput, AppText } from "../../components";
import LongLogo from "../../assets/icons/logoLong.svg";
import { navigate, Props } from "./types";
import { City, navigate, Props } from "./types";
import { styles } from "./index.style";
import { useStore } from "../../store/store";
import Toast from "react-native-toast-message";
@@ -11,14 +11,16 @@ import { flexStyles } from "../../thema";
const Home = (props: Props) => {
const { navigation } = props;
const [searchQuery, setSearchQuery] = useState<string>("");
const [city, setCity] = useState<any[] | undefined | unknown>([]);
const [city, setCity] = useState<City[] | undefined | unknown>([]);
const [isLoading, setIsLoading] = useState<boolean>(false);

const { fetchWeather, fetchCityList } = useStore() as {
fetchWeather: Function;
fetchCityList: Function;
};

console.log("city", city);

const handleSearch = async (text: string) => {
const searchTerm: string =
text
57 changes: 57 additions & 0 deletions src/screens/Home/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -7,3 +7,60 @@ export type navigate = {
name: string;
country: string;
};

export interface City {
base: string;
clouds: Clouds;
cod: number;
coord: Coord;
dt: number;
id: number;
main: Main;
name: string;
sys: Sys;
timezone: number;
visibility: number;
weather: Weather[];
wind: Wind;
}

export interface Clouds {
all: number;
}

export interface Coord {
lat: number;
lon: number;
}

export interface Main {
feels_like: number;
grnd_level: number;
humidity: number;
pressure: number;
sea_level: number;
temp: number;
temp_max: number;
temp_min: number;
}

export interface Sys {
country: string;
id: number;
sunrise: number;
sunset: number;
type: number;
}

export interface Weather {
description: string;
icon: string;
id: number;
main: string;
}

export interface Wind {
deg: number;
gust: number;
speed: number;
}

0 comments on commit 8c2f7a6

Please sign in to comment.