javascript - react native PanResponder to get current scrollView position -


i want current y-offset of scrollview using panresponder. did far, couldn't find way current y-offset

componentwillmount() {    this._panresponder = panresponder.create({      onmoveshouldsetpanresponder: (evt, gesturestate) => true,      onpanresponderrelease: (evt, gesturestate) => {       console.log(this.scrollview) //this logs scrollview      }    }); }  <scrollview ref={(view) => this._scrollview = view} {...this._panresponder.panhandlers}> 

assuming touch release mean moment when 1 touch stops existing, can scrollview's ontouchend prop.

i using onscroll save offset somewhere , ontouchend offset.

<scrollview   onscroll={(event) => {     this.offsety = event.nativeevent.contentoffset.y;   }}   ontouchend={(event) => {     console.log('offsety:', this.offsety);     console.log('touch info:', event.nativeevent);   }} >   {content of scroll view} </scrollview> 

if touch release meant there should 0 touches, can check event passed ontouchend.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -