@momo-kits/foundation 0.152.1-beta.1 → 0.152.1-beta.2
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 +1 -0
- package/Application/Components/SearchHeader.tsx +19 -2
- package/Application/ModalScreen.tsx +1 -0
- package/Application/types.ts +1 -0
- package/Assets/lottie_circle_loader.json +1 -0
- package/Button/index.tsx +21 -11
- package/FoundationList/index.tsx +7 -4
- package/Layout/Screen.tsx +3 -1
- package/package.json +3 -2
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Radius, Spacing, Styles } from '../../Consts';
|
|
2
2
|
import { InputRef, InputSearch } from '../../Input';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Animated,
|
|
5
|
+
Dimensions,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
View,
|
|
9
|
+
} from 'react-native';
|
|
4
10
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
5
11
|
import { SearchHeaderProps } from '../types';
|
|
6
12
|
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
@@ -19,8 +25,12 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
|
|
|
19
25
|
) => {
|
|
20
26
|
const { theme, navigator } = useContext(ApplicationContext);
|
|
21
27
|
const context = useContext<any>(MiniAppContext);
|
|
28
|
+
const BACK_WIDTH = 28;
|
|
29
|
+
const { width: screenWidth } = Dimensions.get('window');
|
|
22
30
|
|
|
23
31
|
const animated = useRef(new Animated.Value(0));
|
|
32
|
+
const leftPosition = props?.leftPosition || BACK_WIDTH + 20;
|
|
33
|
+
const headerRightWidth = props?.headerRightWidth || 73;
|
|
24
34
|
|
|
25
35
|
useEffect(() => {
|
|
26
36
|
const listener = animatedValue?.addListener(({ value }) => {
|
|
@@ -69,7 +79,14 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
|
|
|
69
79
|
|
|
70
80
|
return (
|
|
71
81
|
<View style={styles.container}>
|
|
72
|
-
<View
|
|
82
|
+
<View
|
|
83
|
+
style={[
|
|
84
|
+
Styles.flex,
|
|
85
|
+
renderButtons && {
|
|
86
|
+
maxWidth: screenWidth - leftPosition - 12 - headerRightWidth,
|
|
87
|
+
},
|
|
88
|
+
]}
|
|
89
|
+
>
|
|
73
90
|
<Animated.View style={{ backgroundColor, borderRadius: Radius.XL }}>
|
|
74
91
|
<InputSearch
|
|
75
92
|
ref={ref}
|
package/Application/types.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"v":"5.10.2","fr":30,"ip":0,"op":20,"w":100,"h":100,"nm":"Spinner3.1_Refine","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":12,"ty":4,"nm":"loading 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[360]},{"t":20}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.996078431373,0.956862745098,0.980392156863,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[20]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[20],"e":[0]},{"t":20}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[35],"e":[50]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[50],"e":[35]},{"t":20}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":13,"ty":4,"nm":"loading 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[0],"e":[360]},{"t":20}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.98431372549,0.835294117647,0.917647058824,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[0],"e":[20]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[20],"e":[0]},{"t":20}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[35],"e":[50]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[50],"e":[35]},{"t":20}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":14,"ty":4,"nm":"base pink 2","sr":1,"ks":{"o":{"a":0,"k":40,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.996078431373,0.972549019608,0.988235294118,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0}],"markers":[]}
|
package/Button/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
4
|
StyleSheet,
|
|
@@ -17,9 +17,9 @@ import { Text } from '../Text';
|
|
|
17
17
|
import { Typography } from '../Text/types';
|
|
18
18
|
import { Colors, Spacing } from '../Consts';
|
|
19
19
|
import styles from './styles';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
20
|
+
import {Icon} from '../Icon';
|
|
21
|
+
import {Skeleton} from '../Skeleton';
|
|
22
|
+
import LottieView from 'lottie-react-native';
|
|
23
23
|
|
|
24
24
|
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
25
25
|
|
|
@@ -98,6 +98,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
98
98
|
const { theme, config } = useContext(ApplicationContext);
|
|
99
99
|
const skeleton = useContext(SkeletonContext);
|
|
100
100
|
const componentName = 'Button';
|
|
101
|
+
const animationRef = useRef<LottieView>(null);
|
|
101
102
|
|
|
102
103
|
const { componentId } = useComponentId(
|
|
103
104
|
`${componentName}/${title}`,
|
|
@@ -105,6 +106,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
105
106
|
);
|
|
106
107
|
const { gradient, color } = config?.navigationBar?.buttonColors ?? {};
|
|
107
108
|
let gradientPros;
|
|
109
|
+
const isDisabled = type === 'disabled' || loading;
|
|
108
110
|
|
|
109
111
|
if (gradient?.length > 0 && type === 'primary') {
|
|
110
112
|
gradientPros = {
|
|
@@ -247,7 +249,16 @@ const Button: FC<ButtonProps> = ({
|
|
|
247
249
|
|
|
248
250
|
if (loading) {
|
|
249
251
|
return (
|
|
250
|
-
<
|
|
252
|
+
<LottieView
|
|
253
|
+
ref={animationRef}
|
|
254
|
+
source={require('../Assets/lottie_circle_loader.json')}
|
|
255
|
+
autoPlay
|
|
256
|
+
loop
|
|
257
|
+
colorFilters={[
|
|
258
|
+
{ keypath: 'loading 2.Ellipse 1.Stroke 1', color: textColor },
|
|
259
|
+
{ keypath: 'loading 3.Ellipse 1.Stroke 1', color: textColor },
|
|
260
|
+
{ keypath: 'base pink 2.Ellipse 1.Stroke 1', color: textColor },
|
|
261
|
+
]}
|
|
251
262
|
style={[
|
|
252
263
|
styles.trailing,
|
|
253
264
|
{
|
|
@@ -257,9 +268,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
257
268
|
borderRadius: Spacing.M,
|
|
258
269
|
},
|
|
259
270
|
]}
|
|
260
|
-
|
|
261
|
-
<Loader type="spinner" color={getTextColor()} />
|
|
262
|
-
</View>
|
|
271
|
+
/>
|
|
263
272
|
);
|
|
264
273
|
}
|
|
265
274
|
if (iconLeft) {
|
|
@@ -301,7 +310,8 @@ const Button: FC<ButtonProps> = ({
|
|
|
301
310
|
const buttonStyle = StyleSheet.flatten([
|
|
302
311
|
getSizeStyle(),
|
|
303
312
|
getTypeStyle(),
|
|
304
|
-
full && {
|
|
313
|
+
full && {width: '100%'},
|
|
314
|
+
loading && {opacity: 0.75}
|
|
305
315
|
]);
|
|
306
316
|
|
|
307
317
|
if (skeleton?.loading) {
|
|
@@ -322,11 +332,11 @@ const Button: FC<ButtonProps> = ({
|
|
|
322
332
|
accessibilityLabel={componentId}
|
|
323
333
|
accessibilityRole="button"
|
|
324
334
|
accessibilityState={{
|
|
325
|
-
disabled:
|
|
335
|
+
disabled: isDisabled,
|
|
326
336
|
busy: loading,
|
|
327
337
|
...accessibilityState,
|
|
328
338
|
}}
|
|
329
|
-
disabled={
|
|
339
|
+
disabled={isDisabled}
|
|
330
340
|
activeOpacity={0.5}
|
|
331
341
|
style={buttonStyle}
|
|
332
342
|
>
|
package/FoundationList/index.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { FlashList } from '@shopify/flash-list';
|
|
3
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlashList, FlashListProps } from '@shopify/flash-list';
|
|
3
|
+
import { FlatListProps } from 'react-native';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type CombinedListProps<ItemT> = FlatListProps<ItemT> &
|
|
6
|
+
Partial<FlashListProps<ItemT>>;
|
|
7
|
+
|
|
8
|
+
const FoundationList = <ItemT,>(props: CombinedListProps<ItemT>) => {
|
|
6
9
|
return <FlashList {...props} />;
|
|
7
10
|
};
|
|
8
11
|
|
package/Layout/Screen.tsx
CHANGED
|
@@ -45,6 +45,7 @@ import Section from './Section';
|
|
|
45
45
|
import {
|
|
46
46
|
HeaderBackground,
|
|
47
47
|
HeaderExtendHeader,
|
|
48
|
+
HeaderLeft,
|
|
48
49
|
HeaderTitle,
|
|
49
50
|
SearchHeader,
|
|
50
51
|
} from '../Application';
|
|
@@ -386,7 +387,8 @@ const Screen = forwardRef(
|
|
|
386
387
|
margin: 0,
|
|
387
388
|
left: Spacing.M,
|
|
388
389
|
},
|
|
389
|
-
headerLeft: () =>
|
|
390
|
+
headerLeft: (props: any) =>
|
|
391
|
+
params?.hiddenBack ? null : <HeaderLeft {...props} />,
|
|
390
392
|
headerTitle: () => (
|
|
391
393
|
<SearchHeader {...params} animatedValue={animatedValue.current} />
|
|
392
394
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.152.1-beta.
|
|
3
|
+
"version": "0.152.1-beta.2",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
|
|
20
20
|
"react-native-reanimated": "4.1.0",
|
|
21
21
|
"react-native-safe-area-context": "5.5.2",
|
|
22
|
-
"@shopify/flash-list": "2.1.0"
|
|
22
|
+
"@shopify/flash-list": "2.1.0",
|
|
23
|
+
"lottie-react-native": "7.2.4"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"react-native": "*"
|