React Native · Components
InfiniteScroll
A scroll area that loads the next page when reaching the end of the list (same API as web): feeds, comments, chat history.
2 exports
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Preview
Post 1
Post 2
Post 3
Post 4
Post 5
Post 6
Post 7
Post 8
Post 9
Post 10
Code
Events
- Events appear here when you interact with the preview.
Import
InfiniteScroll
componentA scroll area that loads the next page when reaching the end of the list (same API as web): feeds, comments, chat history. Give items as children; for thousands of items use VirtualList (the same onLoadMore behavior).
- One load at a time; if a page does not fill the screen, the next one loads too.
- It does not loop on errors; a "Retry" button appears.
direction="up": the scroll offset is kept for items added to the start (the same on iOS and Android:maintainVisibleContentPosition).manualAfter: switches to a button after a few automatic loads.- "Busy" is reported to screen readers while loading.
Examples
InfiniteScrollProps
interfaceProps of the InfiniteScroll component (same names as on web).
| Name | Type | Default | Description |
|---|---|---|---|
children? | ReactNode | Items loaded so far. | |
onLoadMore | () => unknown | Loads the next page. If it returns a Promise it is not called again until it finishes; if it throws, a "Retry" button appears. | |
onError? | (error: unknown) => void | Called when onLoadMore fails (logging, notification). | |
hasMore | boolean | Whether there is another page to load. | |
loading? | boolean | Loading info from outside (e.g. the first page); not triggered while true. | |
direction? | "down" | "up" | "down" | Load direction. "up": like a chat; older items are added to the start and the scroll offset is kept (content does not jump). |
threshold? | number | 400 | Start loading this far from the end (dp). |
manualAfter? | number | Switches to a "Load more" button after this many automatic loads. 0 means always a button. If omitted it always loads automatically. | |
loader? | ReactNode | A spinner | Loading indicator. |
endMessage? | ReactNode | Shown at the end of the list when everything is loaded. true shows the built-in text. | |
errorMessage? | ReactNode | the `loadError` text | Text shown when loading fails. |
loadMoreLabel? | ReactNode | the `loadMore` text | Text of the "Load more" button. |
onRefresh? | () => unknown | Pull to refresh; if it returns a Promise the indicator spins until it finishes. | |
scroll? | ScrollTracker | Scroll tracker (useScrollTracker): for binding Fab, BackToTop. | |
style? | StyleProp<ViewStyle> | Style of the scroll area (default flex: 1). | |
contentStyle? | StyleProp<ViewStyle> | Style of the content container (padding, gap). | |
testID? | string | Test id. |