fix(mobile): prevent message and composer overlap (#9195)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-02 01:56:39 -07:00
1 parent 5b7d72aad1
commit 7e9d5a7efa
4 files changed
+31 -5

No files matched your search

@@ -151,6 +151,11 @@ export const COMPOSER_LAYOUT_TRANSITION =
? undefined
: LinearTransition.duration(COMPOSER_TRANSITION_DURATION_MS).reduceMotion(ReduceMotion.System);
const COMPOSER_ATTACHMENT_ENTERING =
Platform.OS === "android"
? FadeIn.duration(160)
: FadeIn.delay(COMPOSER_TRANSITION_DURATION_MS).duration(160).reduceMotion(ReduceMotion.System);
const AnimatedGlassSurface = Animated.createAnimatedComponent(GlassSurface);
export function ComposerSurface(props: {
@@ -623,10 +628,10 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
onPickFiles={props.onPickDraftFiles}
/>
) : null}
{isExpanded ? (
{isExpanded && props.draftAttachments.length > 0 ? (
<Animated.View
className={props.draftAttachments.length > 0 ? "px-[14px] pb-2.5" : undefined}
entering={FadeIn.duration(160)}
className="px-[14px] pb-2.5"
entering={COMPOSER_ATTACHMENT_ENTERING}
exiting={FadeOut.duration(120)}
>
<ComposerAttachmentStrip
@@ -178,6 +178,10 @@ import {
import { MARKDOWN_IMAGE_MAX_WIDTH, resolveMarkdownImageDisplaySize } from "./markdownImageSize";
const WIDE_MARKDOWN_BLOCK_OPTIONS = {
// Native iOS blockquotes and adjacent selectable text are separate layout
// chunks. Giving their shrink-to-fit bubble a definite width keeps both
// chunks measured against the width at which UIKit draws them.
includeBlockquotes: Platform.OS === "ios",
includeOrderedLists: Platform.OS === "android",
} as const;
@@ -41,6 +41,14 @@ describe("hasWideMarkdownBlock", () => {
);
});
it("detects blockquotes only when the native renderer needs width pinning", () => {
expect(hasWideMarkdownBlock("> quoted", { includeBlockquotes: true })).toBe(true);
expect(hasWideMarkdownBlock(" > quoted", { includeBlockquotes: true })).toBe(true);
expect(hasWideMarkdownBlock("> quoted")).toBe(false);
expect(hasWideMarkdownBlock("prose > quoted", { includeBlockquotes: true })).toBe(false);
expect(hasWideMarkdownBlock(" > indented code", { includeBlockquotes: true })).toBe(false);
});
it("detects GFM tables", () => {
expect(hasWideMarkdownBlock("| a | b |\n| --- | --- |\n| 1 | 2 |")).toBe(true);
expect(hasWideMarkdownBlock("a | b\n:-- | --:\n1 | 2")).toBe(true);
+11 -2
View File
@@ -1,6 +1,7 @@
/**
* Detects markdown that the JS renderer draws as a block requiring a definite
* user-bubble width — fenced code blocks, GFM tables, and ordered lists.
* Detects markdown that the renderer draws as a block requiring a definite
* user-bubble width: fenced code blocks, GFM tables, ordered lists, and
* blockquotes when requested by the caller.
*
* Fenced code blocks and tables report an intrinsic width equal to their
* widest line, which is effectively unbounded. A user bubble sizes itself
@@ -31,6 +32,7 @@ const BLOCKQUOTE_PREFIX = /^ {0,3}>[ \t]?/;
export interface WideMarkdownBlockOptions {
readonly includeOrderedLists?: boolean;
readonly includeBlockquotes?: boolean;
}
function stripBlockquotePrefixes(line: string): string {
@@ -41,6 +43,10 @@ function stripBlockquotePrefixes(line: string): string {
return content;
}
function hasBlockquote(text: string): boolean {
return text.split("\n").some((line) => BLOCKQUOTE_PREFIX.test(line));
}
function hasOrderedListItem(text: string): boolean {
let previousNonEmptyLine: string | null = null;
@@ -80,6 +86,9 @@ export function hasWideMarkdownBlock(
if (FENCED_CODE_BLOCK.test(text)) {
return true;
}
if (options.includeBlockquotes === true && hasBlockquote(text)) {
return true;
}
if (options.includeOrderedLists !== false && hasOrderedListItem(text)) {
return true;
}