Skip to content

Commit d718b3f

Browse files
Added bottom inset example
1 parent cfaeafe commit d718b3f

File tree

1 file changed

+51
-7
lines changed

1 file changed

+51
-7
lines changed

example/src/App.tsx

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,56 @@
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';
36

4-
export default function App() {
5-
const height = fetchStatusBarHeight();
7+
const App = () => {
8+
const statusBarHeight = fetchStatusBarHeight();
9+
const bottomInset = fetchBottomInset();
610

711
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>
1024
</View>
1125
);
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

Comments
 (0)