scrolllview' contentInset does't work when first loaded.
<ScrollView
contentInset={{top: -400, left: 0, bottom: 0, right: 0}}
style={styles.scrollview}
contentContainerStyle={styles.contentContainer}
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={ () => this.onRefresh() }
/>
}>
{this.state.testData}
</ScrollView>
.....
var styles = StyleSheet.create({
contentContainer:{
paddingVertical:0,
},
scrollview: {
flex: 1,
},
});
at first,the contentInset does't work, then I touched the scrollview and moved it, the contentInset worked.
Seems contentOffset = {{ top: - contentInset.top }} works.
I'm seeing exactly the same issue.
Hi there! This issue is being closed because it has been inactive for a while.
But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/scrolllview-contentinset-doest-work-when-first-loaded
Product Pains has been very useful in highlighting the top bugs and feature requests: https://productpains.com/product/react-native?tab=top
Also, if this issue is a bug, please consider sending a pull request with a fix.