leecade / react-native-swiper

The best Swiper component for React Native.
MIT License
10.42k stars 2.34k forks source link

Horizontal={false} not working in Android. #439

Open ChristianTucker opened 7 years ago

ChristianTucker commented 7 years ago

This moves the dots to the right, but swiping is still left to right.

yinchonging commented 7 years ago

    let containerStyle = {};
    let pageStyle = {};

    if (Platform.OS == 'android') {
      let offset = ((height - StatusBar.currentHeight) - width) / 2;
      containerStyle.transform = [{rotate: "90deg"}];
      containerStyle.width = height - StatusBar.currentHeight;
      containerStyle.height = width;
      containerStyle.top = offset;
      containerStyle.left = offset * -1;

      pageStyle.transform = [{rotate: "-90deg"}];
      pageStyle.width = width;
      pageStyle.height = height - StatusBar.currentHeight;
      pageStyle.top = offset * -1;  //left
      pageStyle.right = offset  * -1;   //top
    } else {
      containerStyle.flex = 1;
      pageStyle.flex = 1;
    }

<View style={containerStyle}>
        <Swiper
          loop={false}
          showsButtons={false}
          showsPagination={false}
          horizontal={Platform.OS == 'android'}
          width={Platform.OS == 'android' ? height : width}
          height={Platform.OS == 'android' ? width : height}
        >
          <Page1 style={[{backgroundColor: '#9297A1'}, pageStyle]}/>
          <Page2 style={[{backgroundColor: '#9297A1'}, pageStyle]}/>
        </Swiper>
</View>

Hope this help

shireen commented 7 years ago

+1

kadoshms commented 7 years ago

+1

zhangxiaoyu1314 commented 7 years ago

+1

ChristianTucker commented 7 years ago

@leecade Would you consider a PR changing the implementation to using Animated and a over-sized fixed position container that can be animated to slide. You wouldn't lose any features and it would support Android and iOS exactly the same without any device-specific features.

luokaii commented 7 years ago

+1 , so this problem is still not solved?

qmn1711 commented 7 years ago

dup #174 , #199 +1 It seems hard work but worth it!

tudorilisoi commented 7 years ago

see #595 and my fix (apart from bullets not showing correct index) pull req. https://github.com/leecade/react-native-swiper/pull/643

DavidCai75905171 commented 6 years ago

+1

akhiljain100 commented 6 years ago

+1