React-native-swiper: Can't swipe android

Created on 5 Jun 2020  Â·  4Comments  Â·  Source: leecade/react-native-swiper

Which OS ?

Android

Version

Which versions are you using:

  • react-native-swiper ^1.5.14 ^1.6.0 and 1.6.0-rc
  • react-native-cli: 2.0.1
    react-native: 0.59.10

Expected behavior

Images change on swipe and after pressing buttons

Actual behaviour

onIndexChanged is triggered after pressing buttons, but the images does not change. It also shows only the last image instead of the first one for some reason.

How to reproduce it>

This component used to work but after changing to newer version this problem occurred, I changed it back to ^1.5.14 but it works the same. It could be some external problem, but I tried changing styles and images, with little effect, so I think updating to 1.6.0-rc was source of the problem.
This is my code for reference:
<Swiper style={{ width: this.state.frameWidth, height: this.state.imageHeight, alignSelf: 'center', alignItems: 'center', }} showsButtons={true} showsPagination={false} //renderPagination={( (index, total, context) => {this.renderPagination(index, total, context)})} onIndexChanged={(index) => { this.setState({ index: index }) }} buttonWrapperStyle={styles.buttonContainer} dotColor={colors.white} activeDotColor={colors.darkPrimary} nextButton={<View><Text style={styles.button}>›</Text></View>} prevButton={<View><Text style={styles.button}>‹</Text></View>} > { this.props.images.map((image, index) => <View key={index} style={{ alignSelf: 'center', width: this.state.frameWidth, height: this.state.imageHeight, alignSelf: 'center', alignItems: 'center', paddingBottom: 30, //borderRadius: 20, }}> <Text>{index}</Text> <Image source={image} style={{ width: this.state.imageWidth, height: this.state.imageHeight, borderRadius: 20, }} /> </View> ) } </Swiper>
-

Steps to reproduce

  1. Copy code
  2. Build
  3. npm i --save react-native-swiper@next

Most helpful comment

try not setting the width of Swiper styles. try setting the height only.

All 4 comments

try not setting the width of Swiper styles. try setting the height only.

@nescroft It works

@nescroft it works

Thank you @nescroft

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Liqiankun picture Liqiankun  Â·  3Comments

ruben-kasaz picture ruben-kasaz  Â·  3Comments

kliuj picture kliuj  Â·  3Comments

diegolmello picture diegolmello  Â·  3Comments

itinance picture itinance  Â·  3Comments