My requirement is to create a table with fixed header and first column, table data will scroll in both horizontal and vertical directions.
for this I have used 3 scrollviews , following gif will make it clear
the scroll values of two body scroll views are put in scrollTo of the other two scrollview using refs on onScroll event, scrollEventThrottle value is 16 .
My problem is how to sync these scrollviews scrolls as this clearly shows lag, which is not acceptable
let firstRef: ScrollView | null; let secondRef: ScrollView | null; <ScrollView ref={ref => (firstRef = ref)}> ... <ScrollView ref={ref => (secondRef = ref)} onScroll={e => { if(firstRef) { firstRef. scrollTo({ x: e. nativeEvent.
All you need is to: make <ScrollSync> as a common parent to your nodes you want to sync scroll with other nodes (which is a React component that uses React's new Context API) and then wrap each scrollable-node with a <ScrollSyncNode>
scrollEventThrottle: It is used to control the firing of scroll events while scrolling.
Disable scrollTo
s animation like this:
this.toolbar.scrollTo({
x: yourXValue,
animated: false,
});
Then there is no lag :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With