phil-r / react-native-looped-carousel

:carousel_horse: Looped carousel for React Native
MIT License
1.49k stars 307 forks source link

animateToPage and _animatePreviousPage not working in ScrollView #228

Open Msspl-PrashenjeetRoy opened 6 years ago

Msspl-PrashenjeetRoy commented 6 years ago

animateToPage and _animatePreviousPage not working in ScrollView in iPhone 6Plus and iPhone 7.

<Carousel
          delay             = {2000}
          style             = {this.state.size}
          autoplay          = {false}
          isLooped          = {false}
          pageInfo          = {false}
          bullets           = {true}
          bulletStyle       = {{backgroundColor:'#BFBFBF', borderWidth:0}}
          chosenBulletStyle = {{backgroundColor:'#717171', borderWidth:0}}
          onAnimateNextPage = {(p) => console.log(p)}
          currentPage       = {this.state.currentPageNo}
          ref               = {(ref) => { this._carousel = ref; }}>
              <View style={[{ backgroundColor: '#BADA55', paddingTop:50 }, this.state.size]}>
                <Text>1</Text><Text onPress={() => {this._carousel._animateNextPage()}}>onpress</Text>
              </View>
              <View style={[{ backgroundColor: 'red', paddingTop:50 }, this.state.size]}>
                <Text>22</Text><Text onPress={() => {this._carousel._animatePreviousPage()}}>onpress-Prev</Text>
                <ScrollView style={{flex:1, backgroundColor: 'yellow'}}>
                  <Text>21</Text><Text onPress={() => {this._carousel._animatePreviousPage()}}>onpress-in-between</Text>
                </ScrollView>
              </View>
              <View style={[{ backgroundColor: 'blue', paddingTop:50 }, this.state.size]}>
                <Text>3</Text><Text onPress={() => {this._carousel.animateToPage(0)}}>onpress</Text>
              </View>
     </Carousel>

When we put page content in between ScrollView and call that function from there then the function is not working in the release build, but in debug build it's working fine.

Can anyone please suggest any solution how to solve the problem?? We need it urgently because we are implementing it in the live project.

MSSPL-PiyaleeMaiti commented 5 years ago

Is there any solution for above problem? We are stuck here for that issue. Need any solution.