leecade / leecade/react-native-swiper
When the views take in props, and are updated, swiper shows incorrect data/text and the page dots don't update until the user swipes.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
Which OS ?
iOS 11
Version
Which versions are you using:
- react-native-swiper 1.5.13
- react-native v0.52.0
Expected behaviour
When the props change, the views simply update the appropriate data, and do not change text/show inaccurate information for the specific view.
Actual behaviour
Updating the state seems to go berserk for which view is visible.
How to reproduce it>
<Swiper
style={styles.wrapper}
showsButtons={false}
dot={<View style={styles.dot} />}
activeDot={<View style={styles.activeDot} />}
>
<BalanceView
balance={this.props.totalBalance}
headerText="Total Balance"
isLoading={false}
/>
<BalanceView
balance={this.props.availableBalance}
headerText="Available Balance"
isLoading={false}
/>
<BalanceView
balance={this.props.pendingBalance}
headerText="Pending Balance"
isLoading={false}
/>
</Swiper>
What happens is, props update from 0,0,0 for all the balances, to the correct values.
ISSUES:
The text changes from "Total Balance" to "Pending Balance", without swiping.
The dots (there are 3, where the first one is the one selected) do not update to the third view (which they shouldn't)
Swiping left or right then shows the correct data, but swiping left or right from the first index, goes back to the first index again with correct data.
Steps to reproduce
Pass props into the Views of Swiper, and have the prop change after some time. The data does not update, and remain on the same index correctly.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Swiper component and the supplied BalanceView reproduction, where props change after the initial render. Trace how the current index, displayed child data, and page dots respond to prop updates; done means each view keeps its index and text, and the dots remain on the first view until the user swipes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100