React-Native ScrollView滚动至底部
时间:2020-10-27 16:18:31
收藏:0
阅读:293
实现滚动条默认定位至底部的方式:
1.定义变量接受ScrollView组件实例
2.通过onContentSizechange属性调用scrollToEnd函数
ps:scrollTo函数可以自定义位置
private ref: ScrollView = new ScrollView({});
<ScrollView
onContentSizeChange={()=> this.ref.scrollToEnd({animated:false})}
ref={(ref) => this.ref = ref!}
>
<List>...</List>
</ScrollView>
原文:https://www.cnblogs.com/Jack-xin/p/13884332.html
评论(0)