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.

Vibration on scroll

See original GitHub issue

Feature Request

Add support for Vibration in react-native. Maybe we could use Vibration api to add simple vibrations inside the carousel to give users haptic feedback when scrolling.

Each scrolled item triggers a small vibration.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
LowieHuyghecommented, Sep 14, 2018

I managed to get it working using the public currentIndex-property. Use the onScroll-prop to check the currentIndex and in case of change: vibrate.

<Carousel
    ref={this.carouselRef}
    ...
    onScroll={() => {
        if (this.carouselRef.current.currentIndex !== previousScrollIndex) {
            previousScrollIndex = this.carouselRef.current.currentIndex

            // Vibrate!
            ReactNativeHapticFeedback.trigger('impactLight', false)
        }
    }}
/>

Performance-wise it would probably be better to have a callback-prop on the Carousel which is called on currentIndex-change.

0reactions
dohooocommented, Oct 8, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Stop Scroll Saw Vibration? - Make from Wood
Your scroll saw should be a joy to use. It should be stable and, while it's impossible to remove vibration completely, it shouldn't...
Read more >
Vibrating screen on scroll using transform: scale
The scale animation is vibrating because you're triggering a translation on each scroll event. Think about it like this: user scrolls; zoom_out ...
Read more >
Disabling vibration on end of scroll? : r/PocoPhones - Reddit
It might sound like a small thing but it's highly annoying for me - whenever I get to the bottom of a menu...
Read more >
Haptics when scrolling | Apple Developer Forums
I am working on an app that will post listings and content similar to Ebay or pinterest. As the user scrolls down through...
Read more >
Screen vibrating/shaking/scrolling up and down
The image on my screen is vibrating/shaking/scrolling up and down very quickly about 1 mm. It's the whole image (including the taskbar) ...
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