Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

Synchronously scroll two components at once

$
0
0

I have an app where a timetable is displayed.

When the right ScrollView containing the schedule is scrolled, I want the left ScrollView containing the times to scroll too.

<ScrollView
    ref={'leftScroll'} />

<ScrollView
    ref={'rightScroll'}
    scrollEventThrottle={1}
    onScroll={(e) => this.refs.leftScroll.scrollTo({y: e.nativeEvent.contentOffset.y)}
    onMomentumScroll={(e) => this.refs.leftScroll.scrollTo({y: e.nativeEvent.contentOffset.y)} />

We've managed to scroll it in this way, but it is slow and choppy. Is there a way to completely synchronize the scroll of these two ScrollViews?

The reason for this design is that the times need to be fixed to the left of the screen at all times, and the rooms need to be fixed at the top at all times, and these need to scroll in accordance to the scrolling in the schedule.


Viewing all articles
Browse latest Browse all 16750

Trending Articles