leecade / leecade/react-native-swiper
need to invoke function on last slide using swipeBy
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hey guys , I wonder if there is any way to get the index number I am on using the swipeBy method. I need it to invoke function on last slide.
I currently have this button and it swipe the slides by pressing it using this.swiper.swipeBy. The problem is when loop={false} - it moves to grey screen when there is no more slides.
What I need is instead of moving to grey screen - to invoke function.
I tried to use
onIndexChanged={index => {
if (index == 3) {
this.props.navigation.navigate("SomePage");
}
}}
But it wasn't great and it first showed the grey screen and only when invoked my function.
I wonder if there is any solution for this. Thanks!
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 by tracing the swiper component's swipeBy method and its onIndexChanged callback behavior. Reproduce the loop={false} case and check how the final slide is handled. Done means reaching the last slide does not show a grey screen and instead permits the requested navigation callback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, react-native
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100