Ipad适配问题
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { Platform, StyleSheet } from 'react-native';
|
||||
import { Platform, StyleSheet, useWindowDimensions } from 'react-native';
|
||||
|
||||
import EditScreenInfo from '@/components/EditScreenInfo';
|
||||
import { Text, View } from '@/components/Themed';
|
||||
import { clampContentWidth, isIPadLike } from '@/src/utils/device';
|
||||
|
||||
export default function ModalScreen() {
|
||||
const { width, height } = useWindowDimensions();
|
||||
const isTablet = isIPadLike(width, height);
|
||||
const contentWidth = isTablet ? clampContentWidth(width, 700, 24) : undefined;
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>Modal</Text>
|
||||
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
|
||||
<EditScreenInfo path="app/modal.tsx" />
|
||||
<View style={[styles.contentWrap, contentWidth ? { width: contentWidth } : null]}>
|
||||
<Text style={styles.title}>Modal</Text>
|
||||
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
|
||||
<EditScreenInfo path="app/modal.tsx" />
|
||||
</View>
|
||||
|
||||
{/* Use a light status bar on iOS to account for the black space above the modal */}
|
||||
<StatusBar style={Platform.OS === 'ios' ? 'light' : 'auto'} />
|
||||
@@ -22,6 +29,12 @@ const styles = StyleSheet.create({
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: '100%',
|
||||
alignSelf: 'stretch',
|
||||
},
|
||||
contentWrap: {
|
||||
width: '100%',
|
||||
alignItems: 'center',
|
||||
},
|
||||
title: {
|
||||
fontSize: 20,
|
||||
|
||||
Reference in New Issue
Block a user