leecade / leecade/react-native-swiper
Android - Dynamic Pages Index Problems
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
When dynamically loading pages in componentDidMount, if the new array of pages has more than what was set in the constructor you cannot scroll to these pages. The following will reproduce the bug:
constructor(props) {
super(props)
this.state = {
posts: [{
id: 'FOO'
},
{
id: 'BAR'
}]
}
}
componentDidMount() {
this.setState({
posts: [{
id: 'FOO'
},
{
id: 'BAR'
},
{
id: 'FOOBAR'
},
{
id: 'BARFOO'
}]
})
}
This works fine:
constructor(props) {
super(props)
this.state = {
posts: [{
id: 'FOO'
},
{
id: 'BAR'
}]
}
}
componentDidMount() {
this.setState({
posts: [{
id: 'FOOBAR'
},
{
id: 'BARFOO'
}]
})
}
Using React Native 0.38
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 reported React Native 0.38 reproduction, comparing the two componentDidMount cases where pages are replaced or appended. Trace how the swiper builds and updates its page indexes after state changes, then verify that newly appended pages can be reached by scrolling without breaking the existing pages.
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
- 35/100