question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Entire window shifts when updating from state change

See original GitHub issue

Which 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):

2017-09-19 12_28_42

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

  1. Add the swiper to a view
  2. Make its parent view less than 100% in height
  3. 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:open
  • Created 6 years ago
  • Reactions:2
  • Comments:18

github_iconTop GitHub Comments

13reactions
AliceB08commented, Sep 27, 2017

I had the same problem on my project, I added height={‘100%’} in the props of Swiper:

screen shot 2017-09-27 at 15 02 06

it did the trick!

4reactions
Nickersoftcommented, Sep 22, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react input cursor moves to the end after update - Stack Overflow
If the cursor jumps to the end of the field it usually means that your component is remounting. It can happen because of...
Read more >
Shifts for Microsoft Teams - Connectors
For team members, easily view your shifts and make schedule-change requests ... This operation returns all Open Shift change requests in a Schedule....
Read more >
Cumulative Layout Shift (CLS) - web.dev
Not all layout shifts are bad. In fact, many dynamic web applications frequently change the start position of elements on the page. User- ......
Read more >
Use Stage Manager to organize apps and windows on Mac
If you make a window enter full screen, it moves to its own space outside of Stage Manager. To drag items to another...
Read more >
Stacks should dynamically shift content in Preview
Preview mode - click the component to change state and the stack ... the whole component shifts upward on the page, covering the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found