Get current scroll position of ScrollView in React Native

后端 未结 11 1510
遇见更好的自我
遇见更好的自我 2020-11-27 11:10

Is it possible to get the current scroll position, or the current page of a component in React Native?

So something like:

<         


        
11条回答
  •  隐瞒了意图╮
    2020-11-27 11:45

    To get the x/y after scroll ended as the original questions was requesting, the easiest way is probably this:

     { 
          // scroll animation ended
          console.log(e.nativeEvent.contentOffset.x);
          console.log(e.nativeEvent.contentOffset.y);
       }}>
       ...content
    
    

提交回复
热议问题