static aspectRatio
This commit is contained in:
@@ -24,7 +24,6 @@ export function NeueChar() {
|
|||||||
const nuxDialogs = useNuxDialogContext()
|
const nuxDialogs = useNuxDialogContext()
|
||||||
const control = Dialog.useDialogControl()
|
const control = Dialog.useDialogControl()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const [height, setHeight] = React.useState(0)
|
|
||||||
|
|
||||||
Dialog.useAutoOpen(control, 3e3)
|
Dialog.useAutoOpen(control, 3e3)
|
||||||
|
|
||||||
@@ -37,17 +36,14 @@ export function NeueChar() {
|
|||||||
<Dialog.Inner
|
<Dialog.Inner
|
||||||
label={_(msg`Special announcement dialog for April Fool's day 2025`)}>
|
label={_(msg`Special announcement dialog for April Fool's day 2025`)}>
|
||||||
<View
|
<View
|
||||||
onLayout={e => {
|
|
||||||
setHeight(e.nativeEvent.layout.height)
|
|
||||||
}}
|
|
||||||
style={[
|
style={[
|
||||||
a.absolute,
|
a.absolute,
|
||||||
a.inset_0,
|
a.inset_0,
|
||||||
a.overflow_hidden,
|
a.overflow_hidden,
|
||||||
{
|
{
|
||||||
backgroundColor: 'black',
|
|
||||||
bottom: 'auto',
|
bottom: 'auto',
|
||||||
paddingTop: gtMobile ? '42%' : '60%',
|
aspectRatio: gtMobile ? 1 / 0.42 : 1 / 0.6,
|
||||||
|
backgroundColor: 'black',
|
||||||
borderTopLeftRadius: a.rounded_md.borderRadius,
|
borderTopLeftRadius: a.rounded_md.borderRadius,
|
||||||
borderTopRightRadius: a.rounded_md.borderRadius,
|
borderTopRightRadius: a.rounded_md.borderRadius,
|
||||||
},
|
},
|
||||||
@@ -74,17 +70,14 @@ export function NeueChar() {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View
|
{/* approx the height of the main image - not quite accurate,
|
||||||
style={[
|
since the image excludes the padding. but if you inspect element,
|
||||||
{
|
it turns out to be close enough */}
|
||||||
paddingTop: height - a.pt_2xl.paddingTop, // dialog padding
|
<View style={{aspectRatio: gtMobile ? 1 / 0.42 : 1 / 0.6}} />
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
gtMobile ? [a.py_3xl, a.pb_md] : [a.pt_xl, a.pb_sm],
|
gtMobile ? [a.py_3xl, a.pb_md] : [a.pt_2xl, a.pb_sm],
|
||||||
a.mx_auto,
|
a.mx_auto,
|
||||||
{maxWidth: 360},
|
{maxWidth: 360},
|
||||||
]}>
|
]}>
|
||||||
|
|||||||
Reference in New Issue
Block a user