1.0.2 • Published 1 year ago

@edvnz/refresh-control v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

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 nameTypeDescription
refreshingboolean