leecade / leecade/react-native-swiper

ViewPagerAndroid and dynamic swiper content

Open
#675 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I use swiper datasource that can be dynamic.

When I load swiper with 5 items and reduce it to 2 items and then increase to 3 items only two items are rendered 3rd it blank screen.

This scenario works perfect on ios.
This happens only on android.

I dig a bit and found that ViewPagerAndroid component is actually problem here.
I discovered that if I put key={Math.random()} fix the issue but then I loose animation between items.
I tried to put key={this.children.length} and this doesn't work.

Do you have some suggestion on how to fix this on android to work and to have animations?
I am in trouble as main part of the app is based on this component.

One more thing.
Swiper is part of modal component. When issue occurs and I dismiss modal view and bring it back again it load 3 items correctly. I don't know what happen there but seems like some restart of swiper.
Maybe I can restart swiper somehow but don't know how to do it.

Thanks

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

Start by reproducing the Android scenario in which swiper content changes from five items to two and then three, including the modal dismissal and reopen behavior. Inspect the ViewPagerAndroid integration and compare it with iOS behavior; the work is done when dynamic content renders all items on Android while preserving swipe animations.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.