How does Animated.Event work in React Native?

后端 未结 3 888
长发绾君心
长发绾君心 2021-02-04 06:38

I\'m I understanding it correctly ? Does this two set of code meant the same thing ?Does it have any difference in performance or reliability ?



        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 06:56

    Yes there is a difference in semantic

     
    

    The first one i.e the above Animated.event returns a function that sets the scrollview's nativeEvent.contentOffset.y to your current scrollY state which I assume is animated.

    The other code just sets scrollY to your scrollView's e.nativeEvent.contentOffset.y and causes a rerender to your component

提交回复
热议问题