leecade / leecade/react-native-swiper

Entire window shifts when updating from state change

Open
#578 18 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Need answer from author
Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reproduction entry point mentioned is examples/components/Basic/index.js; start by running that example on iOS with a non-fullscreen parent and a state update. Compare the swiper layout before and after the re-render. Done means the current index, positioning, content, and surrounding layout remain stable in the described case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.