@momo-kits/foundation 0.151.1-test.1 → 0.151.1-test.12

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,11 +1,20 @@
1
1
  import { Radius, Spacing, Styles } from '../../Consts';
2
2
  import { InputRef, InputSearch } from '../../Input';
3
- import { Animated, StyleSheet, TouchableOpacity, View } from 'react-native';
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 '../index';
7
13
  import { Text } from '../../Text';
8
14
 
15
+ const BACK_WIDTH = 28;
16
+ const { width: screenWidth } = Dimensions.get('window');
17
+
9
18
  const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
10
19
  (
11
20
  {
@@ -21,6 +30,8 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
21
30
  const context = useContext<any>(MiniAppContext);
22
31
 
23
32
  const animated = useRef(new Animated.Value(0));
33
+ const leftPosition = props?.leftPosition || BACK_WIDTH + 20;
34
+ const headerRightWidth = props?.headerRightWidth || 73;
24
35
 
25
36
  useEffect(() => {
26
37
  const listener = animatedValue?.addListener(({ value }) => {
@@ -69,7 +80,14 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
69
80
 
70
81
  return (
71
82
  <View style={styles.container}>
72
- <View style={Styles.flex}>
83
+ <View
84
+ style={[
85
+ Styles.flex,
86
+ renderButtons && {
87
+ maxWidth: screenWidth - leftPosition - 12 - headerRightWidth,
88
+ },
89
+ ]}
90
+ >
73
91
  <Animated.View style={{ backgroundColor, borderRadius: Radius.XL }}>
74
92
  <InputSearch
75
93
  ref={ref}
@@ -302,4 +302,5 @@ export interface SearchHeaderProps extends InputSearchProps {
302
302
  headerRightWidth?: 0 | 74 | 110 | number;
303
303
  leftPosition?: 12 | 48 | number;
304
304
  renderButtons?: () => ReactNode;
305
+ hiddenBack?: boolean;
305
306
  }
package/Button/index.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, { FC, useContext, useRef } from 'react';
1
+ import React, {FC, useContext} from 'react';
2
2
  import {
3
3
  Animated,
4
4
  StyleSheet,
@@ -18,8 +18,8 @@ import {Typography} from '../Text/types';
18
18
  import {Colors, Spacing} from '../Consts';
19
19
  import styles from './styles';
20
20
  import {Icon} from '../Icon';
21
+ import {Loader} from '../Loader';
21
22
  import {Skeleton} from '../Skeleton';
22
- import LottieView from 'lottie-react-native';
23
23
 
24
24
  const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
25
25
 
@@ -98,7 +98,6 @@ 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);
102
101
 
103
102
  const {componentId} = useComponentId(
104
103
  `${componentName}/${title}`,
@@ -106,7 +105,6 @@ const Button: FC<ButtonProps> = ({
106
105
  );
107
106
  const {gradient, color} = config?.navigationBar?.buttonColors ?? {};
108
107
  let gradientPros;
109
- const isDisabled = type === 'disabled' || loading;
110
108
 
111
109
  if (gradient?.length > 0 && type === 'primary') {
112
110
  gradientPros = {
@@ -249,11 +247,7 @@ const Button: FC<ButtonProps> = ({
249
247
 
250
248
  if (loading) {
251
249
  return (
252
- <LottieView
253
- ref={animationRef}
254
- source={require('./lottie_circle_loader.json')}
255
- autoPlay
256
- loop
250
+ <View
257
251
  style={[
258
252
  styles.trailing,
259
253
  {
@@ -262,8 +256,9 @@ const Button: FC<ButtonProps> = ({
262
256
  marginRight,
263
257
  borderRadius: Spacing.M,
264
258
  },
265
- ]}
266
- />
259
+ ]}>
260
+ <Loader type="spinner" color={getTextColor()} />
261
+ </View>
267
262
  );
268
263
  }
269
264
  if (iconLeft) {
@@ -304,7 +299,6 @@ const Button: FC<ButtonProps> = ({
304
299
  getSizeStyle(),
305
300
  getTypeStyle(),
306
301
  full && {width: '100%'},
307
- loading && {opacity: 0.75}
308
302
  ]);
309
303
 
310
304
  if (skeleton?.loading) {
@@ -324,11 +318,11 @@ const Button: FC<ButtonProps> = ({
324
318
  accessibilityLabel={componentId}
325
319
  accessibilityRole="button"
326
320
  accessibilityState={{
327
- disabled: isDisabled,
321
+ disabled: type === 'disabled',
328
322
  busy: loading,
329
323
  ...accessibilityState,
330
324
  }}
331
- disabled={isDisabled}
325
+ disabled={type === 'disabled'}
332
326
  activeOpacity={0.5}
333
327
  style={buttonStyle}>
334
328
  {renderLeading()}
package/Layout/Screen.tsx CHANGED
@@ -44,6 +44,7 @@ import { exportHeaderTitle, getOptions } from '../Application/utils';
44
44
  import {
45
45
  HeaderBackground,
46
46
  HeaderExtendHeader,
47
+ HeaderLeft,
47
48
  HeaderTitle,
48
49
  } from '../Application/Components';
49
50
  import { SearchHeader } from '../Application/Components/SearchHeader';
@@ -385,7 +386,8 @@ const Screen = forwardRef(
385
386
  margin: 0,
386
387
  left: Spacing.M,
387
388
  },
388
- headerLeft: () => null,
389
+ headerLeft: (props: any) =>
390
+ params?.hiddenBack ? null : <HeaderLeft {...props} />,
389
391
  headerTitle: () => (
390
392
  <SearchHeader {...params} animatedValue={animatedValue.current} />
391
393
  ),
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
1
  {
2
- "name": "@momo-kits/foundation",
3
- "version": "0.151.1-test.1",
4
- "description": "React Native Component Kits",
5
- "main": "index.ts",
6
- "scripts": {},
7
- "keywords": [
8
- "@momo-kits/foundation"
9
- ],
10
- "dependencies": {
11
- "react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
12
- "@react-navigation/bottom-tabs": "7.4.2",
13
- "@react-navigation/core": "7.12.1",
14
- "@react-navigation/elements": "2.5.2",
15
- "@react-navigation/native": "7.1.14",
16
- "@react-navigation/routers": "7.4.1",
17
- "@react-navigation/stack": "7.4.2",
18
- "react-native-gesture-handler": "2.27.1",
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
- "react-native-reanimated": "4.1.0",
21
- "react-native-safe-area-context": "5.5.2",
22
- "@shopify/flash-list": "2.1.0"
23
- },
24
- "peerDependencies": {
25
- "react-native": "*"
26
- },
27
- "devDependencies": {
28
- "@momo-platform/versions": "4.1.11",
29
- "@types/color": "3.0.6"
30
- },
31
- "publishConfig": {
32
- "registry": "https://registry.npmjs.org/"
33
- },
34
- "license": "MoMo"
35
- }
2
+ "name": "@momo-kits/foundation",
3
+ "version": "0.151.1-test.12",
4
+ "description": "React Native Component Kits",
5
+ "main": "index.ts",
6
+ "scripts": {},
7
+ "keywords": [
8
+ "@momo-kits/foundation"
9
+ ],
10
+ "dependencies": {
11
+ "react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
12
+ "@react-navigation/bottom-tabs": "7.4.2",
13
+ "@react-navigation/core": "7.12.1",
14
+ "@react-navigation/elements": "2.5.2",
15
+ "@react-navigation/native": "7.1.14",
16
+ "@react-navigation/routers": "7.4.1",
17
+ "@react-navigation/stack": "7.4.2",
18
+ "react-native-gesture-handler": "2.27.1",
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
+ "react-native-reanimated": "4.1.0",
21
+ "react-native-safe-area-context": "5.5.2",
22
+ "@shopify/flash-list": "2.1.0"
23
+ },
24
+ "peerDependencies": {
25
+ "react-native": "*"
26
+ },
27
+ "devDependencies": {
28
+ "@momo-platform/versions": "4.1.11",
29
+ "@types/color": "3.0.6"
30
+ },
31
+ "publishConfig": {
32
+ "registry": "https://registry.npmjs.org/"
33
+ },
34
+ "license": "MoMo"
35
+ }
@@ -1 +0,0 @@
1
- {"v":"5.10.2","fr":30,"ip":0,"op":50,"w":100,"h":100,"nm":"Spinner3_white","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"loading","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":13,"s":[0],"e":[200]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":25,"s":[200],"e":[360]},{"t":35}],"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.392],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":18,"s":[0],"e":[100]},{"t":50}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[100]},{"t":28}],"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":50,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"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":15,"s":[0],"e":[200]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":27,"s":[200],"e":[360]},{"t":37}],"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.392],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":20,"s":[0],"e":[100]},{"t":49}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[0],"e":[100]},{"t":30}],"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":30,"op":50,"st":2,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"base","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.956862745098,0.980392156863,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":50,"st":0,"ct":1,"bm":0}],"markers":[]}