Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduced motion setting on iphone removes animation when scrolling on parralax carousel #548

Open
teotorstensson opened this issue Feb 21, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@teotorstensson
Copy link

As the title suggest, I want to know if there is a way I can implement reduceMotion: ReduceMotion.Never (with react-native-reanimated), on the scrolling animation? I've come to the understanding that many people unknowningly have "reduced motion" enabled on their phones, thereby causing the carousel-scroll-animation not to work. In past updates of react-native-reanimated, the reduced motion settings was ignored and the animations ran anyway, although with the later updates, this is no longer the case sadly. I've solved this on other of my own animations by implementing on all reanimated-animations for example:

animations[index].value = withSpring(displayValue / 10, {
damping: 100,
stiffness: 2000,
mass: 2,
reduceMotion: ReduceMotion.Never, // Se till att animationen alltid körs
});

My question is how can I do this on the carousel with parralax-mode so the scrolling animation always works, even when people have reducedMotion enabled? The code is quite large so I don't seem to find where I can implement this. Thank!

@teotorstensson teotorstensson added the bug Something isn't working label Feb 21, 2024
@matt-livekindred
Copy link

There is a withAnimation prop on the Carousel:

<Carousel
        loop={false}
        width={carouselContentWidth}
        pagingEnabled
        snapEnabled
        mode="parallax"
        data={...}
        renderItem={renderItem}
        withAnimation={{
          type: 'timing',
          config: {
            reduceMotion: ReduceMotion.Never,
          },
        }}
      />

@jordansoltman
Copy link

There is a withAnimation prop on the Carousel:

<Carousel
        loop={false}
        width={carouselContentWidth}
        pagingEnabled
        snapEnabled
        mode="parallax"
        data={...}
        renderItem={renderItem}
        withAnimation={{
          type: 'timing',
          config: {
            reduceMotion: ReduceMotion.Never,
          },
        }}
      />

Incredible.. and this feels like it should be the default for the library... The carousel doesn't function properly without it.

@BrodaNoel
Copy link
Contributor

For those wondering, get the ReduceMotion.Never from import { ReduceMotion } from 'react-native-reanimated';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants