Flatlist Onrefresh React Native
const [isFetching, setIsFetching] = useState(false);
const fetchData = () => {
dispatch(getAllTopicAction(userParamData));
setIsFetching(false);
};
const onRefresh = () => {
setIsFetching(true);
fetchData();
};
<FlatList
data={topics}
keyExtractor={(item) => item.id.toString()}
renderItem={renderItem}
onRefresh={onRefresh}
refreshing={isFetching}
progressViewOffset={100}
ListEmptyComponent={<Empty message="No data found." />}
/>;
Dayanaohhnana