Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): size a chat image's frame before its bytes arrive #10199

Mergedjuliusmarmingemerged 2 commits intomedia-dims/contract fromrefs/pull/10199/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 67 additions and 28 deletions.

x
0 of 2 viewed, 2 left
32 additions and 16 deletionsapps/mobile/src/features/threads/ThreadFeed.tsxModified
View file
@@ -177,6 +177,7 @@
} from "../files/filePath";
import { fileChipMenu, resolveFileChipTarget, type FileChipAction } from "./fileChipMenu";
import {
+ MarkdownImageAvailableWidthContext,
ThreadMarkdownImage,
ThreadMarkdownImageUnavailable,
ThreadMarkdownImageView,
@@ -206,6 +207,10 @@
// text fits at the current font settings. Larger accessibility text is measured.
const TURN_FOLD_HEIGHT = 42; // min-h-11 (38.5) + mb-1 (3.5), with the mobile 14px rem
const THREAD_FEED_LAYOUT_TRANSITION = LinearTransition.duration(THREAD_DISCLOSURE_TRANSITION_MS);
+// Tailwind spacing on the mobile 14px rem: px-3.5 on the user bubble, px-1 on
+// assistant rows. Images size their frame from these before their own layout.
+const USER_BUBBLE_HORIZONTAL_PADDING = 3.5 * 3.5;
+const ASSISTANT_ROW_HORIZONTAL_PADDING = 3.5;
// Let neighboring rows move out of the new rows' space before showing their text.
const THREAD_FEED_DISCLOSURE_ENTER_TRANSITION = FadeIn.delay(
THREAD_DISCLOSURE_TRANSITION_MS,
@@ -1331,6 +1336,8 @@
readonly reviewCommentBubbleWidth: number;
readonly themeAppearance: "light" | "dark";
readonly userBubbleMaxWidth: number;
+ /** Width assistant markdown lays out in, so images can size their frame before layout. */
+ readonly markdownContentWidth: number;
const entry = info.item;