Call snapToNext in functional component
See original GitHub issueIs 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: `<Carousel // other props ref={carousel’} />
// 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 ([]
).)
- I have read the guidelines regarding bug report.
- I have reviewed the documentation in its entirety, including the dedicated documentations 📚.
- I have searched for existing issues and made sure that the problem hasn’t already been reported.
- I am using the latest plugin version.
- I am following the issue template closely in order to produce a useful bug report.
Have you made sure that it wasn’t a React Native bug?
(Write your answer here.) yes
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
this._getCustomDataLength is not a function. #525 - GitHub
Workaround that I'm using is to wrap snapToNext in a function to defer its execution. Looking for a better solution myself.
Read more >React: Calling functional components as functions
Is it documented somewhere that you can just call a functional component as a plain function? What is the difference between the 2...
Read more >Components and Props - React
Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. This page provides an introduction to...
Read more >Call a function from a functional component React Native
I have the next problem, trying to call a function from a functional component, like shared in class components. My test code is:...
Read more >pro tools shortcut mix window
Click on a shortcut category on the left, then hover over a function on the ... Here you can select what components of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can do:
Sorry, please allow me to advertise for my open source library! ~ I think this library react-native-reanimated-carousel will solve your problem. It is a high performance and very simple component, complete with React-Native reanimated 2