Skip to content

Commit 6e28c3f

Browse files
fix(mobile): keep a Reduce Motion change event ahead of the initial query
If the setting changes before the mount-time query resolves, the query's older answer no longer overwrites the newer value from the change event. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 941f22f commit 6e28c3f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎apps/mobile/src/features/threads/ThreadDetailScreen.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,10 +684,13 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
684684
// changes Reduce Motion while the thread is open.
685685
const reduceMotionRef = useRef(true);
686686
useEffect(() => {
687+
// A change event is newer than an initial query that resolves after it.
688+
let changed = false;
687689
void AccessibilityInfo.isReduceMotionEnabled().then((enabled) => {
688-
reduceMotionRef.current = enabled;
690+
if (!changed) reduceMotionRef.current = enabled;
689691
});
690692
const subscription = AccessibilityInfo.addEventListener("reduceMotionChanged", (enabled) => {
693+
changed = true;
691694
reduceMotionRef.current = enabled;
692695
});
693696
return () => subscription.remove();

0 commit comments

Comments
 (0)