meliorence / meliorence/react-native-snap-carousel
Call snapToNext in functional component
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
### Is this a bug report, a feature request, or a question?
Hello, I use functional component and when i try to call next slide programmatically
like this example:
`
// methods can then be called this way
`onPress={() => { carousel.snapToNext() }}`
i have `TypeError: ref.snapToNext is not a function. (In 'ref.snapToNext()', 'ref.snapToNext' is undefined)` so i look what is inside my ref i found
`{current: {...}}` and inside curent i fond my function `snapToNext.
### Have you followed the required steps before opening a bug report?
(Check the step you've followed - put an `x` character between the square brackets (`[]`).)
- [x] I have read [the guidelines regarding bug report](https://github.com/meliorence/react-native-snap-carousel/blob/master/CONTRIBUTING.md).
- [x] I have reviewed [the documentation](https://github.com/meliorence/react-native-snap-carousel/blob/master/README.md) in its entirety, including the dedicated documentations :books:.
- [x] I have searched for [existing issues](https://github.com/meliorence/react-native-snap-carousel/issues) and made sure that the problem hasn't already been reported.
- [x] I am using [the latest plugin version](https://github.com/meliorence/react-native-snap-carousel/releases).
- [x] I am following [the issue template](https://raw.githubusercontent.com/meliorence/react-native-snap-carousel/master/ISSUE_TEMPLATE.md) closely in order to produce a useful bug report.
### Have you made sure that it wasn't a [React Native bug](https://github.com/meliorence/react-native-snap-carousel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22react-native+bug%22+)?
(Write your answer here.) yes
Contributor guide
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 Carousel ref usage and the snapToNext method described in the issue, then compare the functional-component ref shape with the documented API. Confirm the supported invocation and update the relevant usage guidance or behavior so the reported TypeError no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100