Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(mobile): improve keyboard avoiding (#5451)

Jay Meistrich8100062a78f1
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index c12ca979b..8b6834c97 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -138,5 +138,10 @@
"@react-native-menu/menu"
]
}
+ },
+ "reanimated": {
+ "staticFeatureFlags": {
+ "DISABLE_COMMIT_PAUSING_MECHANISM": true
+ }
}
}
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx
index 28df94b52..db7fecf64 100644
--- a/apps/mobile/src/features/threads/ThreadFeed.tsx
+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx
@@ -45,14 +45,7 @@ import {
import { TouchableOpacity } from "react-native-gesture-handler";
import ImageViewing from "react-native-image-viewing";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import Animated, {
- FadeIn,
- FadeInUp,
- useSharedValue,
- withTiming,
- type LayoutAnimationsValues,
- type SharedValue,
-} from "react-native-reanimated";
+import Animated, { FadeIn, FadeInUp, type SharedValue } from "react-native-reanimated";
import { useThemeColor } from "../../lib/useThemeColor";
import { useFontFamily } from "../../lib/useFontFamily";
import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
@@ -117,14 +110,6 @@ function formatMessageTime(input: string): string {
return MESSAGE_TIME_FORMATTER.format(timestamp);
}
-// Rows shift when content above them grows (streaming text, work-log folds);
-// animating the container position turns those jumps into slides. Applied
-// conditionally — see the gated transition in ThreadFeed: while browsing
-// history the animation must NOT run, or every estimate→actual size
-// correction plays as a visible slide against the instant scroll-offset
-// compensation from maintainVisibleContentPosition.
-const FEED_ITEM_LAYOUT_DURATION_MS = 180;
-
// Pre-measurement heights for getFixedItemSize, mirroring renderFeedEntry's
// classNames. The fold row's min-h-11 (44px) stays taller than its single
// text-sm line at every supported base font size (26px at the 22pt maximum),
@@ -1457,11 +1442,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
},
[props.onHeaderMaterialVisibilityChange],
);
- // True while the viewport sits within ~one screen of the list end — the
- // only region where layout shifts should animate. Starts true because the
- // list opens pinned to the end.
- const nearListEnd = useSharedValue(true);
-
const handleScroll = useCallback(
(event: NativeSyntheticEvent<NativeScrollEvent>) => {
// anchorTopInset, not topContentInset: under automatic insets the list
@@ -1469,10 +1449,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
// UIKit's adjustedContentInset, so topContentInset is 0 here). Add the
// header height back or the material toggles a full header too late.
reportHeaderMaterialVisibility(event.nativeEvent.contentOffset.y + anchorTopInset > 6);
- const { contentOffset, contentSize, layoutMeasurement } = event.nativeEvent;
- nearListEnd.value =
- contentSize.height - layoutMeasurement.height - contentOffset.y < layoutMeasurement.height;
-
// Latch bookkeeping. LegendList recomputes its inset-aware end distance
// before invoking this handler, so getState() is current. Returning to
// the end re-arms follow no matter who scrolled (the user, or our own
@@ -1488,7 +1464,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
}
}
},
- [reportHeaderMaterialVisibility, anchorTopInset, nearListEnd, props.listRef, setEndFollow],
+ [reportHeaderMaterialVisibility, anchorTopInset, props.listRef, setEndFollow],
);
const handleScrollBeginDrag = useCallback(() => {
userScrollSessionRef.current = true;
@@ -1508,33 +1484,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
userScrollSessionRef.current = false;
}, []);
- // Gated variant of the 180ms feed layout slide. Instant while browsing
- // history: maintainVisibleContentPosition compensates the scroll offset in
- // the same frame a row's measured size lands, so an instant reposition is
- // invisible — animating it is exactly what made cold upward scrolls slide
- // and jump. Near the end the slide stays on: streaming growth and sends
- // shift rows at rest, where the animation is the thing preventing a hard
- // visual snap.
- const feedItemLayoutTransition = useMemo(() => {
- return (values: LayoutAnimationsValues) => {
- "worklet";
- const duration = nearListEnd.value ? FEED_ITEM_LAYOUT_DURATION_MS : 0;
- return {
- initialValues: {
- originX: values.currentOriginX,
- originY: values.currentOriginY,
- width: values.currentWidth,
- height: values.currentHeight,
- },
- animations: {
- originX: withTiming(values.targetOriginX, { duration }),
- originY: withTiming(values.targetOriginY, { duration }),
- width: withTiming(values.targetWidth, { duration }),
- height: withTiming(values.targetHeight, { duration }),
- },
- };
- };
- }, [nearListEnd]);
const handleViewportLayout = useCallback((event: LayoutChangeEvent) => {
const nextWidth = Math.round(event.nativeEvent.layout.width);
const nextHeight = Math.round(event.nativeEvent.layout.height);
@@ -1886,7 +1835,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
}
: { scrollIndicatorInsets: { top: topContentInset, bottom: 0 } })}
{...(anchoredEndSpace ? { anchoredEndSpace } : {})}
- itemLayoutAnimation={feedItemLayoutTransition}
// Patched LegendList prop (patches/@[email protected]):
// lets its scroll math clamp programmatic scrolls to -headerInset
// instead of 0, so initialScrollAtEnd/maintainScrollAtEnd on short