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

scrollToIndex not working

Open ZeroCool00 opened this issue 7 years ago • 2 comments

Expected Behavior

scrollToIndex should open viewpager with specific index right?

Actual Behavior

Its always open with index 0.

Steps to Reproduce the Problem

 componentDidMount() {
      console.log('PageIndex:', this.props.pageIndex);
      this.viewPager.scrollToIndex(this.props.pageIndex);
   }

render() {
      return (
         <View style={{ flex: 1 }}>
            <ViewPager
               renderAsCarousel={false}
               thresholdPages={2}
               ref={ref => { this.viewPager = ref }}
               data={this.props.rowData}
               renderPage={this._renderPage}
            />
         </View>
      )
   }

i am passing pageIndex = 5, but it always open with 0 index.

Specifications

  • Version: "react-native": "0.56.0", "react-native-viewpager-carousel": "^0.2.12",

    • Platform: ios, not check on android

ZeroCool00 avatar Aug 27 '18 09:08 ZeroCool00

@ZeroCool00 What about using initialPage for that?

b1acKr0se avatar Jan 02 '19 05:01 b1acKr0se

I tried initialPage without success: https://github.com/meinto/react-native-viewpager-carousel/issues/28

luatnd avatar Mar 26 '19 09:03 luatnd