2
我是否正確理解它? 這兩組代碼是否意味着相同的東西?它在性能或可靠性方面有什麼不同嗎?Animated.Event如何在React Native中工作?
<ScrollView
onScroll={Animated.event(
[{nativeEvent: {contentOffset: {y: this.state.scrollY}}}]
)}
>
</ScrollView>
和
handleScroll(e){
this.setState({ scrollY : e.nativeEvent.contentOffset.y });
}
<ScrollView
onScroll={(e) => this.handleScroll(e)}
>
</ScrollView>
感謝