【发布时间】:2021-08-20 07:26:27
【问题描述】:
我怎么能理解scrollY是一个空节点,我不明白为什么
const scrollY= new Animated.Value(0)
const onScroll = Animated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], {
listener: (event: any) => console.log('listerner', event),
useNativeDriver: false,
});
<ScrollView
scrollEventThrottle={16}
onScroll={onScroll}>
content....
</ScrollView>
在 console.log 中滚动
AnimatedValue {__lastLoopID: {…},
__memoizedValue: {…},
__children: Array(0),
__nodeID: 1190,
__nodeConfig: {…},
…}__children: (9)
[AnimatedOperator, AnimatedOperator, AnimatedCallFunc, AnimatedOperator, AnimatedOperator, AnimatedCallFunc, AnimatedOperator, AnimatedOperator, AnimatedCallFunc]__initialized: true__inputNodes: undefined__lastLoopID: {"": -1}__memoizedValue: {"": null}__nodeConfig: {type: "value", value: 0}__nodeID: 1190_animation: null_constant: false_startingValue: 0_value: 0[[Prototype]]: InternalAnimatedValue
【问题讨论】:
标签: react-native animation onscroll