Created
August 9, 2020 19:58
-
-
Save reime005/1a70ad5e7362e2420372cfd88030e497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const scrollElementHeightPercent = 45; | |
export default Example = () => { | |
... | |
const [scrollViewHeight, setScrollViewHeight] = React.useState(0); | |
const scrollPerc = (contentOffset.y / (contentSize - scrollViewHeight)) | |
* (100 - scrollElementHeightPercent); | |
return( | |
<ScrollView | |
... | |
onLayout={e => { | |
setScrollViewHeight(e.nativeEvent.layout.height); | |
}} | |
>... | |
</ScrollView> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment