1const [isFetching, setIsFetching] = useState(false);
2
3const fetchData = () => {
4 dispatch(getAllTopicAction(userParamData));
5 setIsFetching(false);
6};
7
8const onRefresh = () => {
9 setIsFetching(true);
10 fetchData();
11};
12
13<FlatList
14 data={topics}
15 keyExtractor={(item) => item.id.toString()}
16 renderItem={renderItem}
17 onRefresh={onRefresh}
18 refreshing={isFetching}
19 progressViewOffset={100}
20 ListEmptyComponent={<Empty message="No data found." />}
21/>;
22
1const [isFetching, setIsFetching] = useState(false);
2
3const fetchData = () => {
4 dispatch(getAllDataAction(userParamData));
5 setIsFetching(false);
6};
7
8const onRefresh = () => {
9 setIsFetching(true);
10 fetchData();
11};
12
13<FlatList
14 data={topics}
15 keyExtractor={(item) => item.id.toString()}
16 renderItem={renderItem}
17 onRefresh={onRefresh}
18 refreshing={isFetching}
19 progressViewOffset={100}
20 ListEmptyComponent={<Empty message="No data found." />}
21/>;
22