jeongshin / react-native-awesome-swiper

Swiper UI Library for React Native 🙇🏻‍♂️
https://docs.react-native-awesome-swiper.site
3 stars 0 forks source link

Bug: Active Index is not default index #5

Closed elitenas closed 1 year ago

elitenas commented 1 year ago

Thanks for this awesome library. I have a bug where activeIndex is not the default index and it autoscrolls to the correct index on page load. This causes unnecessary re-renders on my components. Is there a way to start right away on the active index on page load?

jeongshin commented 1 year ago

@elitenas Thanks for reporting issue! I'll fix that issue on next patch and notify you 🙌.

elitenas commented 1 year ago

@jeongshin thank you! here is a demo: https://snack.expo.dev/@muslimplusapp/react-native-awesome-carousel

currentIndex is set to 3 so it goes to 0 index first then autoscrolls... while it should just load directly on index 3

jeongshin commented 1 year ago

@elitenas Fixed issue at https://github.com/jeongshin/react-native-awesome-swiper/compare/v0.2.0...v0.2.1

However, it might have some blank area issue if activeIndex greater than 0 given. For example, react native FlatList has requires getItemLayout for using initialScrollIndex. Since DynamicItemScrollSwiper handles known layout of items, it needs few seconds to calc layout.

Thanks for reporting issue btw! 🙌

elitenas commented 1 year ago

The update fixed the issue. Thank you!