Skip to content

Commit 1941d0a

Browse files
committed
chore: showing button with data
1 parent 9a85405 commit 1941d0a

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

template/src/screens/Home.tsx

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,34 @@ const HomeScreen = () => {
125125

126126
const { navigate } = useNavigation<ProfileScreenNavigationProp>();
127127

128+
const footerButton = ()=>{
129+
return (
130+
<Button
131+
my={'sm'}
132+
flexDirection="row"
133+
width={WINDOW_DEVICE_WIDTH * 0.8}
134+
backgroundColor={!hasNextPage ? 'secondary' : 'grayLight'}
135+
disabled>
136+
{isFetching || hasNextPage ? (
137+
<LottieView
138+
source={require('../../assets/spinner.json')}
139+
autoPlay
140+
loop
141+
hardwareAccelerationAndroid={false}
142+
resizeMode="contain"
143+
style={{
144+
height: 40,
145+
width: 40,
146+
}}
147+
/>
148+
) : (
149+
<Typography color={!hasNextPage ? 'primary' : 'secondary'}>
150+
All list is loaded
151+
</Typography>
152+
)}
153+
</Button>
154+
)
155+
}
128156
return (
129157
<SafeAreaView style={styles.safeArea}>
130158
<StatusBar barStyle="light-content" />
@@ -186,37 +214,7 @@ const HomeScreen = () => {
186214
hasNextPage && handleMore();
187215
}}
188216
onEndReachedThreshold={0.1}
189-
ListFooterComponent={() => {
190-
if(isFetching){
191-
return null;
192-
}
193-
return (
194-
<Button
195-
my={'sm'}
196-
flexDirection="row"
197-
width={WINDOW_DEVICE_WIDTH * 0.8}
198-
backgroundColor={!hasNextPage ? 'secondary' : 'grayLight'}
199-
disabled>
200-
{isFetching || hasNextPage ? (
201-
<LottieView
202-
source={require('../../assets/spinner.json')}
203-
autoPlay
204-
loop
205-
hardwareAccelerationAndroid={false}
206-
resizeMode="contain"
207-
style={{
208-
height: 40,
209-
width: 40,
210-
}}
211-
/>
212-
) : (
213-
<Typography color={!hasNextPage ? 'primary' : 'secondary'}>
214-
All list is loaded
215-
</Typography>
216-
)}
217-
</Button>
218-
);
219-
}}
217+
ListFooterComponent={data && footerButton()}
220218
/>
221219
</Box>
222220
</Box>
@@ -231,3 +229,5 @@ const styles = StyleSheet.create({
231229
backgroundColor: theme.colors.backgroundColor,
232230
},
233231
});
232+
233+

0 commit comments

Comments
 (0)