Refresh Control
Installation
To install the BottomSheet component, run the following command:
$ npm install @edvnz/refresh-control
# or
$ yarn add @edvnz/refresh-control
Usage
import { RefreshControl } from '@edvnz/refreshControl'
const Component = () => {
const [refreshing, setRefreshing] = useState(false)
const wait = (timeout) => {
return new Promise((resolve) => setTimeout(resolve, timeout))
}
const onRefresh = () => {
setRefreshing(true)
wait(2000).then(() => setRefreshing(false))
}
return (
<ScrollView
contentContainerStyle={{ flexGrow: 1 }}
showsVerticalScrollIndicator={false}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={onRefresh}
tintColor={colors.primary}
size={20}
/>
}
>
{...}
</ScrollView>
)
}
Props
Prop name | Type | Description |
---|---|---|
refreshing |
boolean |