Giter Club home page Giter Club logo

Comments (13)

timmywil avatar timmywil commented on July 2, 2024 4

The problem is that Swiper gets windows dimensions one time on execute rather than on render, but I've worked around this by getting window dimensions in my render function and passing those values to the width and height props of <Swiper>.

render () {
  const { width, height } = Dimensions.get('window')
  return (
    <Swiper width={width} height={height}>
       ...
    </Swiper>
  )
}

When the window dimensions change, Swiper's componentWillReceiveProps method is called, which updates the dimensions in its state.

from react-native-swiper.

dantman avatar dantman commented on July 2, 2024 1

@timmywil Yup

Though ultimately I don't think Swiper even has a reason to try using the window dimensions to fill the page. It makes much more sense to use flex and onLayout.

from react-native-swiper.

rt2zz avatar rt2zz commented on July 2, 2024

+1 afaik it does not support landscape?

from react-native-swiper.

jasonmerino avatar jasonmerino commented on July 2, 2024

Looks related to #16

from react-native-swiper.

esutton avatar esutton commented on July 2, 2024

Any suggestions for making react-native-swiper work in landscape mode?

Thanks for a great component!

from react-native-swiper.

GuillaumeMunsch avatar GuillaumeMunsch commented on July 2, 2024

Any news on this ?

from react-native-swiper.

uriklar avatar uriklar commented on July 2, 2024

+1

from react-native-swiper.

dgurns avatar dgurns commented on July 2, 2024

+1 too. It works on first load, but dimensions do not update upon rotating device. Even when manually updating Swiper width after device rotation, it doesn't actually update.

from react-native-swiper.

ciriac avatar ciriac commented on July 2, 2024

+1

from react-native-swiper.

RiusmaX avatar RiusmaX commented on July 2, 2024

+1 too. I've tried so many ways to force the update after device rotation, like invert width and height, but it's not a good practice at all.

Someone did find a decent solution ?

from react-native-swiper.

timmywil avatar timmywil commented on July 2, 2024

Seems this broke again when I updated react-native to 0.46.2. componentWillReceiveProps isn't called anymore. This project doesn't seem to be getting support anymore, so I may fork it or just build a custom one for my needs.

from react-native-swiper.

SSTPIERRE2 avatar SSTPIERRE2 commented on July 2, 2024

@timmywil Does this properly change orientation to landscape now? I've been unable to get that working so far.

from react-native-swiper.

anand-neema avatar anand-neema commented on July 2, 2024

Is it working now ?

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.