react-native-djrefresh-library
v0.3.1
Published
pull to refresh with flatlist
Downloads
19
Readme
react-native-djrefresh-library
pull to refresh with flatlist iOS with MJRefresh Android Native fork SwipeRefreshLayout
Installation
npm install react-native-djrefresh-library
Usage
ios
cd ios & pod install
import {
DJRefreshDefaultHeader,
DJRefreshHeader,
} from 'react-native-djrefresh-library';
// ...
<FlatList
contentInsetAdjustmentBehavior="never"
automaticallyAdjustContentInsets={false}
style={styles.list}
data={DATA}
renderItem={({ item }) => <Item title={item.title} />}
keyExtractor={(item) => item.id}
refreshControl={
// default header
// <DJRefreshDefaultHeader
// refreshing={refreshing}
// onRefresh={() => {
// console.log('开始刷新');
// setRefreshing(true);
// setTimeout(() => {
// console.log('结束刷新');
// setRefreshing(false);
// }, 3000);
// }}
// />
//custom header
<DJRefreshHeader
refreshHeader={
<View style={{ height: 55 }}>
<LottieView
style={{ width: '100%', height: 55 }}
source={require('./assets/animation_llq8e2yb.json')}
autoPlay
loop
/>
</View>
}
refreshing={refreshing}
onRefresh={() => {
console.log('开始刷新');
setRefreshing(true);
setTimeout(() => {
console.log('结束刷新');
setRefreshing(false);
}, 3000);
}}
/>
}
/>
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library