XauiXaui

PullToRefresh

Beta

Headless pull-to-refresh wrapper that injects a native RefreshControl into any compatible scrollable component.

Installation

npm install @xaui/native

Import

import { PullToRefresh } from '@xaui/native/refresh-control'

Basic Usage

Minimal example showing the component with its default configuration.

import { PullToRefresh } from '@xaui/native/refresh-control'
export function Example() {
return <PullToRefresh />
}

Basic

import { useState } from 'react'
import { ScrollView, Text } from 'react-native'
import { PullToRefresh } from '@xaui/native/refresh-control'
export function BasicExample() {
const [refreshing, setRefreshing] = useState(false)
const handleRefresh = async () => {
setRefreshing(true)
await new Promise(resolve => setTimeout(resolve, 1000))
setRefreshing(false)
}
return (
<PullToRefresh refreshing={refreshing} onRefresh={handleRefresh}>
<ScrollView contentContainerStyle={{ padding: 16, gap: 12 }}>
<Text>Pull down to refresh</Text>
</ScrollView>
</PullToRefresh>
)
}