Skip to content

Commit 25f32c4

Browse files
committed
fix(mobile): Android new-thread picker opens with Material 3 menu motion
1 parent b50d94f commit 25f32c4

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

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

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ import {
2828
KeyboardStickyView,
2929
useKeyboardState,
3030
} from "react-native-keyboard-controller";
31-
import Animated, { FadeInDown, ReduceMotion, useSharedValue } from "react-native-reanimated";
31+
import Animated, {
32+
FadeInDown,
33+
ReduceMotion,
34+
useSharedValue,
35+
withSpring,
36+
type EntryExitAnimationFunction,
37+
} from "react-native-reanimated";
3238
import { useSafeAreaInsets } from "react-native-safe-area-context";
3339
import { useUniwindTheme } from "../../lib/useUniwindTheme";
3440
import { FONT_FAMILIES } from "../../lib/fontFamilies";
@@ -144,7 +150,30 @@ import { serverEnvironment } from "../../state/server";
144150
import { fileRoutePathSegments } from "../files/filePath";
145151
import { readEnvironmentScope, useEnvironmentScope } from "../../state/session";
146152

147-
const COMPOSER_POPOVER_ENTERING = FadeInDown.duration(180).reduceMotion(ReduceMotion.System);
153+
const MATERIAL_FAST_SPATIAL_SPRING = {
154+
stiffness: 1400,
155+
damping: 67.3,
156+
reduceMotion: ReduceMotion.System,
157+
};
158+
const MATERIAL_FAST_EFFECTS_SPRING = {
159+
stiffness: 3800,
160+
damping: 123.3,
161+
reduceMotion: ReduceMotion.System,
162+
};
163+
const MATERIAL_MENU_ENTERING: EntryExitAnimationFunction = () => {
164+
"worklet";
165+
return {
166+
initialValues: { opacity: 0, transform: [{ scale: 0.8 }] },
167+
animations: {
168+
opacity: withSpring(1, MATERIAL_FAST_EFFECTS_SPRING),
169+
transform: [{ scale: withSpring(1, MATERIAL_FAST_SPATIAL_SPRING) }],
170+
},
171+
};
172+
};
173+
const COMPOSER_POPOVER_ENTERING =
174+
Platform.OS === "android"
175+
? MATERIAL_MENU_ENTERING
176+
: FadeInDown.duration(180).reduceMotion(ReduceMotion.System);
148177

149178
function NewTaskWorkspaceIcon(props: {
150179
readonly workspaceMode: "local" | "worktree";
@@ -1580,7 +1609,10 @@ export function NewTaskDraftScreen(props: {
15801609
(composerMenu.items.length > 0 || composerMenu.trigger.kind === "pull-request") ? (
15811610
<View>
15821611
<ComposerPopoverAnchor>
1583-
<Animated.View entering={COMPOSER_POPOVER_ENTERING}>
1612+
<Animated.View
1613+
entering={COMPOSER_POPOVER_ENTERING}
1614+
style={{ transformOrigin: "bottom" }}
1615+
>
15841616
<ComposerCommandPopover
15851617
items={composerMenu.items}
15861618
triggerKind={composerMenu.trigger.kind}

0 commit comments

Comments
 (0)