Skip to content

Commit 6d950ec

Browse files
committed
testing on backend example screen
1 parent 9c33118 commit 6d950ec

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

src/screens/DataFromBeScreen_EXAMPLE.tsx

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { useArticlesControllerFindAll } from '@baca/api/query/articles/articles'
22
import { ArticleEntity } from '@baca/api/types'
33
import { Loader, Center, Text, Box, Spacer } from '@baca/design-system'
44
import { useScreenOptions, useTranslation } from '@baca/hooks'
5+
import { FlashList } from '@shopify/flash-list'
56
import { useCallback } from 'react'
6-
import { ListRenderItem, FlatList } from 'react-native'
77

88
export const DataFromBeScreen_EXAMPLE = () => {
99
const { t } = useTranslation()
@@ -15,7 +15,7 @@ export const DataFromBeScreen_EXAMPLE = () => {
1515
const { data: articles, isInitialLoading: isInitialLoadingArticles } =
1616
useArticlesControllerFindAll({ page: 1, pageSize: 10 })
1717

18-
const renderItem: ListRenderItem<ArticleEntity> = useCallback(({ item: { id, title } }) => {
18+
const renderItem = useCallback(({ item: { id, title } }: { item: ArticleEntity }) => {
1919
return (
2020
<Box mb="1" bg="fg.brand.primary" borderRadius={2} m={2}>
2121
<Text>{'id: ' + id}</Text>
@@ -26,24 +26,23 @@ export const DataFromBeScreen_EXAMPLE = () => {
2626

2727
return (
2828
<Box flex={1}>
29-
<Center flex={1}>
30-
<Text.XlRegular>THIS IS EXAMPLE SCREEN</Text.XlRegular>
31-
<Text.XlRegular>which contains data from backend</Text.XlRegular>
32-
<Spacer y="1" />
33-
<FlatList
34-
ListEmptyComponent={
35-
!isInitialLoadingArticles ? (
36-
<Center height={400} flex={1}>
37-
<Loader type="circle" />
38-
</Center>
39-
) : (
40-
<Text>No data found</Text>
41-
)
42-
}
43-
data={articles}
44-
renderItem={renderItem}
45-
/>
46-
</Center>
29+
<Text.XlRegular alignSelf="center">THIS IS EXAMPLE SCREEN</Text.XlRegular>
30+
<Text.XlRegular alignSelf="center">which contains data from backend</Text.XlRegular>
31+
<Spacer y="1" />
32+
<FlashList
33+
ListEmptyComponent={
34+
!isInitialLoadingArticles ? (
35+
<Center height={400} flex={1}>
36+
<Loader type="circle" />
37+
</Center>
38+
) : (
39+
<Text>No data found</Text>
40+
)
41+
}
42+
data={articles}
43+
renderItem={renderItem}
44+
estimatedItemSize={81}
45+
/>
4746
</Box>
4847
)
4948
}

0 commit comments

Comments
 (0)