React Native · Components
ScrollView
Scroll view connected to the gesture arbiter.
Import
ScrollView
componentScroll view connected to the gesture arbiter. The scrolling itself is the platform's native scrolling (momentum, bounce, 120 Hz smoothness are kept as is); on top of it a layer resolves conflicts with inner drags:
- Inner
GestureView/usePanGestureregions (slider, carousel, swipe-to-act, signature, chart) do not move the page in their own directions; on the native side the decision is made in the same frame as the touch. - Reports the directions it can scroll to the arbiter: at the top a pull-down closes the outer Sheet, in the middle the content scrolls; in a horizontal list at the start, a rightward pull goes to navigation's "back" gesture.
- Open
Swipeablerows close when scrolling starts.
All library components use this. It is a drop-in replacement for React Native ScrollView; ref gives the same instance.
Examples
renderScrollView
functionScroll component for FlatList, SectionList and VirtualizedList: renders the list on the library's ScrollView, so the list is also connected to the gesture arbiter (horizontal drags in a row do not scroll the list, a pull-down at the top goes to the Sheet). When onRefresh is given it adds a RefreshControl like React Native's default.
Examples
useScrollRegion
functionRegisters a scroll view with the gesture arbiter. ScrollView uses this itself; for other scroll views such as FlatList/SectionList:
- Reports the directions it can scroll: at the top, a pull-down goes to the outer Sheet (drag down to close); in the middle the content scrolls. In a horizontal list at the first item, a rightward pull goes to navigation's "back" gesture.
- Notifies the arbiter when scrolling starts (open
Swipeablerows close). - Where there is no native gesture view (web), stops scrolling when an inner drag starts.
Given handlers are kept and merged with them.
Examples
ListScrollProps
typeProps virtualized lists pass to the scroll component.
Extends: NativeScrollViewProps
| Name | Type | Description |
|---|---|---|
ref? | Ref<ScrollViewRef> | React Native ScrollView instance. |
onRefresh? | (() => void) | null | Called on pull to refresh. |
refreshing? | boolean | null | Whether the refresh indicator is shown. |
progressViewOffset? | number | Offset of the refresh indicator from the top. |
ScrollRegionProps
interfaceScroll props read and merged by useScrollRegion.
| Name | Type | Description |
|---|---|---|
horizontal? | boolean | null | Horizontal scrolling. |
inverted? | boolean | null | Inverted list (FlatList inverted): on-screen directions are the reverse of the scroll direction. |
scrollEnabled? | boolean | Whether scrolling is enabled. |
refreshControl? | unknown | If present, a pull-down at the top belongs to scrolling (refresh). |
onScroll? | ((event: ScrollEvent) => void) | unknown | Scroll handler (an Animated.event is also accepted). |
onScrollBeginDrag? | (event: ScrollEvent) => void | Drag started. |
onScrollEndDrag? | (event: ScrollEvent) => void | Drag ended. |
onMomentumScrollEnd? | (event: ScrollEvent) => void | Momentum scroll ended. |
onLayout? | (event: LayoutChangeEvent) => void | Layout changed. |
onContentSizeChange? | (width: number, height: number) => void | Content size changed. |
onTouchStart? | (event: GestureResponderEvent) => void | Touch started. |
onTouchEnd? | (event: GestureResponderEvent) => void | Touch ended. |
onTouchCancel? | (event: GestureResponderEvent) => void | Touch cancelled. |
ScrollRegion
interfaceResult of useScrollRegion.
| Name | Type | Description |
|---|---|---|
region | GestureRegion | The region in the arbiter. |
props | P | Props to pass to the scroll view (ScrollView, FlatList, SectionList). |
lock | ScrollLock | Lock to pass to ScrollLockContext (for inner drags). |
ScrollViewRef
typeReact Native ScrollView instance (scrollTo, scrollToEnd, flashScrollIndicators).
ScrollViewProps
interfaceScrollView props: same as React Native ScrollView.
Extends: NativeScrollViewProps
| Name | Type | Description |
|---|---|---|
ref? | Ref<ScrollViewRef> | React Native ScrollView instance. |