react-native-scrollview-offset
React-Native Android doesn't support contentOffset
prop
(see: https://github.com/facebook/react-native/issues/6849)
contentOffset
cross-compatibility.
Use this component as a drop-in ScrollView replacement for To avoid jumping, this component waits with opacity:0
until after render, then calls scrollTo(props.contentOffset)
, then sets itself to opacity:1
.
Usage:
import ScrollViewOffset from 'react-native-scrollview-offset' { return <> <ScrollViewOffset => <Text> in a ScrollView that loads with an intial scroll position 50 pixels down</Text> <Text>Even in </Text> </ScrollViewOffset> </> }
startAtEnd
(boolean, default: false
) — to set the initial scroll position to the end.
It also offers a new prop — Note: startAtEnd
overrides the contentOffset
prop.
Supports all other props from the default ScrollView.