Scroll to bottom of ScrollView in React Native -
i find way programmatically scroll bottom of scrollview. aware of scrollto method after looking @ source code scrollview, cannot seem find way measure content size of scrollview.
after looking around, came across this github issue mentions @ how "uimanager.measurex methods used" measure content size. after searching several times through source code, cannot quite seem find these methods used.
would able point me in right direction?
it pretty consealed , ran source code.
you can try this:
require:
var rctuimanager = require('nativemodules').uimanager;
render:
<scrollview ref = {component=>{this._scrollview=component;}}> </scrollview>
event:
someevent: function() { rctuimanager.measure(this._scrollview.getinnerviewnode(), (...data)=>{console.log(data)}); }
from data, can contentsize of scrollview height fourth element of data
. of course can content offset it. run source code of rctuimananger.m
more details.
when use getinnerviewnode
can frame of scrollview's inner view's frame. if want scrollview's frame, should use react.findnodehandle(this._scrollview)
, , scrollview's frame not equals inner view's frame.
(updated)
if want replace (...data)=>{console.log(data)}
callback
, should use this:
rctuimanager.measure(this._scrollview.getinnerviewnode(), callback.bind(this));
Comments
Post a Comment