fix(mobile): stabilize thread composer and interactions #5986
main fromrefs/pull/5986/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- @@ -383,3 +388,7 @@383388 {/* Floating composer — sticks to keyboard via KeyboardStickyView */}384389 {showContent ? (385390 <KeyboardStickyView391+ // The animated keyboard height can remain stale after a dismissed392+ // IME on both platforms. Visibility is the authoritative closed393+ // state, so disable the translation rather than stranding the pill.394+ enabled={isKeyboardVisible}
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/mobile/src/features/threads/ThreadFeed.tsx line 1517OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1486,11 +1506,12 @@14861506 // end. Leaving a session open would let a later animated maintain-scroll14871507 // read as user motion and break follow spuriously.1488- const handleScrollEndDrag = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {1489- const velocity = event.nativeEvent.velocity?.y ?? 0;1490- if (Math.abs(velocity) < 0.05) {1491- userScrollSessionRef.current = false;1492- }1493- }, []);1494- const handleMomentumScrollEnd = useCallback(() => {1495- userScrollSessionRef.current = false;1496- }, []);1508+ const handleScrollEndDrag = useCallback(1509+ (event: NativeSyntheticEvent<NativeScrollEvent>) => {1510+ const velocity = event.nativeEvent.velocity?.y ?? 0;1511+ if (Math.abs(velocity) < 0.05) {1512+ finishUserScroll();1513+ }1514+ },1515+ [finishUserScroll],1516+ );1517+ const handleMomentumScrollEnd = finishUserScroll;
- apps/mobile/src/features/threads/thread-feed-live-follow.ts line 25Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +5,21 @@5+ readonly type: "user-scroll-end";6+ readonly isAtEnd: boolean;7+ readonly userScrollSessionActive: boolean;8+ }9+ | {10+ readonly type: "scroll";11+ readonly isAtEnd: boolean;12+ readonly userScrollSessionActive: boolean;13+ };14+15+export function resolveThreadFeedLiveFollow(16+ current: boolean,17+ event: ThreadFeedLiveFollowEvent,18+): boolean {19+ switch (event.type) {20+ case "reset":21+ return true;22+ case "user-scroll-begin":23+ return false;24+ case "user-scroll-end":25+ return event.userScrollSessionActive ? event.isAtEnd : current;
- apps/mobile/src/features/threads/ThreadFeed.tsx line 1522OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1495,2 +1503,20 @@1503+ }, [clearUserScrollSettle, transitionEndFollow]);1504+ const finishUserScroll = useCallback(() => {1505+ clearUserScrollSettle();1506+ const userScrollSessionActive = userScrollSessionRef.current;14951507 userScrollSessionRef.current = false;1496- }, []);1508+ transitionEndFollow({1509+ type: "user-scroll-end",1510+ isAtEnd: props.listRef.current?.getState().isAtEnd ?? false,1511+ userScrollSessionActive,1512+ });1513+ }, [clearUserScrollSettle, props.listRef, transitionEndFollow]);1514+ // Finger-lift velocity is not a reliable momentum signal: a gentle fling1515+ // can report zero and still decelerate. Give native momentum a short window1516+ // to announce itself; if it does, onMomentumScrollBegin cancels this fallback1517+ // and the session survives until the settled momentum-end position. This1518+ // mirrors the native-event handoff used by the home thread list's scroll gate.1519+ const handleScrollEndDrag = useCallback(() => {1520+ clearUserScrollSettle();1521+ userScrollSettleTimerRef.current = setTimeout(finishUserScroll, 160);1522+ }, [clearUserScrollSettle, finishUserScroll]);
juliusmarminge changed the title
- @@ -204,3 +226,4 @@204226 const selectedThreadFeed = props.selectedThreadFeed;205227 const composerChrome = composerExpanded ? COMPOSER_EXPANDED_CHROME : COMPOSER_COLLAPSED_CHROME;206228 const composerOverlapHeight = composerChrome + composerBottomInset;229+ const pendingUserInputMaxHeight = derivePendingUserInputMaxHeight({
- apps/mobile/src/features/threads/ThreadFeed.tsx line 1543Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1492,5 +1525,18 @@1525+ // Finger-lift velocity is not a reliable momentum signal: a gentle fling1526+ // can report zero and still decelerate. Give native momentum a short window1527+ // to announce itself; if it does, onMomentumScrollBegin cancels this fallback1528+ // and the session survives until the settled momentum-end position. This1529+ // mirrors the native-event handoff used by the home thread list's scroll gate.1530+ const handleScrollEndDrag = useCallback(() => {1531+ clearUserScrollSettle();1532+ const releaseIsAtEnd = props.listRef.current?.getState().isAtEnd ?? false;1533+ userScrollSettleTimerRef.current = setTimeout(() => finishUserScroll(releaseIsAtEnd), 160);1534+ }, [clearUserScrollSettle, finishUserScroll, props.listRef]);1535+ const handleMomentumScrollBegin = useCallback(() => {1536+ if (userScrollSessionRef.current) {1537+ clearUserScrollSettle();14921538 }1493- }, []);1539+ }, [clearUserScrollSettle]);14941540 const handleMomentumScrollEnd = useCallback(() => {1495- userScrollSessionRef.current = false;1496- }, []);1541+ finishUserScroll();1542+ }, [finishUserScroll]);apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 541Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -312,3 +341,11 @@312341 composerEditorRef.current?.blur();313342 }, []);314343344+ const handleScrollToEnd = useCallback(() => {345+ void Haptics.selectionAsync();346+ void scrollMessageToEnd({ animated: true, closeKeyboard: false }).catch(() => {347+ freeze.set(false);348+ });349+ }, [freeze, scrollMessageToEnd]);350+351+ const showScrollToEndButton = contentPresentationKind === "ready" && !endFollowEnabled;
github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- patches/react-native-screens@4.25.2.patch line 255Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -225,7 +237,14 @@225-+ withCurrentItems:navitem.leftBarButtonItems226-+ navigationItem:navitem];227-+ NSArray<UIBarButtonItem *> *rightBarButtonItems = [config barButtonItemsFromConfigs:config.headerRightBarButtonItems228-+ withCurrentItems:navitem.rightBarButtonItems229-+ navigationItem:navitem];230-+ NSArray<UIBarButtonItem *> *centerBarButtonItems = [config barButtonItemsFromConfigs:config.headerCenterBarButtonItems231-+ withCurrentItems:@[]237++ NSArray *headerLeftConfigs = config.headerLeftBarButtonItems ?: @[];238++ NSArray *headerRightConfigs = config.headerRightBarButtonItems ?: @[];239++ NSArray *headerCenterConfigs = config.headerCenterBarButtonItems ?: @[];240++ NSArray<UIBarButtonItem *> *subviewLeftItems = navitem.leftBarButtonItems ?: @[];241++ NSArray<UIBarButtonItem *> *subviewRightItems = navitem.rightBarButtonItems ?: @[];242++ NSArray *headerItemsKey = @[ headerLeftConfigs, headerRightConfigs, headerCenterConfigs ];243++ // Rebuilding bar button items creates brand-new native buttons (glass244++ // UIButton custom views on iOS 26). Replacing them while UIKit animates an245++ // existing one (menu capsule morph, push/pop glass transitions) strands the246++ // animation overlay — a stuck expanded capsule or an unmasked square back247++ // button. When the JS configs are unchanged, keep the already-applied items.248++ // Subview-backed items are re-derived every pass, so their presence forces249++ // the rebuild path.250++ BOOL reuseHeaderBarButtonItems = subviewLeftItems.count == 0 && subviewRightItems.count == 0 &&@@ -239,11 +269,14 @@269++ navitem.leftBarButtonItems = nil;270++ navitem.rightBarButtonItems = nil;271++ } else {272++ navitem.leftBarButtonItems = leftBarButtonItems;273++ navitem.rightBarButtonItems = rightBarButtonItems;239274 + }240-+ navitem.leftBarButtonItems = nil;241-+ navitem.rightBarButtonItems = nil;242-+ } else {275++#else243276 + navitem.leftBarButtonItems = leftBarButtonItems;244277 + navitem.rightBarButtonItems = rightBarButtonItems;245-+ }246-+#else247-+ navitem.leftBarButtonItems = leftBarButtonItems;248-+ navitem.rightBarButtonItems = rightBarButtonItems;249278 +#endif279++ // Only dict-driven items can be reused: with subview-backed items in the280++ // mix the applied state depends on view identity, so clear the key to281++ // force a rebuild on the next pass.282++ objc_setAssociatedObject(
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- patches/@react-native-menu__menu@2.0.0.patch line 168Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -17,3 +24,18 @@1724 + self.updateLongPressInteraction()1825 + }1926 +27++ private func refreshPresentedMenu(_ menu: UIMenu) {28++ // Tap mode presents through the button's built-in interaction,29++ // long-press mode through the superview-hosted one; cover both (plus30++ // the interaction added in init) and dedupe by identity.31++ var candidates = self.interactions.compactMap { $0 as? UIContextMenuInteraction }32++ if let builtin = self.contextMenuInteraction {33++ candidates.append(builtin)34++ }35++ if let host = longPressInteraction {36++ candidates.append(host)37++ }38++ var visited: Set<ObjectIdentifier> = []39++ for interaction in candidates where visited.insert(ObjectIdentifier(interaction)).inserted {40++ interaction.updateVisibleMenu { _ in menu }41++ }
- apps/mobile/src/features/threads/thread-settings-menu.ts line 100OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +80,21 @@80+81+ const isSelected = (option: ModelOption) =>82+ option.selection.instanceId === input.selectedModel?.instanceId &&83+ option.selection.model === input.selectedModel.model;84+85+ // Top-level leaves (boolean toggles) always keep the menu presented (iOS86+ // 16+): the root refreshes in place with clean chrome. Nested picks follow87+ // NESTED_PICKS_KEEP_MENU_PRESENTED.88+ const keepPresented = { keepsMenuPresented: true } as const;89+ const nestedPickAttributes = NESTED_PICKS_KEEP_MENU_PRESENTED90+ ? { attributes: keepPresented }91+ : {};92+93+ const modelAction = (option: ModelOption, id: string): MenuAction => {94+ events.set(id, { type: "select-model", option });95+ return {96+ id,97+ title: option.label,98+ ...(option.isDefault ? { subtitle: "Default" } : {}),99+ state: isSelected(option) ? "on" : "off",100+ ...nestedPickAttributes,
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 746Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -450,0 +559,21 @@559+ threadSyncPhase={threadSyncPhase}560+ selectedThread={props.selectedThread}561+ serverConfig={props.serverConfig}562+ queueCount={props.selectedThreadQueueCount}563+ activeThreadBusy={props.activeThreadBusy}564+ environmentId={props.environmentId}565+ projectCwd={props.projectWorkspaceRoot}566+ bottomInset={composerBottomInset}567+ onChangeDraftMessage={props.onChangeDraftMessage}568+ onPickDraftImages={props.onPickDraftImages}569+ onNativePasteImages={props.onNativePasteImages}570+ onRemoveDraftImage={props.onRemoveDraftImage}571+ onStopThread={props.onStopThread}572+ onSendMessage={handleSendMessage}573+ onReconnectEnvironment={props.onReconnectEnvironment}574+ onUpdateModelSelection={props.onUpdateThreadModelSelection}575+ onUpdateRuntimeMode={props.onUpdateThreadRuntimeMode}576+ onUpdateInteractionMode={props.onUpdateThreadInteractionMode}577+ onExpandedChange={setComposerExpanded}578+ />579+ </View>apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 518OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -393,4 +498,21 @@498+ onPress={handleScrollToEnd}499+ />500+ </LiquidGlassView>501+ ) : (502+ <ControlPill503+ accessibilityLabel="Scroll to end"504+ activateOnPressIn505+ className="h-9 w-9 border border-border bg-card shadow-md shadow-black/10"506+ icon={{ ios: "chevron.down", android: "keyboard_arrow_down" }}507+ onPress={handleScrollToEnd}508+ />509+ )}510+ </Animated.View>511+ ) : null}393512 <View className="w-full self-center" style={{ maxWidth: contentMaxWidth }}>394513 {props.activePendingApproval || props.activePendingUserInput ? (395514 <Animated.View396515 className="shrink-0 gap-3 px-4 pb-3"516+ // The expanded questionnaire replaces the composer, so it517+ // must pad the home indicator the composer normally covers.518+ style={userInputExpanded ? { paddingBottom: composerBottomInset } : undefined}
- apps/mobile/src/features/threads/PendingUserInputCard.tsx line 82OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -26,0 +62,21 @@62+ onPress={props.onToggleCollapsed}63+ className="min-h-10 flex-1 flex-row items-center gap-2 active:opacity-70"64+ >65+ <Text className="font-t3-bold text-2xs uppercase tracking-[1.1px] text-sky-700 dark:text-sky-300">66+ User input needed67+ </Text>68+ <Text className="font-sans text-xs text-neutral-500 dark:text-neutral-400">69+ {questionCount} question{questionCount === 1 ? "" : "s"}70+ </Text>71+ <View className="flex-1" />72+ <SymbolView name="chevron.up" size={12} tintColor={iconSubtle} type="monochrome" />73+ </Pressable>74+ {props.onStopThread ? (75+ <ControlPill76+ accessibilityLabel="Stop"77+ icon="stop.fill"78+ variant="danger"79+ className="h-9 w-9"80+ onPress={props.onStopThread}81+ />82+ ) : null}
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 275OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -206,0 +255,21 @@255+ // Collapsing hides the custom-answer inputs; release the keyboard with256+ // them instead of leaving it up over a dead responder.257+ Keyboard.dismiss();258+ setCollapsedUserInputRequestId(activeUserInputRequestId);259+ }260+ }, [activeUserInputRequestId, userInputCollapsed]);261+ // The card's max height tracks the keyboard's ANIMATED height, so it262+ // resizes frame-by-frame with the keyboard instead of correcting itself in263+ // a second animation once the hide settles (the binary visibility state264+ // only flips on keyboardDidHide).265+ const keyboardAnimation = useReanimatedKeyboardAnimation();266+ const pendingUserInputMaxHeightStyle = useAnimatedStyle(() => ({267+ maxHeight: derivePendingUserInputMaxHeight({268+ windowHeight,269+ keyboardHeight: Math.abs(keyboardAnimation.height.value),270+ navigationHeaderHeight,271+ // The questionnaire owns the composer slot, so only the composer's272+ // bottom inset still overlaps.273+ composerOverlapHeight: composerBottomInset,274+ }),275+ }));
- apps/mobile/src/features/threads/PendingUserInputCard.tsx line 101OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -62,0 +81,21 @@81+ </Pressable>82+ {props.onStopThread ? (83+ <ControlPill84+ accessibilityLabel="Stop"85+ icon="stop.fill"86+ variant="danger"87+ className="h-9 w-9"88+ onPress={props.onStopThread}89+ />90+ ) : null}91+ </View>92+ {props.collapsed ? null : (93+ // The surface is opaque on purpose: the card floats over the thread94+ // feed with no blur behind it, so a translucent background renders95+ // the questions on top of whatever message happens to sit underneath.96+ <Animated.View97+ entering={FadeInUp.duration(220)}98+ exiting={FadeOutDown.duration(160)}99+ layout={CARD_LAYOUT_TRANSITION}100+ className="absolute inset-x-0 bottom-0 overflow-hidden gap-2.5 rounded-[20px] border border-neutral-200 bg-neutral-100 p-4 dark:border-white/6 dark:bg-neutral-900"101+ style={{ maxHeight: props.maxHeight }}
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 331OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -222,0 +311,21 @@311+ // the measured overlay height (that constancy is what keeps the feed from312+ // snapping on collapse/expand). Its coverage above the bar footprint is313+ // instead added to the feed's end inset HERE, animated in sync with the314+ // card's 220ms rise/sink, so the end of the chat glides up above the card315+ // the way it does for the keyboard.316+ const [userInputCardCoverage, setUserInputCardCoverage] = useState(0);317+ const pendingCardInsetExtra = useSharedValue(0);318+ const combinedContentInsetEndAdjustment = useSharedValue(319+ Math.max(0, estimatedOverlayHeight - nativeInsetOvercount),320+ );321+ useAnimatedReaction(322+ () => contentInsetEndAdjustment.value + pendingCardInsetExtra.value,323+ (value) => {324+ combinedContentInsetEndAdjustment.value = value;325+ },326+ );327+ const userInputInsetExtraTarget =328+ activeUserInputRequestId !== null && !userInputCollapsed ? userInputCardCoverage : 0;329+ useEffect(() => {330+ pendingCardInsetExtra.value = withTiming(userInputInsetExtraTarget, { duration: 220 });331+ }, [pendingCardInsetExtra, userInputInsetExtraTarget]);apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 331OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -222,0 +311,21 @@311+ // the measured overlay height (that constancy is what keeps the feed from312+ // snapping on collapse/expand). Its coverage above the bar footprint is313+ // instead added to the feed's end inset HERE, animated in sync with the314+ // card's 220ms rise/sink, so the end of the chat glides up above the card315+ // the way it does for the keyboard.316+ const [userInputCardCoverage, setUserInputCardCoverage] = useState(0);317+ const pendingCardInsetExtra = useSharedValue(0);318+ const combinedContentInsetEndAdjustment = useSharedValue(319+ Math.max(0, estimatedOverlayHeight - nativeInsetOvercount),320+ );321+ useAnimatedReaction(322+ () => contentInsetEndAdjustment.value + pendingCardInsetExtra.value,323+ (value) => {324+ combinedContentInsetEndAdjustment.value = value;325+ },326+ );327+ const userInputInsetExtraTarget =328+ activeUserInputRequestId !== null && !userInputCollapsed ? userInputCardCoverage : 0;329+ useEffect(() => {330+ pendingCardInsetExtra.value = withTiming(userInputInsetExtraTarget, { duration: 220 });331+ }, [pendingCardInsetExtra, userInputInsetExtraTarget]);
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx lines 356 to 360OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -223,0 +340,21 @@340+ easing: Easing.out(Easing.cubic),341+ });342+ } else {343+ // Collapsing: the sinking card still covers the strip being revealed,344+ // so an instant step is invisible behind it.345+ pendingCardInsetExtra.value = userInputInsetExtraTarget;346+ }347+ if (!endFollowEnabledRef.current) {348+ return;349+ }350+ // The list's own corrections for these inset changes drift on short351+ // content (and the error compounds across toggles), so deterministically352+ // re-pin the end once the change settles: a no-op when the resting353+ // position is already right, corrective when it is not. On collapse the354+ // correction lands while the sinking card still covers the strip.355+ const timer = setTimeout(356+ () => {357+ void scrollMessageToEnd({ animated: false, closeKeyboard: false }).catch(() => {358+ freeze.set(false);359+ });360+ },
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 362OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -223,0 +342,21 @@342+ } else {343+ // Collapsing: the sinking card still covers the strip being revealed,344+ // so an instant step is invisible behind it.345+ pendingCardInsetExtra.value = userInputInsetExtraTarget;346+ }347+ if (!endFollowEnabledRef.current) {348+ return;349+ }350+ // The list's own corrections for these inset changes drift on short351+ // content (and the error compounds across toggles), so deterministically352+ // re-pin the end once the change settles: a no-op when the resting353+ // position is already right, corrective when it is not. On collapse the354+ // correction lands while the sinking card still covers the strip.355+ const timer = setTimeout(356+ () => {357+ void scrollMessageToEnd({ animated: false, closeKeyboard: false }).catch(() => {358+ freeze.set(false);359+ });360+ },361+ expanding ? USER_INPUT_TOGGLE_DURATION_MS + 50 : 60,362+ );
- @@ -173,3 +210,16 @@173210174211 export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: ThreadDetailScreenProps) {175212 const insets = useSafeAreaInsets();213+ const isKeyboardVisible = useKeyboardState((state) => state.isVisible);214+ const liveKeyboardHeight = useKeyboardState((state) => state.height);215+ // Android can swallow the IME hide callbacks when the app is backgrounded216+ // mid keyboard-hide (the reported repro: send — which blurs and starts the217+ // hide — then Home within a second). The keyboard library's height AND218+ // visibility then stay frozen open, so gating the sticky translation on219+ // visibility alone still strands the composer after resume. Quarantine the220+ // translation on every Android resume instead; any sign of a live keyboard221+ // stream — an owned input gaining focus, or any visibility/height movement —222+ // lifts it. A healthy resume sees no visual difference (the translation is223+ // already zero while the keyboard is closed).224+ const [keyboardStateSuspect, setKeyboardStateSuspect] = useState(false);225+ useEffect(() => {
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 237Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -175 +212,21 @@175212 const insets = useSafeAreaInsets();213+ const isKeyboardVisible = useKeyboardState((state) => state.isVisible);214+ const liveKeyboardHeight = useKeyboardState((state) => state.height);215+ // Android can swallow the IME hide callbacks when the app is backgrounded216+ // mid keyboard-hide (the reported repro: send — which blurs and starts the217+ // hide — then Home within a second). The keyboard library's height AND218+ // visibility then stay frozen open, so gating the sticky translation on219+ // visibility alone still strands the composer after resume. Quarantine the220+ // translation on every Android resume instead; any sign of a live keyboard221+ // stream — an owned input gaining focus, or any visibility/height movement —222+ // lifts it. A healthy resume sees no visual difference (the translation is223+ // already zero while the keyboard is closed).224+ const [keyboardStateSuspect, setKeyboardStateSuspect] = useState(false);225+ useEffect(() => {226+ if (Platform.OS !== "android") {227+ return;228+ }229+ const subscription = AppState.addEventListener("change", (state) => {230+ if (state === "active") {231+ setKeyboardStateSuspect(true);232+ }
- apps/mobile/src/features/threads/NewTaskDraftScreen.tsx line 1013Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -988,8 +995,19 @@995+ // KeyboardAvoidingView's automaticOffset+padding: automaticOffset996+ // resolves the composer's on-screen frame via a native997+ // viewPositionInWindow measurement, which this app's Android998+ // edge-to-edge setup (KeyboardProvider's native content-view margin999+ // handling neutralizes windowSoftInputMode="adjustResize" while active)1000+ // makes unreliable — the composer stayed under the keyboard instead of1001+ // translating above it. KeyboardStickyView sticks directly to the1002+ // animated keyboard height instead, sidestepping that measurement.9881003 return (9891004 <View className="flex-1 bg-screen">9901005 <NativeStackScreenOptions options={{ headerShown: false }} />9911006 <AndroidScreenHeader title="New Thread" onBack={() => navigation.goBack()} />9921007993- <KeyboardAvoidingView automaticOffset behavior="padding" className="flex-1">994- <View className="flex-1" />1008+ <View className="flex-1" />99510091010+ <KeyboardStickyView1011+ enabled={isKeyboardVisible}1012+ style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}1013+ offset={{ closed: 0, opened: 0 }}apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 368OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -223 +348,21 @@348+ // card's 220ms rise/sink, so the end of the chat glides up above the card349+ // the way it does for the keyboard.350+ const [userInputCardCoverage, setUserInputCardCoverage] = useState(0);351+ const pendingCardInsetExtra = useSharedValue(0);352+ const combinedContentInsetEndAdjustment = useSharedValue(353+ Math.max(0, estimatedOverlayHeight - nativeInsetOvercount),354+ );355+ useAnimatedReaction(356+ () => contentInsetEndAdjustment.value + pendingCardInsetExtra.value,357+ (value) => {358+ combinedContentInsetEndAdjustment.value = value;359+ },360+ );223361 const { freeze, scrollMessageToEnd } = useKeyboardScrollToEnd({ listRef });362+ // Android renders the expanded card in-flow (it cannot hit-test the iOS363+ // overlay outside the bar's bounds), so its measured overlay height already364+ // includes the card — the coverage extra is iOS-only.365+ const userInputInsetExtraTarget =366+ Platform.OS === "ios" && activeUserInputRequestId !== null && !userInputCollapsed367+ ? userInputCardCoverage368+ : 0;
- apps/mobile/src/features/threads/PendingUserInputCard.tsx line 133OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -54,9 +122,12 @@54- key={option.label}55- className={cn(56- "rounded-full border px-3 py-2.5 ",57- selected58- ? "border-blue-300/50 bg-blue-50 dark:border-blue-400/28 dark:bg-blue-400/14"59- : "border-neutral-200 bg-white dark:border-white/6 dark:bg-neutral-950/70",60- )}61- onPress={() =>62- props.onSelectOption(122+ <View className="flex-1" />123+ <SymbolView name="chevron.up" size={12} tintColor={iconSubtle} type="monochrome" />124+ </Pressable>125+ {props.onStopThread ? (126+ <ControlPill127+ accessibilityLabel="Stop"128+ icon="stop.fill"129+ variant="danger"130+ className="h-9 w-9"131+ onPress={props.onStopThread}132+ />133+ ) : null}
- apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 441Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -231,0 +421,21 @@421+ Keyboard.dismiss();422+ userInputCardProgress.value = withTiming(0, USER_INPUT_TOGGLE_TIMING);423+ // Instant: the sinking card still covers the strip being revealed, and424+ // animating the inset downward is what drifted the short-content end425+ // anchor.426+ userInputInsetProgress.value = 0;427+ setCollapsedUserInputRequestId(activeUserInputRequestId);428+ scheduleUserInputRepin(60);429+ }430+ }, [431+ activeUserInputRequestId,432+ scheduleUserInputRepin,433+ userInputCardProgress,434+ userInputCollapsed,435+ userInputInsetProgress,436+ ]);437+ useEffect(() => {438+ // A new request always arrives expanded.439+ userInputCardProgress.value = 1;440+ userInputInsetProgress.value = 1;441+ }, [activeUserInputRequestId, userInputCardProgress, userInputInsetProgress]);apps/mobile/src/features/threads/ThreadDetailScreen.tsx line 429Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -231,0 +409,21 @@409+ if (activeUserInputRequestId === null) {410+ return;411+ }412+ if (userInputCollapsed) {413+ // Expanding: card and feed glide start NOW, on the UI thread.414+ userInputCardProgress.value = withTiming(1, USER_INPUT_TOGGLE_TIMING);415+ userInputInsetProgress.value = withTiming(1, USER_INPUT_TOGGLE_TIMING);416+ setCollapsedUserInputRequestId(null);417+ scheduleUserInputRepin(USER_INPUT_TOGGLE_DURATION_MS + 50);418+ } else {419+ // Collapsing hides the custom-answer inputs; release the keyboard with420+ // them instead of leaving it up over a dead responder.421+ Keyboard.dismiss();422+ userInputCardProgress.value = withTiming(0, USER_INPUT_TOGGLE_TIMING);423+ // Instant: the sinking card still covers the strip being revealed, and424+ // animating the inset downward is what drifted the short-content end425+ // anchor.426+ userInputInsetProgress.value = 0;427+ setCollapsedUserInputRequestId(activeUserInputRequestId);428+ scheduleUserInputRepin(60);429+ }
juliusmarminge merged this6676f9c
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
0a6d9639-03a9-4925-9e0c-110376cd6281You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Comment `@coderabbitai help` to get the list of available commands.