ListView always scrolls back to the top in react-native

孤街浪徒 提交于 2019-12-05 14:19:54

Give flex: 1 attribute to the sceneContainer also, like:

sceneContainer: {
  flex: 1,
  marginTop: 60
},

Working here: https://rnplay.org/apps/TL9N9g

For simple clarity: you need to set the height of the ListView itself OR set the height of the container/parent element using an explicit "height" value or by setting "flex" in the style.

<View style={{flex:1}}>
   <ListView />
</View>

<View>
   <ListView style={{height:300}} />
</View>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!