rilyu / teaset

A UI library for react native, provides 20+ pure JS(ES6) components, focusing on content display and action control.
MIT License
2.95k stars 482 forks source link

SegmentedView active title doesn't not match with the active index #428

Closed eugeneli71 closed 4 years ago

eugeneli71 commented 4 years ago

When using SegmentedView with type='carousel' and navigating using swipe gesture, the active title index doesn't change correctly. As the picture shown, The current active index is 2 ,and the active bar displayed under "Three", but the active text still on "Two". This only happen when using wipe gesture. Simulator Screen Shot - iPhone 11 - 2020-07-07 at 20 35 19

eugeneli71 commented 4 years ago

https://github.com/rilyu/teaset/blob/8b9c5c040a7f29c95000be4b3a4741bbcfa3b41c/components/SegmentedView/SegmentedView.js#L50-L54 ActiveIndex need to be updated when scrolling . this issue can be fixed by adding this.setState({activeIndex:this.props.activeIndex}) after this.refs.carousel.scrollToPage(this.props.activeIndex);