Skip to content

Commit d970278

Browse files
shivamhwpPipyakasclaude
committed
fix(mobile): Android shows the composer buttons and all Thread settings rows with animations removed
With Android's Remove animations on, Reanimated can drop the one frame a reduced-motion entering animation gets, so the view stays at its starting pose (opacity 0). The new-thread toolbar flip and the Thread settings row fades both hit this. Skip those entering and exiting animations when reduced motion is on so the views mount in their resting style. Closes #21744 Co-authored-by: Pipyakas <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5307c23 commit d970278

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ import * as Haptics from "expo-haptics";
3030
import { AsyncResult } from "effect/reactivity";
3131
import { createContext, use, useEffect, useRef, useState, type ReactNode } from "react";
3232
import { Platform, Pressable, RefreshControl, ScrollView, TextInput, View } from "react-native";
33-
import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";
33+
import Animated, {
34+
FadeIn,
35+
FadeOut,
36+
LinearTransition,
37+
useReducedMotion,
38+
} from "react-native-reanimated";
3439
import { useSafeAreaInsets } from "react-native-safe-area-context";
3540

3641
import { SymbolView } from "../../components/ui/AppSymbol";
@@ -872,7 +877,10 @@ function ThreadSettingsMainContent(props: {
872877
if (error) Dialog.alert("Could not refresh models", error);
873878
});
874879
};
875-
const [animationsReady, setAnimationsReady] = useState(false);
880+
const [listLoaded, setListLoaded] = useState(false);
881+
// Android can drop the first frame of a reduced-motion fade, leaving rows invisible.
882+
const reducedMotion = useReducedMotion();
883+
const animationsReady = listLoaded && !reducedMotion;
876884
const catalogItems = buildThreadSettingsCatalogItems(session);
877885
const hasActiveCatalogFilter =
878886
session.providerFilter !== null || session.searchQuery.trim().length > 0;
@@ -997,7 +1005,7 @@ function ThreadSettingsMainContent(props: {
9971005
<RefreshControl refreshing={isRefreshingProviders} onRefresh={refreshProviders} />
9981006
) : undefined
9991007
}
1000-
onLoad={() => setAnimationsReady(true)}
1008+
onLoad={() => setListLoaded(true)}
10011009
renderItem={renderCatalogItem}
10021010
showsVerticalScrollIndicator={false}
10031011
/>

‎apps/mobile/src/features/voice-input/ComposerDictationControl.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Animated, {
1313
LinearTransition,
1414
ReduceMotion,
1515
useAnimatedStyle,
16+
useReducedMotion,
1617
useSharedValue,
1718
withTiming,
1819
type EntryExitAnimationFunction,
@@ -135,14 +136,19 @@ export function ComposerDictationToolbar(props: {
135136
readonly showsDictation: boolean;
136137
readonly visible?: boolean;
137138
}) {
139+
// Android can drop the reduced-motion flip's final frame, leaving the toolbar invisible.
140+
const reducedMotion = useReducedMotion();
141+
const entering = props.showsDictation ? DICTATION_TOOLBAR_ENTERING : DRAFT_TOOLBAR_ENTERING;
142+
const exiting = props.showsDictation ? DICTATION_TOOLBAR_EXITING : DRAFT_TOOLBAR_EXITING;
143+
138144
return (
139145
<View className="relative h-[44px] overflow-hidden">
140146
{props.visible !== false ? (
141147
<Animated.View
142148
key={props.showsDictation ? "dictation" : "draft"}
143149
className="absolute inset-0"
144-
entering={props.showsDictation ? DICTATION_TOOLBAR_ENTERING : DRAFT_TOOLBAR_ENTERING}
145-
exiting={props.showsDictation ? DICTATION_TOOLBAR_EXITING : DRAFT_TOOLBAR_EXITING}
150+
entering={reducedMotion ? undefined : entering}
151+
exiting={reducedMotion ? undefined : exiting}
146152
style={{ backfaceVisibility: "hidden" }}
147153
>
148154
{props.children}

0 commit comments

Comments
 (0)