|
@@ -1,5 +1,5 @@
|
1
|
1
|
import * as React from 'react';
|
2
|
|
-import { StyleSheet, View } from 'react-native';
|
|
2
|
+import { StyleSheet, View, ViewProps } from 'react-native';
|
3
|
3
|
import { EdgeInsets, InsetChangedEvent } from './SafeArea.types';
|
4
|
4
|
import NativeSafeAreaView from './NativeSafeAreaView';
|
5
|
5
|
|
|
@@ -53,4 +53,26 @@ export function useSafeArea(): EdgeInsets {
|
53
|
53
|
return safeArea;
|
54
|
54
|
}
|
55
|
55
|
|
|
56
|
+export function SafeAreaView({
|
|
57
|
+ style,
|
|
58
|
+ ...rest
|
|
59
|
+}: ViewProps & { children: React.ReactNode }) {
|
|
60
|
+ const insets = useSafeArea();
|
|
61
|
+
|
|
62
|
+ return (
|
|
63
|
+ <View
|
|
64
|
+ style={[
|
|
65
|
+ {
|
|
66
|
+ paddingTop: insets.top,
|
|
67
|
+ paddingRight: insets.right,
|
|
68
|
+ paddingBottom: insets.bottom,
|
|
69
|
+ paddingLeft: insets.left,
|
|
70
|
+ },
|
|
71
|
+ style,
|
|
72
|
+ ]}
|
|
73
|
+ {...rest}
|
|
74
|
+ />
|
|
75
|
+ );
|
|
76
|
+}
|
|
77
|
+
|
56
|
78
|
export type EdgeInsets = EdgeInsets;
|