question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

REQUEST gotoIndex method

See original GitHub issue

Any chance of creating a method on ref that would allow the consumer to jump to a certain slide index?

Something like: ref.goToIndex(2)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
daveyjonescommented, Mar 8, 2022

@dohooo This method is marked deprecated in the docs. Why is that? I have a map view where users can click on a dot and it moves the slider to that slide, so goToIndex is very useful for this.

simulator_screenshot_C799C49B-F400-415D-B472-522F6B2D65C0

0reactions
dohooocommented, Apr 6, 2022

WOW! Your app looks very cool! Sorry for that we changed this method but u can used new one to instead it. scrollTo

Sorry for commenting on this closed topic, but I’d like to make note that goToIndex and scrollTo behave differently.

  • scrollTo allows you to move a certain number of items to the left or right
  • goToIndex allows you to go to a specific index without having to do any calculations

For example, if I want to scroll 1 item to the right, such as if the user clicked on an arrow, the scrollTo method with a count property of 1 would solve that use case.

However, if the user is selecting items from another UI element such as a marker on a map, it is often more efficient (with code that is easier to read) to simply use goToIndex instead. For example, the index of a map marker likely matches the same index in the carousel.

I’d like to propose that goToIndex is no longer marked as deprecated as it has its own specific use cases.

(Side-note: thank you for creating this awesome library - it’s a great improvement over other carousel libraries that exist)

Thank you for your detailed explanation! 🍺You’re right, would like to submit a PR that remove deprecated comment?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue #3 · dohooo/react-native-reanimated-carousel
Any chance of creating a method on ref that would allow the consumer to jump to a certain slide index? Something like: ref.goToIndex(2)...
Read more >
How can I force all URI requests to index.php?
Problem is, I can not seem to make all requests go to index.php . Obviously if you go to localhost/myproject/ you will get...
Read more >
webContents | Electron
Returns Boolean - true if the process of saving page has been initiated successfully. const {BrowserWindow} = require('electron') let win = new BrowserWindow() ......
Read more >
webContents
These methods can be accessed from the webContents module: ... event Event; bounds Rectangle - requested new content bounds ... goToIndex(index) ​.
Read more >
18.2 Report Request Methods
There are a number of request methods available to you for running your report requests. These include: The rwclient command line.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found