react native flatlist view code example
Example: flatlist onrefresh react native
const [isFetching, setIsFetching] = useState(false);
const fetchData = () => {
dispatch(getAllDataAction(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." />}
/>;