[Android ListView/ScrollView] Content Padding
Since it lacks the iOS concepts of contentInset/contentOffset, I realized the correct way to do this is with on Android is adding padding in the ListView/ScrollView styles. But there are a couple issues with this.
- The scroll bar/scroll indicator padding is not adjusted accordingly
- The content size is not accounted for
Therefore, when I try to set paddingTop: 110 on my ListView, the content is correctly scrolled down by 110, but the scroll indicator still starts at 0, and additionally I am unable to scroll down and see the final 110 pixels of content in my list.
Have you looked at the margin attribute?
@AaaChiuuu margin is not the solution because that simply changes the bounds of the entire <ListView>. I want the ListView to take up the full screen, but I want the ListView's content to start 110 pixels from the top (there is a NavigationBar-esque header at the top). The content should be able to scroll all the way to the top. With margin, the content is cut off. The correct solution is padding, it just isn't working at the moment.
I encountered the same problem..
This can be achieved by setting a padding in the contentContainerStyle prop.
@marcshilling using contentContainerStyle fixed the issue for you?
I want to use the interpolate function of Animated in my listview's paddingTop. But setting
contentContainerStyle={{paddingTop: this.height.interpolate({
inputRange: [0, 44],
outputRange: [44, 88]
})
}}
gives this error on iOS:
and while it works on android, it throws this warning for every inner view upto RCTView:

I think I encountered the same problem. I am adding margin: 30 to contentContainerStyle, but the list doesn't scroll to the bottom: https://snack.expo.io/ryPLeCWxb I think this happens because the margin is not included in scroll height. I can add padding: 30 to contentContainerStyle instead of margin: 30, but then the black border in contentContainerStyle will not be near the white rows.
Is it possible to obtain a listview that looks like in my example with margin: 30, but scrolls to the bottom? Maybe to wrap all the rows in a View somehow?