@momo-kits/suggest-action 0.0.62-alpha.6 → 0.0.62-beta.10
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/index.js +28 -52
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -5,32 +5,25 @@ import {
|
|
|
5
5
|
IconSource,
|
|
6
6
|
Image,
|
|
7
7
|
ScaleSize,
|
|
8
|
-
Shadow,
|
|
9
8
|
Spacing,
|
|
10
9
|
Text,
|
|
11
10
|
TouchableOpacity,
|
|
12
|
-
} from '@momo-kits/core
|
|
13
|
-
import React
|
|
14
|
-
|
|
15
|
-
useEffect,
|
|
16
|
-
useImperativeHandle,
|
|
17
|
-
useRef,
|
|
18
|
-
} from 'react';
|
|
19
|
-
import { Animated, StyleSheet, View } from 'react-native';
|
|
11
|
+
} from '@momo-kits/core';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { StyleSheet, View } from 'react-native';
|
|
20
14
|
import ExpenseI18n from './ExpenseI18n';
|
|
21
15
|
|
|
22
|
-
export default SuggestAction =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
export default SuggestAction = ({
|
|
17
|
+
icon,
|
|
18
|
+
name,
|
|
19
|
+
buttonTitle = 'Thêm ngay',
|
|
20
|
+
onPressButton,
|
|
21
|
+
onPressClose,
|
|
22
|
+
iconTintColor,
|
|
23
|
+
visible = false,
|
|
24
|
+
style,
|
|
25
|
+
contentType = 'add',
|
|
26
|
+
}) => {
|
|
34
27
|
const getContent = (contentType) => {
|
|
35
28
|
switch (contentType) {
|
|
36
29
|
case 'add':
|
|
@@ -50,37 +43,12 @@ export default SuggestAction = forwardRef((props, ref) => {
|
|
|
50
43
|
};
|
|
51
44
|
}
|
|
52
45
|
};
|
|
53
|
-
const fadeAnimation = useRef(new Animated.Value(0)).current;
|
|
54
46
|
|
|
55
47
|
const contentStart = getContent(contentType).start;
|
|
56
48
|
const contentEnd = getContent(contentType).end;
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
toValue: 1,
|
|
61
|
-
duration: 100,
|
|
62
|
-
useNativeDriver: true,
|
|
63
|
-
}).start();
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const hide = () => {
|
|
67
|
-
Animated.timing(fadeAnimation, {
|
|
68
|
-
toValue: 0,
|
|
69
|
-
useNativeDriver: true,
|
|
70
|
-
duration: 100,
|
|
71
|
-
}).start();
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
useImperativeHandle(ref, () => ({ show, hide }), []);
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<Animated.View
|
|
78
|
-
style={[
|
|
79
|
-
styles.container,
|
|
80
|
-
style,
|
|
81
|
-
Shadow.Light,
|
|
82
|
-
{ opacity: fadeAnimation },
|
|
83
|
-
]}>
|
|
50
|
+
return visible ? (
|
|
51
|
+
<View style={[styles.container, style]}>
|
|
84
52
|
{icon && (
|
|
85
53
|
<Image
|
|
86
54
|
source={icon}
|
|
@@ -88,6 +56,7 @@ export default SuggestAction = forwardRef((props, ref) => {
|
|
|
88
56
|
tintColor={iconTintColor}
|
|
89
57
|
/>
|
|
90
58
|
)}
|
|
59
|
+
<View></View>
|
|
91
60
|
<Text style={styles.description} numberOfLines={2}>
|
|
92
61
|
{contentStart}{' '}
|
|
93
62
|
<Text style={[styles.description, { fontWeight: 'bold' }]}>
|
|
@@ -109,9 +78,9 @@ export default SuggestAction = forwardRef((props, ref) => {
|
|
|
109
78
|
style={styles.iconClose}
|
|
110
79
|
/>
|
|
111
80
|
</TouchableOpacity>
|
|
112
|
-
</
|
|
113
|
-
);
|
|
114
|
-
}
|
|
81
|
+
</View>
|
|
82
|
+
) : null;
|
|
83
|
+
};
|
|
115
84
|
|
|
116
85
|
const styles = StyleSheet.create({
|
|
117
86
|
container: {
|
|
@@ -121,7 +90,14 @@ const styles = StyleSheet.create({
|
|
|
121
90
|
paddingVertical: ScaleSize(14),
|
|
122
91
|
borderRadius: Spacing.S,
|
|
123
92
|
backgroundColor: Colors.white,
|
|
124
|
-
|
|
93
|
+
shadowColor: Colors.black,
|
|
94
|
+
shadowOffset: {
|
|
95
|
+
width: 0,
|
|
96
|
+
height: 4,
|
|
97
|
+
},
|
|
98
|
+
shadowOpacity: 0.3,
|
|
99
|
+
shadowRadius: 4.65,
|
|
100
|
+
elevation: 8,
|
|
125
101
|
flexDirection: 'row',
|
|
126
102
|
alignItems: 'center',
|
|
127
103
|
position: 'absolute',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/suggest-action",
|
|
3
|
-
"version": "0.0.62-
|
|
3
|
+
"version": "0.0.62-beta.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {},
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"prop-types": "^15.7.2",
|
|
10
10
|
"react": "16.9.0",
|
|
11
11
|
"react-native": ">=0.55",
|
|
12
|
-
"@momo-kits/core
|
|
12
|
+
"@momo-kits/core": ">=0.0.5-beta"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {},
|
|
15
15
|
"license": "MoMo"
|