@tecsinapse/react-native-kit 4.0.0-beta.7 → 4.0.0-beta.9
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.
|
@@ -17,7 +17,7 @@ const ModalView = ({
|
|
|
17
17
|
BoxComponent = reactCore.BoxContent,
|
|
18
18
|
frozen,
|
|
19
19
|
isLastShown,
|
|
20
|
-
isRaiseKeyboard
|
|
20
|
+
isRaiseKeyboard,
|
|
21
21
|
showCloseBar = true,
|
|
22
22
|
close,
|
|
23
23
|
onClose
|
|
@@ -30,6 +30,15 @@ const ModalView = ({
|
|
|
30
30
|
const translationCarrier = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
31
31
|
const opacityCarrier = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
32
32
|
const offset = isLastShown && keyboardOpened > 0 ? 0 : bottom;
|
|
33
|
+
const getKeyboardHeight = (keyboard) => {
|
|
34
|
+
if (keyboard === 0) return 0;
|
|
35
|
+
const wHeight = Math.ceil(reactNative.Dimensions.get("window").height);
|
|
36
|
+
const sHeight = Math.ceil(reactNative.Dimensions.get("screen").height);
|
|
37
|
+
if (wHeight !== sHeight) {
|
|
38
|
+
return keyboard + (sHeight - wHeight - (reactNative.StatusBar.currentHeight || 0));
|
|
39
|
+
}
|
|
40
|
+
return keyboard;
|
|
41
|
+
};
|
|
33
42
|
const show = React.useCallback(() => {
|
|
34
43
|
reactNative.Animated.sequence([
|
|
35
44
|
reactNative.Animated.timing(backgroundCarrier, {
|
|
@@ -114,19 +123,17 @@ const ModalView = ({
|
|
|
114
123
|
hideEvent.remove();
|
|
115
124
|
};
|
|
116
125
|
}, []);
|
|
117
|
-
const viewStyle = React.useMemo(
|
|
118
|
-
() => [
|
|
119
|
-
{
|
|
120
|
-
opacity: opacityCarrier,
|
|
121
|
-
transform: [{ translateY: translationCarrier }]
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
[opacityCarrier, translationCarrier, isLastShown, isRaiseKeyboard, keyboardOpened]
|
|
125
|
-
);
|
|
126
126
|
return /* @__PURE__ */ jsxRuntime.jsx(styled.StyledPressableBackDrop, { onPress: !frozen ? close : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(styled.BackDropView, { style: { backgroundColor: backgroundInterpolation }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
127
127
|
reactNative.Animated.View,
|
|
128
128
|
{
|
|
129
|
-
style:
|
|
129
|
+
style: {
|
|
130
|
+
...isLastShown && isRaiseKeyboard && {
|
|
131
|
+
paddingBottom: getKeyboardHeight(keyboardOpened)
|
|
132
|
+
},
|
|
133
|
+
...!isLastShown && isRaiseKeyboard && { paddingBottom: 0 },
|
|
134
|
+
opacity: opacityCarrier,
|
|
135
|
+
transform: [{ translateY: translationCarrier }]
|
|
136
|
+
},
|
|
130
137
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
131
138
|
BoxComponent,
|
|
132
139
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { BoxContent } from '@tecsinapse/react-core';
|
|
3
|
-
import { useState, useRef, useCallback, useEffect
|
|
4
|
-
import { Animated, Easing, Keyboard, Pressable } from 'react-native';
|
|
3
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
4
|
+
import { Animated, Easing, Keyboard, Pressable, Dimensions, StatusBar } from 'react-native';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
import { StyledPressableBackDrop, BackDropView, CloseBar } from './styled.js';
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ const ModalView = ({
|
|
|
15
15
|
BoxComponent = BoxContent,
|
|
16
16
|
frozen,
|
|
17
17
|
isLastShown,
|
|
18
|
-
isRaiseKeyboard
|
|
18
|
+
isRaiseKeyboard,
|
|
19
19
|
showCloseBar = true,
|
|
20
20
|
close,
|
|
21
21
|
onClose
|
|
@@ -28,6 +28,15 @@ const ModalView = ({
|
|
|
28
28
|
const translationCarrier = useRef(new Animated.Value(0)).current;
|
|
29
29
|
const opacityCarrier = useRef(new Animated.Value(0)).current;
|
|
30
30
|
const offset = isLastShown && keyboardOpened > 0 ? 0 : bottom;
|
|
31
|
+
const getKeyboardHeight = (keyboard) => {
|
|
32
|
+
if (keyboard === 0) return 0;
|
|
33
|
+
const wHeight = Math.ceil(Dimensions.get("window").height);
|
|
34
|
+
const sHeight = Math.ceil(Dimensions.get("screen").height);
|
|
35
|
+
if (wHeight !== sHeight) {
|
|
36
|
+
return keyboard + (sHeight - wHeight - (StatusBar.currentHeight || 0));
|
|
37
|
+
}
|
|
38
|
+
return keyboard;
|
|
39
|
+
};
|
|
31
40
|
const show = useCallback(() => {
|
|
32
41
|
Animated.sequence([
|
|
33
42
|
Animated.timing(backgroundCarrier, {
|
|
@@ -112,19 +121,17 @@ const ModalView = ({
|
|
|
112
121
|
hideEvent.remove();
|
|
113
122
|
};
|
|
114
123
|
}, []);
|
|
115
|
-
const viewStyle = useMemo(
|
|
116
|
-
() => [
|
|
117
|
-
{
|
|
118
|
-
opacity: opacityCarrier,
|
|
119
|
-
transform: [{ translateY: translationCarrier }]
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
[opacityCarrier, translationCarrier, isLastShown, isRaiseKeyboard, keyboardOpened]
|
|
123
|
-
);
|
|
124
124
|
return /* @__PURE__ */ jsx(StyledPressableBackDrop, { onPress: !frozen ? close : void 0, children: /* @__PURE__ */ jsx(BackDropView, { style: { backgroundColor: backgroundInterpolation }, children: /* @__PURE__ */ jsx(
|
|
125
125
|
Animated.View,
|
|
126
126
|
{
|
|
127
|
-
style:
|
|
127
|
+
style: {
|
|
128
|
+
...isLastShown && isRaiseKeyboard && {
|
|
129
|
+
paddingBottom: getKeyboardHeight(keyboardOpened)
|
|
130
|
+
},
|
|
131
|
+
...!isLastShown && isRaiseKeyboard && { paddingBottom: 0 },
|
|
132
|
+
opacity: opacityCarrier,
|
|
133
|
+
transform: [{ translateY: translationCarrier }]
|
|
134
|
+
},
|
|
128
135
|
children: /* @__PURE__ */ jsx(Pressable, { children: /* @__PURE__ */ jsxs(
|
|
129
136
|
BoxComponent,
|
|
130
137
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/react-native-kit",
|
|
3
3
|
"description": "React Native components library",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.9",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"react-native-safe-area-context": "^4.0.0",
|
|
41
41
|
"react-native-vector-icons": "^9.2.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "d6e1ad27b33a230565729b2e625a0967b9aa686b"
|
|
44
44
|
}
|