The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): iOS video previews keep their contain fit instead of sometimes cropping (#37186)
Julius Marminge committed
Nov 15, 2026 at 05:30 UTC
d21d8d8b5df7ce2f07d27df05a410f9fcaf37f37
1 file changed
+8
-3
apps/mobile/src/components/VideoThumbnailImage.tsx
+8
-3
@@ -4,6 +4,7 @@ import { Atom, AsyncResult } from "effect/reactivity";
4
import { Image } from "expo-image";
5
import { useIsFocused } from "@react-navigation/native";
6
import type { VideoThumbnail } from "expo-video";
7
+import { useState } from "react";
8
import { StyleSheet } from "react-native";
9
10
import type { DraftComposerFileAttachment } from "../lib/composerImages";
@@ -49,13 +50,17 @@ export function VideoThumbnailImage(props: {
50
const thumbnail =
51
(loaded._tag === "Success" ? loaded.value : null) ?? cachedVideoThumbnail(cacheKey);
52
52
- return thumbnail ? (
53
+ // iOS draws a frame object the moment its prop is set, with the contentFit the view has then,
54
+ // and a later contentFit never refits it. Send the frame after mount so contentFit is set first.
55
+ const [laidOut, setLaidOut] = useState(false);
56
+ return (
57
<Image
54
- source={thumbnail}
58
+ onLayout={() => setLaidOut(true)}
59
+ source={laidOut ? thumbnail : null}
60
style={StyleSheet.absoluteFill}
61
contentFit={props.contentFit ?? "cover"}
62
recyclingKey={cacheKey}
63
accessible={false}
64
/>
60
- ) : null;
65
+ );
66
}