@@ -3,10 +3,10 @@ import { Clock01SolidIcon } from '@assets/icons/icons'
33import type { Current , Weather } from '@screens/Weather/types'
44import { Icons } from '@screens/Weather/utils'
55import { Medium , Regular , SemiBold } from '@utils/fonts'
6- import { getAp , getHour , screenDelay , tempConverter } from '@utils/utils'
7- import React , { useEffect , useState } from 'react'
6+ import { getAp , getHour , tempConverter } from '@utils/utils'
7+ import React from 'react'
88import { View } from 'react-native'
9- import { ScrollView } from 'react-native-gesture-handler'
9+ import { FlatList } from 'react-native-gesture-handler'
1010import Animated , { FadeIn } from 'react-native-reanimated'
1111import type { SvgProps } from 'react-native-svg'
1212import type { ViewProps } from 'react-native-svg/lib/typescript/fabric/utils'
@@ -37,36 +37,35 @@ export default function HourlyForecast({ color, w, hourly }: HourlyWeather) {
3737 < View className = 'rounded-3xl bg-black/10' >
3838 < WeatherLabel Icon = { Clock01SolidIcon } color = { color } label = 'Hourly Forecast' />
3939 < Underline />
40- < ScrollView
41- horizontal = { true }
40+ < FlatList
4241 showsHorizontalScrollIndicator = { false }
42+ horizontal = { true }
4343 contentContainerStyle = { { flexDirection : 'row' , paddingBottom : 10 , paddingHorizontal : 10 } }
44- >
45- < >
44+ renderItem = { ( { item } ) => (
45+ < SmallWeather
46+ key = { item . dt }
47+ Icon = { Icons [ item . weather [ 0 ] ! . icon ] }
48+ time = { getHour ( item . dt + 3600 , timeFormat ) }
49+ color = { color }
50+ ap = { getAp ( item . dt , timeFormat ) }
51+ temp = { item ? tempConverter ( { temp : item . temp , unit : currentUnit , degree : true } ) : '__' }
52+ probability = { Math . round ( ( item . pop || 0 ) * 100 ) }
53+ />
54+ ) }
55+ ListHeaderComponent = {
4656 < View style = { { opacity : data ? 1 : 0 } } >
4757 < SmallWeather
4858 color = { color }
4959 time = 'Now'
5060 Icon = { Icon }
5161 ap = ''
52- // temp={w ? tempConverter(w.current.temp, currentUnit, true) : '__'}
5362 temp = { w ? tempConverter ( { temp : w . current . temp , unit : currentUnit , degree : true } ) : '__' }
5463 probability = { Math . round ( ( w ?. current . pop || 0 ) * 100 ) }
5564 />
5665 </ View >
57- { data ?. map ( ( h , i ) => (
58- < SmallWeather
59- Icon = { Icons [ h . weather [ 0 ] ! . icon ] }
60- key = { i }
61- time = { getHour ( h . dt + 3600 , timeFormat ) }
62- color = { color }
63- ap = { getAp ( h . dt , timeFormat ) }
64- temp = { h ? tempConverter ( { temp : h . temp , unit : currentUnit , degree : true } ) : '__' }
65- probability = { Math . round ( ( h . pop || 0 ) * 100 ) }
66- />
67- ) ) }
68- </ >
69- </ ScrollView >
66+ }
67+ data = { data }
68+ />
7069 </ View >
7170 </ Animated . View >
7271 )
0 commit comments