Skip to content

Commit 191945f

Browse files
committed
fix(mobile): limit the new-thread picker change to iOS
1 parent 25f32c4 commit 191945f

1 file changed

Lines changed: 29 additions & 69 deletions

File tree

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

Lines changed: 29 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ import {
2828
KeyboardStickyView,
2929
useKeyboardState,
3030
} from "react-native-keyboard-controller";
31-
import Animated, {
32-
FadeInDown,
33-
ReduceMotion,
34-
useSharedValue,
35-
withSpring,
36-
type EntryExitAnimationFunction,
37-
} from "react-native-reanimated";
31+
import Animated, { FadeInDown, ReduceMotion } from "react-native-reanimated";
3832
import { useSafeAreaInsets } from "react-native-safe-area-context";
3933
import { useUniwindTheme } from "../../lib/useUniwindTheme";
4034
import { FONT_FAMILIES } from "../../lib/fontFamilies";
@@ -80,9 +74,7 @@ import { hasProviderUsageLimits, isUsageLimitsCommand } from "@t3tools/shared/us
8074
import { COMPOSER_LAYOUT_TRANSITION, ComposerSurface } from "./ThreadComposer";
8175
import { ComposerCommandPopover } from "./ComposerCommandPopover";
8276
import { ComposerPopoverAnchor } from "./ComposerPopoverAnchor";
83-
import { ComposerPopoverHost } from "./ComposerPopoverHost";
8477
import { useComposerCommandMenu } from "./use-composer-command-menu";
85-
8678
import {
8779
ComposerDictationCancelAction,
8880
ComposerDictationPrimaryAction,
@@ -150,30 +142,7 @@ import { serverEnvironment } from "../../state/server";
150142
import { fileRoutePathSegments } from "../files/filePath";
151143
import { readEnvironmentScope, useEnvironmentScope } from "../../state/session";
152144

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);
145+
const COMPOSER_POPOVER_ENTERING = FadeInDown.duration(180).reduceMotion(ReduceMotion.System);
177146

178147
function NewTaskWorkspaceIcon(props: {
179148
readonly workspaceMode: "local" | "worktree";
@@ -503,7 +472,6 @@ export function NewTaskDraftScreen(props: {
503472
? selectedProject?.workspaceRoot
504473
: (flow.selectedWorktreePath ?? selectedProject?.workspaceRoot)) || null;
505474
const stripAttachments = composerStripAttachments(flow.attachments);
506-
const composerPopoverHeight = useSharedValue(0);
507475
const composerMenu = useComposerCommandMenu({
508476
draftMessage: flow.prompt,
509477
ownerKey: flow.draftKey,
@@ -1597,6 +1565,15 @@ export function NewTaskDraftScreen(props: {
15971565
</View>
15981566
);
15991567

1568+
const composerPopover = composerMenu.trigger ? (
1569+
<ComposerCommandPopover
1570+
items={composerMenu.items}
1571+
triggerKind={composerMenu.trigger.kind}
1572+
isLoading={composerMenu.isLoading}
1573+
error={composerMenu.error}
1574+
onSelect={composerMenu.onSelect}
1575+
/>
1576+
) : null;
16001577
const composerDock = (
16011578
<View
16021579
className={
@@ -1607,22 +1584,15 @@ export function NewTaskDraftScreen(props: {
16071584
{!voiceInput.isBusy &&
16081585
composerMenu.trigger &&
16091586
(composerMenu.items.length > 0 || composerMenu.trigger.kind === "pull-request") ? (
1610-
<View>
1611-
<ComposerPopoverAnchor>
1612-
<Animated.View
1613-
entering={COMPOSER_POPOVER_ENTERING}
1614-
style={{ transformOrigin: "bottom" }}
1615-
>
1616-
<ComposerCommandPopover
1617-
items={composerMenu.items}
1618-
triggerKind={composerMenu.trigger.kind}
1619-
isLoading={composerMenu.isLoading}
1620-
error={composerMenu.error}
1621-
onSelect={composerMenu.onSelect}
1622-
/>
1623-
</Animated.View>
1624-
</ComposerPopoverAnchor>
1625-
</View>
1587+
Platform.OS === "ios" ? (
1588+
<View>
1589+
<ComposerPopoverAnchor>
1590+
<Animated.View entering={COMPOSER_POPOVER_ENTERING}>{composerPopover}</Animated.View>
1591+
</ComposerPopoverAnchor>
1592+
</View>
1593+
) : (
1594+
<View className="mb-2">{composerPopover}</View>
1595+
)
16261596
) : null}
16271597
{projectClone && projectClone.phase !== "done" && selectedProject ? (
16281598
<View className="px-1 pb-2">
@@ -1835,18 +1805,10 @@ export function NewTaskDraftScreen(props: {
18351805
{heroViewport}
18361806

18371807
<KeyboardStickyView
1838-
pointerEvents="box-none"
1839-
style={{ position: "absolute", top: 0, bottom: 0, left: 0, right: 0 }}
1808+
style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}
18401809
offset={{ closed: 0, opened: keyboardOpenedOffset }}
18411810
>
1842-
<ComposerPopoverHost hidden={false} popoverHeight={composerPopoverHeight}>
1843-
<View
1844-
pointerEvents="box-none"
1845-
style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}
1846-
>
1847-
{composerDock}
1848-
</View>
1849-
</ComposerPopoverHost>
1811+
{composerDock}
18501812
</KeyboardStickyView>
18511813
</ScreenContent>
18521814
</View>
@@ -1874,15 +1836,13 @@ export function NewTaskDraftScreen(props: {
18741836
style={{ position: "absolute", top: 0, bottom: 0, left: 0, right: 0 }}
18751837
offset={{ closed: 0, opened: keyboardOpenedOffset }}
18761838
>
1877-
<ComposerPopoverHost hidden={false} popoverHeight={composerPopoverHeight}>
1878-
<Animated.View
1879-
layout={COMPOSER_LAYOUT_TRANSITION}
1880-
pointerEvents="box-none"
1881-
style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}
1882-
>
1883-
{composerDock}
1884-
</Animated.View>
1885-
</ComposerPopoverHost>
1839+
<Animated.View
1840+
layout={COMPOSER_LAYOUT_TRANSITION}
1841+
pointerEvents="box-none"
1842+
style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}
1843+
>
1844+
{composerDock}
1845+
</Animated.View>
18861846
</KeyboardStickyView>
18871847
</View>
18881848
);

0 commit comments

Comments
 (0)