大佬教程收集整理的这篇文章主要介绍了当用户滚动时,在 ScrollView 内的 Reanimated View 上 Janky translateY iOS 上的 JankyAndroid 上的 Janky(有和没有 scrollEventThrottle={16})以下视频说明了它应该如何(在 iOS 上使用 scrollEventThrottle={16},但它不能修复 Android),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用 react-native-reanimated v1。我想通过使用 <Reanimated.VIEw>
使 translateY
看起来好像在滚动视图中是固定的。它应该如何表现的GIF在帖子的最后。我已经简化了下面片段中的代码,并且我在小吃中有完整的工作代码。
https://snack.expo.io/@noitidart/reanimated-scroll-view
当您滚动时,您会注意到视图的位置并没有固定在顶部。我附上了一段在 iOS 上拍摄的小吃视频。
如果我添加 scrollEventThrottle={16}
,它可以解决 iOS 上的问题,但在 AndroID 上,如果您滚动速度甚至比平时快一点,您会看到转换滞后。我认为 iOS 上也应该有一种没有 scrollEventThrottle
属性的方法,对我来说我们需要它没有意义,因为 reanimated 应该更新每一帧。
关于如何解决这个问题有什么想法吗?
const ReanimatedScrollVIEw = Reanimated.createAnimatedComponent(ScrollVIEw);
export default function App() {
const translateY = Reanimated.useValue(0);
const handleScroll = Reanimated.event([
{
nativeEvent: nativeEvent => Reanimated.block([Reanimated.set(translateY,nativeEvent.contentOffset.y)])
}])
return (
<ReanimatedScrollVIEw onScroll={handleScroll}>
<Reanimated.VIEw style={{ transform: [{ translateY }] }} />
</ReanimatedScrollVIEw>
);
}
scrollEventThrottle={16}
)scrollEventThrottle={16}
,但它不能修复 AndroID)暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的当用户滚动时,在 ScrollView 内的 Reanimated View 上 Janky translateY iOS 上的 JankyAndroid 上的 Janky(有和没有 scrollEventThrottle={16})以下视频说明了它应该如何(在 iOS 上使用 scrollEventThrottle={16},但它不能修复 Android)全部内容,希望文章能够帮你解决当用户滚动时,在 ScrollView 内的 Reanimated View 上 Janky translateY iOS 上的 JankyAndroid 上的 Janky(有和没有 scrollEventThrottle={16})以下视频说明了它应该如何(在 iOS 上使用 scrollEventThrottle={16},但它不能修复 Android)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。