react-native-viewpager-carousel icon indicating copy to clipboard operation
react-native-viewpager-carousel copied to clipboard

Can not update initialPage dynamically or jump into tab method ?

Open luatnd opened this issue 6 years ago • 1 comments

Expected Behavior

Can jump into specific page

Actual Behavior

I try to pass dynamical initialPage value, but when initialPage change, view pager seem not re-render

Steps to Reproduce the Problem

  1. Create view pager with initialPage = 0
  2. Set state to change initialPage = 1
  3. Check if view pager show the page 1

luatnd avatar Mar 26 '19 09:03 luatnd

After read the source code, I found 1 method:

<ViewPager
    ref={c => this.ViewPagerInstance = c}
    ....
/>
.......
scrollToPage() {
    this.ViewPagerInstance.scrollToIndex(this.state.viewPagerPosition);
}

But someone will prefer the data-oriented way

luatnd avatar Mar 26 '19 10:03 luatnd