mercredi 13 juillet 2016

Synchronously croll two components at once

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.

Aucun commentaire:

Enregistrer un commentaire