Skip to main content

RefreshControl

A standard control that can initiate the refreshing of a scroll view's contents

Submit feedback
github
import { RefreshControl } from '@uhg-abyss/mobile';

Usage

The RefreshControl component is used to implement pull-to-refresh functionality in scrollable views, such as ScrollView, FlatList, or SectionList. This component is a customized version of React Native's core RefreshControl, offering enhanced styling, animations, and better integration with our design system.


() => {
const [refreshing, setRefreshing] = useState(false);
const onRefresh = useCallback(() => {
setRefreshing(true);
setTimeout(() => {
setRefreshing(false);
}, 4500);
}, []);
return (
<ScrollView
contentContainerStyle={{
flex: 1,
backgroundColor: '#D9E9FA',
alignItems: 'center',
justifyContent: 'center',
}}
refreshControl={
<RefreshControl
colors={[
'red',
'$core.color.yellow.100',
'$semantic.color.surface.accent.decorative.3',
'green',
]}
progressBackgroundColor="$semantic.color.surface.container.emphasis.1"
tintColor="$semantic.color.surface.container.emphasis.4"
titleColor="$semantic.color.icon.status.info"
title="Page is refreshing"
progressViewOffset="$semantic.spacing.xs"
refreshing={refreshing}
onRefresh={onRefresh}
/>
}
>
<Text>Pull down to see RefreshControl indicator</Text>
</ScrollView>
);
};

RefreshControl Classes

Class NameDescription
abyss-refresh-control-rootRefreshControl root element

RefreshControl Props

Extends React Native - RefreshControl Props
Prop NameTypeDefaultDescription
colorsAbyss.Color[]-The colors (at least one) that will be used to draw the refresh indicator
progressBackgroundColorAbyss.Color-The background color of the refresh indicator
progressViewOffsetnumber-The distance between the refresh indicator and the top of the view
styleAbyss.Style<"RefreshControl">-Object or array of objects defining the style of the RefreshControl component
tintColorAbyss.Color-The tint color of the refresh indicator
titleColorstring-The color of the refresh indicator title
Table of Contents