leecade / leecade/react-native-swiper
Keep current page index when changing state?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using Swiper and on the second page there is a textinput. When the user changes the text in the textinput I call setState() to update the state with the changes. The problem is, when the state reloads, Swipe automatically shows the first page not the second page. I've tried to set the index prop on Swipe but it doesn't seem to work correctly. Any way to keep the current page when updating the state?
<TextInput
onChangeText={(name) => {this.setState({name})}}
value={this.state.name} />
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
Reproduce the issue with Swiper, a TextInput on the second page, and the onChangeText setState flow shown in the report. Start by tracing how the Swiper index prop is handled during state updates; done means changing the input preserves the current page instead of returning to the first page.
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