let scrollViewRef =''
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
ref={ref => { scrollViewRef = ref }}
// onScroll={(e) => {
// // 监听滚动 的距离
// // console.log(e.nativeEvent)
// contentOffset = e.nativeEvent.contentOffset.x
// if (e.nativeEvent.contentOffset.x === 0) {
// nu = 0
// contentOffset = 0
// }
// // 到尾部了
// if (e.nativeEvent.contentOffset.x + e.nativeEvent.layoutMeasurement.width >= e.nativeEvent.contentSize.width) {
// contentOffset = 0
// }
// }}
>
rn的scrollView的滚动距离
最新推荐文章于 2025-01-18 22:11:16 发布
本文介绍如何使用React Native中的ScrollView组件,并通过引用(ref)进行滚动视图的优化,包括禁用水平滚动指示器、监听滚动距离及处理滚动到末尾的情况。
5761

被折叠的 条评论
为什么被折叠?



