@momo-kits/foundation 0.111.1-beta.2 → 0.111.1-beta.4

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.
@@ -1,6 +1,7 @@
1
1
  import React, {useContext, useEffect, useRef} from 'react';
2
2
  import {
3
3
  Animated,
4
+ Easing,
4
5
  KeyboardAvoidingView,
5
6
  Platform,
6
7
  Pressable,
@@ -38,11 +39,13 @@ const Modal: React.FC<ModalParams> = props => {
38
39
  Animated.parallel([
39
40
  Animated.timing(opacity, {
40
41
  toValue: 1,
41
- duration: 400,
42
+ duration: 250,
42
43
  useNativeDriver: true,
43
44
  }),
44
- Animated.spring(scale, {
45
+ Animated.timing(scale, {
45
46
  toValue: 1,
47
+ duration: 250,
48
+ easing: Easing.bezier(0.2, 0.0, 0, 1.0),
46
49
  useNativeDriver: true,
47
50
  }),
48
51
  ]).start();
@@ -52,7 +55,7 @@ const Modal: React.FC<ModalParams> = props => {
52
55
  };
53
56
  }, [opacity, scale]);
54
57
 
55
- const onDismiss = () => {
58
+ const onDismiss = (callback = () => {}) => {
56
59
  if (barrierDismissible) {
57
60
  return;
58
61
  }
@@ -65,9 +68,11 @@ const Modal: React.FC<ModalParams> = props => {
65
68
  Animated.timing(scale, {
66
69
  toValue: 0.8,
67
70
  duration: 200,
71
+ easing: Easing.linear,
68
72
  useNativeDriver: true,
69
73
  }),
70
74
  ]).start(() => {
75
+ callback();
71
76
  navigator?.pop();
72
77
  });
73
78
  };
@@ -76,7 +81,9 @@ const Modal: React.FC<ModalParams> = props => {
76
81
  <KeyboardAvoidingView
77
82
  style={Styles.flexCenter}
78
83
  behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
79
- <Pressable style={StyleSheet.absoluteFillObject} onPress={onDismiss}>
84
+ <Pressable
85
+ style={StyleSheet.absoluteFillObject}
86
+ onPress={() => onDismiss()}>
80
87
  <Animated.View style={[styles.overlayContent, {opacity}]} />
81
88
  </Pressable>
82
89
  <Animated.View
@@ -87,7 +94,7 @@ const Modal: React.FC<ModalParams> = props => {
87
94
  },
88
95
  modalStyle,
89
96
  ]}>
90
- <Component {...params} />
97
+ <Component {...params} onRequestClose={onDismiss} />
91
98
  </Animated.View>
92
99
  </KeyboardAvoidingView>
93
100
  );
package/Input/Input.tsx CHANGED
@@ -176,13 +176,6 @@ const Input = forwardRef(
176
176
  iconTintColor = disabledColor;
177
177
  }
178
178
 
179
- if (secureTextEntry) {
180
- keyboardType = Platform.select({
181
- ios: 'ascii-capable',
182
- android: 'visible-password',
183
- });
184
- }
185
-
186
179
  return (
187
180
  <View
188
181
  style={[
@@ -24,6 +24,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
24
24
  primary,
25
25
  buttonDirection = 'row',
26
26
  onIconClose,
27
+ onRequestClose,
27
28
  }) => {
28
29
  const context = useContext<any>(MiniAppContext);
29
30
  const {theme, navigator, translate} = useContext(ApplicationContext);
@@ -73,8 +74,12 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
73
74
  * @param callback
74
75
  */
75
76
  const onAction = (callback?: () => void) => {
76
- navigator?.pop();
77
- callback?.();
77
+ if (typeof onRequestClose === 'function') {
78
+ onRequestClose?.(callback);
79
+ } else {
80
+ navigator?.pop();
81
+ callback?.();
82
+ }
78
83
  };
79
84
 
80
85
  /**
@@ -10,6 +10,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
10
10
  id,
11
11
  image,
12
12
  onIconClose,
13
+ onRequestClose,
13
14
  }) => {
14
15
  const context = useContext<any>(MiniAppContext);
15
16
  const {theme, navigator} = useContext(ApplicationContext);
@@ -45,6 +46,19 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
45
46
  };
46
47
  }, []);
47
48
 
49
+ /**
50
+ * on action popup
51
+ * @param callback
52
+ */
53
+ const onAction = (callback?: () => void) => {
54
+ if (typeof onRequestClose === 'function') {
55
+ onRequestClose?.(callback);
56
+ } else {
57
+ navigator?.pop();
58
+ callback?.();
59
+ }
60
+ };
61
+
48
62
  /**
49
63
  * build close action
50
64
  */
@@ -55,8 +69,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
55
69
  accessibilityLabel={'ic_popup_close'}
56
70
  onPress={() => {
57
71
  closeAction.current = 'icon_close';
58
- navigator?.pop();
59
- onIconClose?.();
72
+ onAction(onIconClose);
60
73
  }}
61
74
  style={styles.iconButton}>
62
75
  <View
package/Popup/types.ts CHANGED
@@ -47,6 +47,11 @@ export type PopupNotifyProps = {
47
47
  * `onIconClose`: Optional. A callback function that is called when the close icon in the PopupNotify component is pressed.
48
48
  */
49
49
  onIconClose?: () => void;
50
+
51
+ /**
52
+ * onRequestClose on request close for modal
53
+ */
54
+ onRequestClose?: (callback?: () => void) => void;
50
55
  };
51
56
 
52
57
  export type PopupPromotionProps = {
@@ -64,6 +69,11 @@ export type PopupPromotionProps = {
64
69
  * `onClose`: Optional. A callback function that is called when the PopupPromotion component is closed.
65
70
  */
66
71
  onIconClose?: () => void;
72
+
73
+ /**
74
+ * onRequestClose on request close for modal
75
+ */
76
+ onRequestClose?: (callback?: () => void) => void;
67
77
  };
68
78
 
69
79
  type PopupAction = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.111.1-beta.2",
3
+ "version": "0.111.1-beta.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},