React Native · Components
BackToTop
"Back to top" button (same behavior as web): appears in the corner once the list is scrolled threshold far, and scrolls smoothly to the top on press.
3 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
Scroll the page down; the button appears in the corner and its ring shows how much you've read.
Code
Events
- Events appear here when you interact with the preview.
Import
BackToTop
component"Back to top" button (same behavior as web): appears in the corner once the list is scrolled threshold far, and scrolls smoothly to the top on press. For long lists, feeds and document screens.
- Progress: the ring around it fills with the read part of the list (
progress={false}turns it off). Only this button re-renders; the list and screen do not. - On scroll up: with
showOnScrollUpit appears only while scrolling up. - Accessibility: hidden from screen readers while hidden; "Back to top" is announced after scrolling up. With reduced motion scrolling is instant.
Place it as a sibling of the scroll component, in the view wrapping the screen.
Examples
Button placement (same as web).
BackToTopProps
interfaceProps of the BackToTop component.
| Name | Type | Default | Description |
|---|---|---|---|
scroll | ScrollTracker | The tracked list (useScrollTracker); position, progress and scrolling to top come from it. | |
threshold? | number | 400 | Distance that must be scrolled for the button to appear (dp). |
position? | BackToTopPosition | "bottom-right" | Button placement. |
progress? | boolean | true | Show reading progress in the ring? |
showOnScrollUp? | boolean | false | Show only while scrolling up? Does not cover the content while reading down. |
offset? | number | 16 | Distance from the edges (dp); the safe area inset is added. |
icon? | IconProp | up arrow | Button icon. |
label? | string | the `backToTop` text ("Başa dön") | Screen reader name and tooltip. |
children? | ReactNode | Text shown next to the icon; when given, the button becomes a pill. | |
tooltip? | TooltipProp | false | Tooltip. Defaults to label; false turns it off. | |
onPress? | () => void | Called after scrolling to the top. | |
style? | ViewStyle | Button style (e.g. { bottom: 72 } for a bottom tab bar). |