react-native icon indicating copy to clipboard operation
react-native copied to clipboard

scrolllview' contentInset does't work when first loaded.

Open yimiaodaren opened this issue 10 years ago • 3 comments

<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.

yimiaodaren avatar Mar 10 '16 15:03 yimiaodaren

Seems contentOffset = {{ top: - contentInset.top }} works.

ultragtx avatar May 26 '16 11:05 ultragtx

I'm seeing exactly the same issue.

olivierlesnicki avatar Jul 21 '16 06:07 olivierlesnicki

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.

mkonicek avatar Oct 27 '16 22:10 mkonicek