Enable Scroll in a React Native ScrollView Based on the Content Size

Ever have the situation where you sometimes had content that was shorter than the screen size and didn’t require scrolling but occasionally had content taller than the screen size, thus necessitating scroll to allow the user to see all the content?

If that’s your case you can leverage the onContentSizeChange prop of a ScrollView and check whether the content height is taller than the screen size.

Here’s what I mean…

Full Code: https://github.com/spencercarli/react-native-dynamic-scrollview

Here’s a video walkthrough as well

Interested in learning more about React Native? Join my email list!