Giter Club home page Giter Club logo

Comments (39)

plattyp avatar plattyp commented on July 20, 2024 5

Per @oliversisson comment, I'm able to get it to work fine in both iOS and Android by doing the following with the containerStyle prop and width:

...
import Dimensions from 'Dimensions';

class Scene extends Component {
  getWidth() {
    return Dimensions.get('window').width;
  }

  render() {
    const width = this.getWidth();

    return (
       <View style={styles.outerContainer}>
          <Swiper
            showsButtons={false}
            showsPagination={false}
            containerStyle={{width}}
          >
            {this.renderCards()}
          </Swiper>
       </View>
    );
}

from react-native-swiper.

sejas avatar sejas commented on July 20, 2024 5

yeah, @plattyp is right. It is already working in Android (check the Roadmap)

You need to use a fixed width in this prop containerStyle

So we should close this issue.

import Dimensions from 'Dimensions';

class Slider extends Component {
  render() {
    const width = Dimensions.get('window').width
    return (
       <View style={styles.outerContainer}>
          <Swiper
            showsButtons={false}
            showsPagination={false}
            containerStyle={{width}}
          >
            {this.renderCards()}
          </Swiper>
       </View>
    );
}

from react-native-swiper.

oliversisson avatar oliversisson commented on July 20, 2024 4

So it works fine for me in Android so long as I add

containerStyle={{width: windowDimensions.width}}

from react-native-swiper.

zacharymorel avatar zacharymorel commented on July 20, 2024 4

The android fix doesn't work for me even when I add containerStyle={{width}} as a Swiper prop.

from react-native-swiper.

 avatar commented on July 20, 2024 2

For anyone looking for paging functionality, check out this module: https://github.com/race604/react-native-viewpager

from react-native-swiper.

cgarvis avatar cgarvis commented on July 20, 2024 1

I didn't like the datasource of react-native-viewpager and it does look like the author is going to be working on this repo soon, so I built https://github.com/fixt/react-native-page-swiper

from react-native-swiper.

 avatar commented on July 20, 2024

It doesn't really work on android. There is no paging, just continuous scroll. Paging buttons also don't work.

from react-native-swiper.

lucasmreis avatar lucasmreis commented on July 20, 2024

+1 for Android support

from react-native-swiper.

niftylettuce avatar niftylettuce commented on July 20, 2024

πŸ‘ For Android!

from react-native-swiper.

jforaker avatar jforaker commented on July 20, 2024

@niftylettuce do you have a fork with working swipe? (already borrowed your navbar fork 😜)

from react-native-swiper.

sritampatnaik avatar sritampatnaik commented on July 20, 2024

@cgarvis Does your's support Android ?

from react-native-swiper.

cgarvis avatar cgarvis commented on July 20, 2024

@sritampatnaik yes.

from react-native-swiper.

niftylettuce avatar niftylettuce commented on July 20, 2024

@jforaker unfortunately no πŸ˜†

from react-native-swiper.

niftylettuce avatar niftylettuce commented on July 20, 2024

Perhaps we could borrow the Modal/Portal concept from my package here (which ensures the swiper would be shown above everything else). https://github.com/niftylettuce/react-native-loading-spinner-overlay

from react-native-swiper.

raymanyoung avatar raymanyoung commented on July 20, 2024

In fact the issue of Android support is that ViewPagerAndroid is used instead of scrollView so the adding corresponding event will make it work

from react-native-swiper.

bsinc avatar bsinc commented on July 20, 2024

+1 would really appreciate this!

from react-native-swiper.

sharq1 avatar sharq1 commented on July 20, 2024

+1

from react-native-swiper.

acamenhas avatar acamenhas commented on July 20, 2024

+1 !!!

from react-native-swiper.

samdturner avatar samdturner commented on July 20, 2024

This looks like a terrific project, and we are seriously considering using it in production for our iOS app. Is releasing a version with Android support going to happen soon - like in the next couple of months? (we obviously would use the same component for iOS and Android). Your hard work is really appreciated!

from react-native-swiper.

darrenchiu avatar darrenchiu commented on July 20, 2024

this module is awesome, please do add android support! Love this module so much

from react-native-swiper.

narek11 avatar narek11 commented on July 20, 2024

+1 for android support

from react-native-swiper.

anonrig avatar anonrig commented on July 20, 2024

+1 for android support

from react-native-swiper.

shireen avatar shireen commented on July 20, 2024

+1

from react-native-swiper.

sdduursma avatar sdduursma commented on July 20, 2024

+1

from react-native-swiper.

yohanceli avatar yohanceli commented on July 20, 2024

+1

from react-native-swiper.

oliversisson avatar oliversisson commented on July 20, 2024

Update? @leecade

from react-native-swiper.

jaspreetsingh2701 avatar jaspreetsingh2701 commented on July 20, 2024

+1

from react-native-swiper.

yarrumretep avatar yarrumretep commented on July 20, 2024

+1

from react-native-swiper.

nickitatkach avatar nickitatkach commented on July 20, 2024

+1

from react-native-swiper.

joshkmartinez avatar joshkmartinez commented on July 20, 2024

+1 for android support! I really need this!

from react-native-swiper.

RaonyMarcondes avatar RaonyMarcondes commented on July 20, 2024

+1 Android Support

from react-native-swiper.

sejas avatar sejas commented on July 20, 2024

+1 Android Support

from react-native-swiper.

joshkmartinez avatar joshkmartinez commented on July 20, 2024

@zacharymorel Same for me. Its cut off at the top and bottom on android, absolutely fine on ios...

from react-native-swiper.

joshkmartinez avatar joshkmartinez commented on July 20, 2024

@zacharymorel Have you had a fix for this yet?

from react-native-swiper.

zacharymorel avatar zacharymorel commented on July 20, 2024

@joshkmartinez I haven't yet, I've decided to attempt to build a carousel component myself.

from react-native-swiper.

azwar avatar azwar commented on July 20, 2024

@zacharymorel make sure you are passing Style object.

Here is my detail example:

    <Swiper
        showsButtons={false}
        showsPagination={false}
        containerStyle={styles.swiperStyle}
      >
        {this.renderCards()}
   </Swiper>

Here is the style:

 const styles = StyleSheet.create({
    swiperStyle: {
        width: Platform.OS === 'ios' ? '100%' : Dimensions.get('window').width
    }
 })

from react-native-swiper.

anasidrissi avatar anasidrissi commented on July 20, 2024

worked just fine for me (Android use)
just watch out for any containing views make sure to assign the appropriate style

from react-native-swiper.

RossKinsella avatar RossKinsella commented on July 20, 2024

automaticallyAdjustContentInsets sorted out android not rendering for me...

RN: 0.54.4
react-native-swiper: 1.5.13

from react-native-swiper.

brunokiafuka avatar brunokiafuka commented on July 20, 2024

automaticallyAdjustContentInsets sorted out android not rendering for me...

RN: 0.54.4
react-native-swiper: 1.5.13

const window = Dimensions.get('window');
  
<------->

 <Swiper ref='mySwiper' onIndexChanged={this.onSwipe}
            loop={false}
            showsPagination={false}
            scrollEnabled={false}
            height={window.height}
            width={window.width}
            containerStyle={{ alignSelf: 'stretch' }}
          >

Setting width and height for the swiper fixes the issues on Android. πŸš€

from react-native-swiper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.