Entire window shifts when updating from state change
See original GitHub issueWhich OS ?
iOS
Version
Which versions are you using:
- react-native-swiper v1.5.12
- react-native v0.48.3
Expected behaviour
Updating the state and the subsequent re-rendering it causes shouldn’t cause any of the existing slider layout to change (current index, positioning, etc.)
Actual behaviour
Updating the state when the swiper is not fullscreen causes the content and slides inside the swiper to shift drastically. Here’s an example (all I’m doing is setting a timeout to change the text from “Hello Swiper” to “Hi Swiper” via setState()
and it causes everything to go out of whack):
How to reproduce it>
To help us, please fork this component, modify one example in examples folder to reproduce your issue and include link here.
Steps to reproduce
- Add the swiper to a view
- Make its parent view less than 100% in height
- Update any state object that would force the swiper or view to re-render
Any help would be greatly appreciated… I’m trying to use this swiper in an actionsheet/modal at the bottom of the screen (about 500pt in height) and any re-rendering causes the entire layout to get messed up.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:18
Top GitHub Comments
I had the same problem on my project, I added height={‘100%’} in the props of Swiper:
it did the trick!
I wound up just forking this project, committing my “hack”, and importing that in my
package.json
over the official repo. I wish the author would fix this… it’s a very troubling and annoying issue to have to work around.