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

Carousel not working while motion is disabled on the device #610

Open
BrodaNoel opened this issue May 14, 2024 · 4 comments
Open

Carousel not working while motion is disabled on the device #610

BrodaNoel opened this issue May 14, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@BrodaNoel
Copy link
Contributor

Today I upgraded to SDK 51 and I got a Warning from [Reanimate] who says: "Some animations may be disabled because your phone disabled animations"

Well... In my iPhone, I went to Settings > Accesibility > Motion, and I've found that I disabled it in order to avoid wasting battery.

I enabled animations, and most of the issues dissapeared, like #604 and #590 (and probably A LOT of other issues).

So, what happens, is that when the iPhone has motion disabled, the animations ends automatically, so, some times, they move from "20%" (animation progress) to "100%", which will end up breaking the computedRealIndexWithAutoFillData function, because the computedRealIndexWithAutoFillData gets called before it realized that the animation reached "100%", thus, we get a wrong value.

Consider taking a look at this condition, because it may be the reason of a lot of bugs.

@BrodaNoel BrodaNoel added the bug Something isn't working label May 14, 2024
Copy link

dosubot bot commented May 14, 2024

Hey @BrodaNoel! Nice to see you back and diving into the depths of animations with us. 🎢 I remember our last adventure here. I'll be taking a look at this motion-related conundrum you've unearthed and will circle back with a full answer shortly. Hang tight!

@BrodaNoel
Copy link
Contributor Author

Seems like there are some "1 line" fixes here: https://docs.swmansion.com/react-native-reanimated/docs/guides/accessibility/

@nmassey
Copy link
Contributor

nmassey commented May 15, 2024

Good find!

It seems that standard iOS carousels still function as animated (sliding) carousels even with "Reduce motion" enabled. (For example, swiping between home screens of icons still animates; swiping between photos in the standard Photos app still animates.)

IMO, to follow this paradigm, react-native-reanimated-carousel should also still function as normal-- even with "Reduce motion" enabled.

Copy link

dosubot bot commented May 15, 2024

To address the issue with react-native-reanimated-carousel not functioning correctly when "Reduce Motion" is enabled on iOS devices, consider the following steps:

  1. Detect "Reduce Motion" Setting: Use the AccessibilityInfo API in React Native to check if the user has enabled "Reduce Motion". Adjust your application's behavior based on this setting to ensure a smooth user experience.

  2. Adjust Carousel Behavior: If "Reduce Motion" is detected, modify the carousel's behavior. This might involve changing how animations are handled or how indexes are computed to ensure the carousel functions correctly without relying on full animations.

  3. Implement Non-Animated Fallbacks: For users with "Reduce Motion" enabled, provide a fallback experience that does not depend on animations. This could mean instant transitions or a different method of indicating carousel progress.

  4. Ensure Compatibility and Update: Make sure you're using the latest versions of react-native-reanimated and react-native-reanimated-carousel that are compatible with SDK 51. Newer versions may offer better support for handling "Reduce Motion".

  5. Test Thoroughly: Test your application with "Reduce Motion" enabled to ensure all functionalities, especially the carousel, work as intended. Pay close attention to how the carousel behaves and ensure it computes the correct values.

  6. Consult Documentation and Community: Look into the official documentation and community forums for any guidance on handling "Reduce Motion" with react-native-reanimated and react-native-reanimated-carousel.

By following these steps, you can enhance the accessibility and user experience of your application for users who have "Reduce Motion" enabled, ensuring that the carousel functions correctly and animations do not end prematurely.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

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

3 participants