@hoddy-ui/core 2.5.12 → 2.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "react-native";
|
|
9
9
|
import { ScaledSheet } from "react-native-size-matters";
|
|
10
10
|
import { FormWrapperProps } from "../types";
|
|
11
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
11
12
|
export const FormWrapper: React.FC<FormWrapperProps> = ({
|
|
12
13
|
children,
|
|
13
14
|
behavior = Platform.OS === "ios" ? "padding" : "height",
|
|
@@ -17,6 +18,9 @@ export const FormWrapper: React.FC<FormWrapperProps> = ({
|
|
|
17
18
|
style = {},
|
|
18
19
|
onScroll,
|
|
19
20
|
}) => {
|
|
21
|
+
const { bottom } = useSafeAreaInsets();
|
|
22
|
+
|
|
23
|
+
const defaultOffset = Platform.OS === "ios" ? -bottom : -bottom * 2;
|
|
20
24
|
const styles = ScaledSheet.create({
|
|
21
25
|
root: {
|
|
22
26
|
width: "100%",
|
|
@@ -24,13 +28,14 @@ export const FormWrapper: React.FC<FormWrapperProps> = ({
|
|
|
24
28
|
...style,
|
|
25
29
|
},
|
|
26
30
|
});
|
|
31
|
+
|
|
27
32
|
return mode === "static" ? (
|
|
28
33
|
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
|
|
29
34
|
<KeyboardAvoidingView
|
|
30
35
|
style={styles.root}
|
|
31
36
|
behavior={behavior}
|
|
32
37
|
contentContainerStyle={styles.root}
|
|
33
|
-
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
38
|
+
keyboardVerticalOffset={keyboardVerticalOffset || defaultOffset}
|
|
34
39
|
>
|
|
35
40
|
{children}
|
|
36
41
|
</KeyboardAvoidingView>
|
|
@@ -39,7 +44,7 @@ export const FormWrapper: React.FC<FormWrapperProps> = ({
|
|
|
39
44
|
<KeyboardAvoidingView
|
|
40
45
|
behavior={behavior}
|
|
41
46
|
style={styles.root}
|
|
42
|
-
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
47
|
+
keyboardVerticalOffset={keyboardVerticalOffset || defaultOffset}
|
|
43
48
|
>
|
|
44
49
|
<ScrollView
|
|
45
50
|
onScroll={onScroll}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import { SafeAreaView as Safe } from "react-native-safe-area-context";
|
|
2
1
|
import React from "react";
|
|
2
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { moderateScale } from "react-native-size-matters";
|
|
4
|
+
import { StyleSheet, View } from "react-native";
|
|
6
5
|
import { SafeAreaViewProps } from "../types";
|
|
7
6
|
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated This component is deprecated. Please use the SafeAreaView from react-native-safe-area-context instead.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const styles = StyleSheet.create({
|
|
13
|
-
droidSafeArea: {
|
|
14
|
-
flex: 1,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
7
|
export const SafeAreaView: React.FC<SafeAreaViewProps> = ({
|
|
19
8
|
children,
|
|
20
9
|
style,
|
|
21
10
|
}) => {
|
|
22
|
-
|
|
11
|
+
const { top, bottom } = useSafeAreaInsets();
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
root: {
|
|
14
|
+
paddingTop: top,
|
|
15
|
+
paddingBottom: bottom,
|
|
16
|
+
flex: 1,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return <View style={[styles.root, style]}>{children}</View>;
|
|
23
20
|
};
|