1- import React , { useState , useCallback , useMemo } from 'react' ;
1+ import React , { useState , useCallback } from 'react' ;
22import {
33 Image ,
44 StyleSheet ,
@@ -7,7 +7,14 @@ import {
77 ActivityIndicator ,
88 TouchableOpacity ,
99} from 'react-native' ;
10- import { Box , Card , HFlashList , Typography , useTheme , VFlashList } from 'rnc-theme' ;
10+ import {
11+ Box ,
12+ Card ,
13+ HFlashList ,
14+ Typography ,
15+ useTheme ,
16+ VFlashList ,
17+ } from 'rnc-theme' ;
1118
1219const { width } = Dimensions . get ( 'window' ) ;
1320
@@ -32,7 +39,7 @@ interface Post {
3239}
3340
3441// Generate dummy data
35- const generateDummyStories = ( count : number , offset : number = 0 ) : Story [ ] => {
42+ const generateDummyStories = ( count : number , offset = 0 ) : Story [ ] => {
3643 return Array . from ( { length : count } , ( _ , index ) => ( {
3744 id : `story-${ offset + index } ` ,
3845 username : `user${ offset + index + 1 } ` ,
@@ -42,7 +49,7 @@ const generateDummyStories = (count: number, offset: number = 0): Story[] => {
4249 } ) ) ;
4350} ;
4451
45- const generateDummyPosts = ( count : number , offset : number = 0 ) : Post [ ] => {
52+ const generateDummyPosts = ( count : number , offset = 0 ) : Post [ ] => {
4653 const captions = [
4754 'Beautiful sunset today! 🌅' ,
4855 'Great coffee and good vibes ☕' ,
@@ -69,7 +76,7 @@ const generateDummyPosts = (count: number, offset: number = 0): Post[] => {
6976} ;
7077
7178const FlashListScreen : React . FC = ( ) => {
72- const { theme} = useTheme ( ) ;
79+ const { theme } = useTheme ( ) ;
7380 // Stories state
7481 const [ stories , setStories ] = useState < Story [ ] > ( ( ) =>
7582 generateDummyStories ( 10 )
@@ -202,59 +209,57 @@ const FlashListScreen: React.FC = () => {
202209 const postKeyExtractor = useCallback ( ( item : Post ) => item . id , [ ] ) ;
203210
204211 return (
205- < ScrollView style = { styles . scrollView } >
206- { /* Stories Section */ }
207- < Box themed style = { styles . section } >
208- < Box style = { styles . sectionHeader } >
209- < Typography style = { styles . sectionTitle } > Stories</ Typography >
210- { storiesLoading && (
211- < ActivityIndicator size = "small" color = "#007AFF" />
212- ) }
213- </ Box >
214- < Box style = { styles . storiesContainer } >
215- < HFlashList
216- data = { stories }
217- renderItem = { renderStoryItem }
218- keyExtractor = { storyKeyExtractor }
219- estimatedItemSize = { 100 }
220- estimatedListSize = { { height : 120 , width : width } }
221- infiniteScroll = { {
222- onLoadMore : loadMoreStories ,
223- loading : storiesLoading ,
224- hasMore : storiesHasMore ,
225- threshold : 0.8 ,
226- } }
227- showsHorizontalScrollIndicator = { false }
228- contentContainerStyle = { styles . storiesContent }
229- />
230- </ Box >
212+ < ScrollView style = { styles . scrollView } >
213+ { /* Stories Section */ }
214+ < Box themed style = { styles . section } >
215+ < Box style = { styles . sectionHeader } >
216+ < Typography style = { styles . sectionTitle } > Stories</ Typography >
217+ { storiesLoading && < ActivityIndicator size = "small" color = "#007AFF" /> }
218+ </ Box >
219+ < Box style = { styles . storiesContainer } >
220+ < HFlashList
221+ data = { stories }
222+ renderItem = { renderStoryItem }
223+ keyExtractor = { storyKeyExtractor }
224+ estimatedItemSize = { 100 }
225+ estimatedListSize = { { height : 120 , width : width } }
226+ infiniteScroll = { {
227+ onLoadMore : loadMoreStories ,
228+ loading : storiesLoading ,
229+ hasMore : storiesHasMore ,
230+ threshold : 0.8 ,
231+ } }
232+ showsHorizontalScrollIndicator = { false }
233+ contentContainerStyle = { styles . storiesContent }
234+ />
231235 </ Box >
236+ </ Box >
232237
233- { /* Posts Section */ }
234- < Box themed style = { styles . section } >
235- < Box style = { styles . sectionHeader } >
236- < Typography style = { styles . sectionTitle } > Posts</ Typography >
237- { postsLoading && < ActivityIndicator size = "small" color = "#007AFF" /> }
238- </ Box >
239- < Box style = { styles . postsContainer } >
240- < VFlashList
241- data = { posts }
242- renderItem = { renderPostItem }
243- keyExtractor = { postKeyExtractor }
244- estimatedItemSize = { 400 }
245- estimatedListSize = { { height : 600 , width : width } }
246- infiniteScroll = { {
247- onLoadMore : loadMorePosts ,
248- loading : postsLoading ,
249- hasMore : postsHasMore ,
250- threshold : 0.5 ,
251- } }
252- showsVerticalScrollIndicator = { false }
253- contentContainerStyle = { styles . postsContent }
254- />
255- </ Box >
238+ { /* Posts Section */ }
239+ < Box themed style = { styles . section } >
240+ < Box style = { styles . sectionHeader } >
241+ < Typography style = { styles . sectionTitle } > Posts</ Typography >
242+ { postsLoading && < ActivityIndicator size = "small" color = "#007AFF" /> }
243+ </ Box >
244+ < Box style = { styles . postsContainer } >
245+ < VFlashList
246+ data = { posts }
247+ renderItem = { renderPostItem }
248+ keyExtractor = { postKeyExtractor }
249+ estimatedItemSize = { 400 }
250+ estimatedListSize = { { height : 600 , width : width } }
251+ infiniteScroll = { {
252+ onLoadMore : loadMorePosts ,
253+ loading : postsLoading ,
254+ hasMore : postsHasMore ,
255+ threshold : 0.5 ,
256+ } }
257+ showsVerticalScrollIndicator = { false }
258+ contentContainerStyle = { styles . postsContent }
259+ />
256260 </ Box >
257- </ ScrollView >
261+ </ Box >
262+ </ ScrollView >
258263 ) ;
259264} ;
260265
0 commit comments