@momo-kits/foundation 0.92.27 → 0.92.29
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/Application/BottomSheet.tsx +25 -21
- package/Application/types.ts +1 -0
- package/Input/InputOTP.tsx +2 -1
- package/package.json +1 -1
- package/verify.js +7 -7
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {useRef, useEffect, useCallback, useContext} from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
4
|
Dimensions,
|
|
5
5
|
KeyboardAvoidingView,
|
|
6
|
-
Modal,
|
|
7
6
|
PanResponder,
|
|
8
7
|
Platform,
|
|
9
8
|
StyleSheet,
|
|
10
9
|
TouchableOpacity,
|
|
11
10
|
View,
|
|
11
|
+
Modal,
|
|
12
12
|
} from 'react-native';
|
|
13
|
+
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
13
14
|
import {ApplicationContext} from './index';
|
|
14
15
|
import {BottomSheetParams} from './types';
|
|
15
|
-
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
16
16
|
import {Colors, Radius, Spacing, Styles} from '../Consts';
|
|
17
17
|
import {Text} from '../Text';
|
|
18
18
|
import {Icon} from '../Icon';
|
|
@@ -24,6 +24,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
24
24
|
const {
|
|
25
25
|
screen: Screen,
|
|
26
26
|
options,
|
|
27
|
+
useNativeModal = false,
|
|
27
28
|
surface,
|
|
28
29
|
barrierDismissible = false,
|
|
29
30
|
draggable = true,
|
|
@@ -36,6 +37,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
36
37
|
x: 0,
|
|
37
38
|
})
|
|
38
39
|
).current;
|
|
40
|
+
|
|
39
41
|
const panResponder = useRef(
|
|
40
42
|
PanResponder.create({
|
|
41
43
|
onStartShouldSetPanResponder: () => draggable,
|
|
@@ -61,7 +63,10 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
61
63
|
},
|
|
62
64
|
})
|
|
63
65
|
).current;
|
|
64
|
-
|
|
66
|
+
let Container: any = View;
|
|
67
|
+
if (useNativeModal) {
|
|
68
|
+
Container = Modal;
|
|
69
|
+
}
|
|
65
70
|
let backgroundColor = theme.colors.background.default;
|
|
66
71
|
if (surface) {
|
|
67
72
|
backgroundColor = theme.colors.background.surface;
|
|
@@ -74,7 +79,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
74
79
|
Animated.timing(pan, {
|
|
75
80
|
toValue: {x: 0, y: 0},
|
|
76
81
|
useNativeDriver: false,
|
|
77
|
-
duration:
|
|
82
|
+
duration: 150,
|
|
78
83
|
}).start();
|
|
79
84
|
return () => {
|
|
80
85
|
props.route.params?.onDismiss?.();
|
|
@@ -88,18 +93,20 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
88
93
|
if (barrierDismissible && !force) {
|
|
89
94
|
return;
|
|
90
95
|
}
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
callback?.();
|
|
98
|
+
}, 300);
|
|
91
99
|
Animated.timing(pan, {
|
|
92
100
|
toValue: {x: 0, y: heightDevice},
|
|
93
101
|
useNativeDriver: false,
|
|
94
102
|
duration: 200,
|
|
95
103
|
}).start(() => {
|
|
96
104
|
navigator?.pop();
|
|
97
|
-
callback?.();
|
|
98
105
|
});
|
|
99
106
|
};
|
|
100
107
|
|
|
101
108
|
/**
|
|
102
|
-
*
|
|
109
|
+
* on request close
|
|
103
110
|
*/
|
|
104
111
|
const onRequestClose = useCallback((callback?: () => void) => {
|
|
105
112
|
onDismiss(true, callback);
|
|
@@ -146,7 +153,11 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
146
153
|
}, []);
|
|
147
154
|
|
|
148
155
|
return (
|
|
149
|
-
<
|
|
156
|
+
<Container
|
|
157
|
+
transparent
|
|
158
|
+
visible={true}
|
|
159
|
+
onRequestClose={() => onDismiss()}
|
|
160
|
+
style={styles.overlay}>
|
|
150
161
|
<KeyboardAvoidingView
|
|
151
162
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
152
163
|
keyboardVerticalOffset={keyboardVerticalOffset ?? -20}
|
|
@@ -170,23 +181,14 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
170
181
|
</View>
|
|
171
182
|
</Animated.View>
|
|
172
183
|
</KeyboardAvoidingView>
|
|
173
|
-
</
|
|
184
|
+
</Container>
|
|
174
185
|
);
|
|
175
186
|
};
|
|
176
187
|
|
|
177
|
-
export default BottomSheet;
|
|
178
|
-
|
|
179
188
|
const styles = StyleSheet.create({
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
overflow: 'hidden',
|
|
184
|
-
borderTopLeftRadius: Radius.M,
|
|
185
|
-
borderTopRightRadius: Radius.M,
|
|
186
|
-
},
|
|
187
|
-
draggableContainer: {
|
|
188
|
-
width: '100%',
|
|
189
|
-
alignItems: 'center',
|
|
189
|
+
overlay: {
|
|
190
|
+
...StyleSheet.absoluteFillObject,
|
|
191
|
+
justifyContent: 'flex-end',
|
|
190
192
|
},
|
|
191
193
|
indicator: {
|
|
192
194
|
width: 40,
|
|
@@ -210,3 +212,5 @@ const styles = StyleSheet.create({
|
|
|
210
212
|
marginHorizontal: Spacing.M,
|
|
211
213
|
},
|
|
212
214
|
});
|
|
215
|
+
|
|
216
|
+
export default BottomSheet;
|
package/Application/types.ts
CHANGED
package/Input/InputOTP.tsx
CHANGED
|
@@ -74,6 +74,7 @@ const InputOTP = forwardRef(
|
|
|
74
74
|
placeholder,
|
|
75
75
|
onChangeText,
|
|
76
76
|
onBlur,
|
|
77
|
+
onFocus,
|
|
77
78
|
dataType = 'number',
|
|
78
79
|
params,
|
|
79
80
|
style,
|
|
@@ -215,7 +216,7 @@ const InputOTP = forwardRef(
|
|
|
215
216
|
value={value}
|
|
216
217
|
onChangeText={_onChangeText}
|
|
217
218
|
keyboardType={dataType === 'number' ? 'number-pad' : 'default'}
|
|
218
|
-
onFocus={
|
|
219
|
+
onFocus={onFocus}
|
|
219
220
|
onBlur={onBlurInput}
|
|
220
221
|
style={{opacity: 0}}
|
|
221
222
|
selectionColor={theme.colors.primary}
|
package/package.json
CHANGED
package/verify.js
CHANGED
|
@@ -3,14 +3,14 @@ const path = require('path');
|
|
|
3
3
|
|
|
4
4
|
try {
|
|
5
5
|
const packageInfo = JSON.parse(
|
|
6
|
-
fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8')
|
|
6
|
+
fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8')
|
|
7
7
|
);
|
|
8
8
|
const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
|
|
9
9
|
|
|
10
10
|
const app = path.join(`${__dirname}/../../../`, 'app.json');
|
|
11
11
|
const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
|
|
12
12
|
|
|
13
|
-
if (!fs.existsSync(app) || fs.existsSync(miniJson)) {
|
|
13
|
+
if (!fs.existsSync(app) || !fs.existsSync(miniJson)) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -22,10 +22,10 @@ try {
|
|
|
22
22
|
|
|
23
23
|
if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
|
|
24
24
|
console.error(
|
|
25
|
-
`Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}
|
|
25
|
+
`Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
|
|
26
26
|
);
|
|
27
27
|
throw new Error(
|
|
28
|
-
`Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}
|
|
28
|
+
`Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -35,13 +35,13 @@ try {
|
|
|
35
35
|
packageInfo?.version
|
|
36
36
|
) {
|
|
37
37
|
console.error(
|
|
38
|
-
`Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}
|
|
38
|
+
`Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`
|
|
39
39
|
);
|
|
40
40
|
throw new Error(
|
|
41
|
-
`Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}
|
|
41
|
+
`Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
} catch (error) {
|
|
45
45
|
console.error(`Installation failed: ${error.message}`);
|
|
46
|
-
process.exit(
|
|
46
|
+
process.exit(0);
|
|
47
47
|
}
|