|
1 | | -import { Text, View } from 'react-native'; |
2 | | -import { fetchStatusBarHeight } from '@logicwind/react-native-status-bar-height'; |
| 1 | +import { View, Text, StyleSheet } from 'react-native'; |
| 2 | +import { |
| 3 | + fetchBottomInset, |
| 4 | + fetchStatusBarHeight, |
| 5 | +} from '@logicwind/react-native-status-bar-height'; |
3 | 6 |
|
4 | | -export default function App() { |
5 | | - const height = fetchStatusBarHeight(); |
| 7 | +const App = () => { |
| 8 | + const statusBarHeight = fetchStatusBarHeight(); |
| 9 | + const bottomInset = fetchBottomInset(); |
6 | 10 |
|
7 | 11 | return ( |
8 | | - <View style={{ marginTop: height }}> |
9 | | - <Text>Status Bar Height: {height}</Text> |
| 12 | + <View style={styles.container}> |
| 13 | + <View style={[styles.header, { marginTop: statusBarHeight }]}> |
| 14 | + <Text style={styles.label}>Status Bar Height: {statusBarHeight}px</Text> |
| 15 | + </View> |
| 16 | + |
| 17 | + <View style={styles.content}> |
| 18 | + <Text style={styles.title}>Welcome to the App</Text> |
| 19 | + </View> |
| 20 | + |
| 21 | + <View style={[styles.footer, { marginBottom: bottomInset }]}> |
| 22 | + <Text style={styles.label}>Bottom Inset: {bottomInset}px</Text> |
| 23 | + </View> |
10 | 24 | </View> |
11 | 25 | ); |
12 | | -} |
| 26 | +}; |
| 27 | + |
| 28 | +const styles = StyleSheet.create({ |
| 29 | + container: { |
| 30 | + flex: 1, |
| 31 | + backgroundColor: '#4B7BE5', |
| 32 | + }, |
| 33 | + header: { |
| 34 | + alignItems: 'center', |
| 35 | + backgroundColor: '#f5f5f5', |
| 36 | + }, |
| 37 | + content: { |
| 38 | + flex: 1, |
| 39 | + alignItems: 'center', |
| 40 | + justifyContent: 'center', |
| 41 | + backgroundColor: '#f5f5f5', |
| 42 | + }, |
| 43 | + footer: { |
| 44 | + alignItems: 'center', |
| 45 | + backgroundColor: '#f5f5f5', |
| 46 | + }, |
| 47 | + label: { |
| 48 | + fontSize: 16, |
| 49 | + }, |
| 50 | + title: { |
| 51 | + fontSize: 20, |
| 52 | + fontWeight: '600', |
| 53 | + }, |
| 54 | +}); |
| 55 | + |
| 56 | +export default App; |
0 commit comments