Closed NickTheTurtle closed 3 years ago
So I rolled out my own version of ViewPager. It seems like calling both scroll and setSelectedIndex simultaneously causes the scroll to jump. Instead I called scrollTo for the scrollView, and onScroll I set the index. Now the activity indicator still jumps, but it's slightly better I guess.
<ScrollView
ref={pageView}
style={styles.view}
contentContainerStyle={{width: '200%'}}
pagingEnabled
bounces={false}
horizontal
onScroll={onPageViewScroll}
overScrollMode="never"
disableScrollViewPanResponder
showsHorizontalScrollIndicator={false}>
<View style={styles.view}>
<Tab1 />
</View>
<View style={styles.view}>
<Tab2 />
</View>
</ScrollView>
function goToTab(index) {
pageView.current.scrollTo({x: windowWidth * index, y: 0, animated: true});
}
function onPageViewScroll(event) {
if (event.nativeEvent.contentOffset.x % windowWidth === 0) {
setSelectedIndex(event.nativeEvent.contentOffset.x / windowWidth);
}
}
I guess this issue is could be related to https://github.com/akveo/react-native-ui-kitten/issues/1234 Closing this one.
🐛 Bug Report
Jittery animation with TabView.
To Reproduce
Have a TabView which each contain a SwipeListView from 'react-native-swipe-list-view' with a couple of rows (> 2). Try to go through different pages. With fewer rows, the animation are smoother, so it seems to be rendering very slowly that's the issue
Expected behavior
Fluid animations.
UI Kitten and Eva version
Environment information