【发布时间】:2023-01-26 04:51:19
【问题描述】:
我正在尝试将 scrollView 的值设置为 0,但它正在崩溃
下面是我的代码
const scrollY = useRef(new Animated.Value(0)).current;
return (
<View style={{flex: 1}}>
<Animated.ScrollView
style={{flex: 1}}
onScroll={Animated.event(
[{nativeEvent: {contentOffset: {y: scrollY}}}],
{useNativeDriver: true},
)}
scrollEventThrottle={16}>
<Animated.View style={{top: scrollY}}>
<ProductDetail route={route} navigation={navigation} />
</Animated.View>
<ProductDetailInfo route={route} />
<Topping route={route} />
</Animated.ScrollView>
<ButtonProductDetail />
</View>
);
};
【问题讨论】: