Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
608 changes: 608 additions & 0 deletions app/containers/ActionSheet/ActionSheet.stories.tsx

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions app/containers/ActionSheet/ActionSheet.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { generateSnapshots } from '../../../.rnstorybook/generateSnapshots';
import * as stories from './ActionSheet.stories';

generateSnapshots(stories);
9 changes: 7 additions & 2 deletions app/containers/ActionSheet/ActionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useBackHandler } from '@react-native-community/hooks';
import * as Haptics from 'expo-haptics';
import React, { forwardRef, isValidElement, useEffect, useImperativeHandle, useRef, useState, useCallback } from 'react';
import { Keyboard, LayoutChangeEvent, useWindowDimensions } from 'react-native';
import { Easing, useDerivedValue, useSharedValue } from 'react-native-reanimated';
import BottomSheet, { BottomSheetBackdrop, BottomSheetBackdropProps } from '@discord/bottom-sheet';
import { Easing, ReduceMotion, useDerivedValue, useSharedValue } from 'react-native-reanimated';
import BottomSheet, { BottomSheetBackdrop, BottomSheetBackdropProps } from '@gorhom/bottom-sheet';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

import { useTheme } from '../../theme';
Expand Down Expand Up @@ -167,6 +167,11 @@ const ActionSheet = React.memo(
onChange={index => index === -1 && onClose()}
// We need this to allow horizontal swipe gesture inside the bottom sheet like in reaction picker
enableContentPanningGesture={data?.enableContentPanningGesture ?? true}
accessible={undefined}
accessibilityRole={undefined}
accessibilityLabel={undefined}
accessibilityHint={undefined}
overrideReduceMotion={ReduceMotion.Never}
Comment on lines +170 to +174

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

@gorhom/bottom-sheet ReduceMotion.Never accessibility reduce motion

💡 Result:

Yes — @gorhom/bottom-sheet supports overriding the system Reduce Motion setting via the overrideReduceMotion prop. Use ReduceMotion.Never to force animations even when the device's "Reduce Motion" accessibility option is enabled. Example:

  • import and usage:
    • <BottomSheet overrideReduceMotion={ReduceMotion.Never} ... />. [1]

Reference: props doc for overrideReduceMotion (ReduceMotion.System | Always | Never). [1] Reanimated docs on ReduceMotion enums and behavior. [2]

Sources

  • [1] gorhom bottom-sheet props — overrideReduceMotion.
  • [2] React Native Reanimated accessibility guide (ReduceMotion.System / Always / Never).

🏁 Script executed:

find . -name "ActionSheet.tsx" -type f | head -5

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 212


🏁 Script executed:

git ls-files | grep -i "ActionSheet.tsx"

Repository: RocketChat/Rocket.Chat.ReactNative

Length of output: 212


Accessibility concern: overrideReduceMotion={ReduceMotion.Never} ignores user preferences.

Setting ReduceMotion.Never forces animations even when users have enabled "Reduce Motion" in their device accessibility settings. This can cause discomfort for users with vestibular disorders or motion sensitivity.

Use ReduceMotion.System instead to respect the user's accessibility preferences:

Suggested fix
-						overrideReduceMotion={ReduceMotion.Never}
+						overrideReduceMotion={ReduceMotion.System}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
accessible={undefined}
accessibilityRole={undefined}
accessibilityLabel={undefined}
accessibilityHint={undefined}
overrideReduceMotion={ReduceMotion.Never}
accessible={undefined}
accessibilityRole={undefined}
accessibilityLabel={undefined}
accessibilityHint={undefined}
overrideReduceMotion={ReduceMotion.System}
🤖 Prompt for AI Agents
In `@app/containers/ActionSheet/ActionSheet.tsx` around lines 170 - 174, The
ActionSheet is forcing animations by setting
overrideReduceMotion={ReduceMotion.Never}, which ignores user "Reduce Motion"
preferences; locate the overrideReduceMotion prop usage in ActionSheet
(ActionSheet.tsx) and change it to ReduceMotion.System so the component respects
system accessibility settings (ensure the ReduceMotion enum/import is available
and adjust any tests or callers if they rely on the forced behavior).

{...androidTablet}>
<BottomSheetContent
options={data?.options}
Expand Down
Loading
Loading