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

Spencer Carli
1 min readApr 26, 2018

--

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!

--

--

Spencer Carli
Spencer Carli

Written by Spencer Carli

Student. Teacher. Pizza fiend. I mostly write about React Native. https://reactnativeschool.com

Responses (4)