Constraint video max height to 14/9 (#8611)
* constraint video max height to 14/9 * Apply new default to web video embed too * Retain web handling * Rename prop for clarity * Align no-crop handling on native/web * make it always constrained --------- Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -21,9 +21,11 @@ export function ConstrainedImage({
|
||||
aspectRatio,
|
||||
fullBleed,
|
||||
children,
|
||||
minMobileAspectRatio,
|
||||
}: {
|
||||
aspectRatio: number
|
||||
fullBleed?: boolean
|
||||
minMobileAspectRatio?: number
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const t = useTheme()
|
||||
@@ -35,10 +37,10 @@ export function ConstrainedImage({
|
||||
const outerAspectRatio = React.useMemo<DimensionValue>(() => {
|
||||
const ratio =
|
||||
isNative || !gtMobile
|
||||
? Math.min(1 / aspectRatio, 16 / 9) // 9:16 bounding box
|
||||
? Math.min(1 / aspectRatio, minMobileAspectRatio ?? 16 / 9) // 9:16 bounding box
|
||||
: Math.min(1 / aspectRatio, 1) // 1:1 bounding box
|
||||
return `${ratio * 100}%`
|
||||
}, [aspectRatio, gtMobile])
|
||||
}, [aspectRatio, gtMobile, minMobileAspectRatio])
|
||||
|
||||
return (
|
||||
<View style={[a.w_full]}>
|
||||
|
||||
Reference in New Issue
Block a user