@momo-kits/foundation 0.77.8-beta.2 → 0.77.8-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.
@@ -8,17 +8,27 @@ import {ApplicationContext} from './index';
8
8
 
9
9
  const Tab = createBottomTabNavigator();
10
10
 
11
- const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners}) => {
11
+ const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners, navigation}) => {
12
12
  const {theme} = useContext(ApplicationContext);
13
+
14
+ const defaultListener = {
15
+ focus: (item: any) => {
16
+ const focusItem = tabs.find(i => item.target.includes(i.name));
17
+ if (focusItem?.options) {
18
+ navigation?.setOptions?.(focusItem.options);
19
+ }
20
+ },
21
+ };
22
+
13
23
  return (
14
- <Tab.Navigator>
24
+ <Tab.Navigator backBehavior={'firstRoute'}>
15
25
  {tabs.map(item => {
16
26
  return (
17
27
  <Tab.Screen
18
28
  key={item.name}
19
29
  name={item.name}
20
30
  component={item.screen}
21
- listeners={listeners}
31
+ listeners={listeners ?? defaultListener}
22
32
  options={{
23
33
  tabBarLabel: ({color, focused}) => {
24
34
  return (
@@ -249,7 +249,7 @@ const HeaderCustom: React.FC<TitleCustomProps> = ({
249
249
  <View style={[styles.dotAvatar, {backgroundColor: dotColor}]} />
250
250
  )}
251
251
  </View>
252
- <View style={[Styles.flex, Styles.paddingHorizontal8]}>
252
+ <View style={[Styles.flex, {paddingHorizontal: 8}]}>
253
253
  <Text typography="title_xs" color={tintColor}>
254
254
  {title}
255
255
  </Text>
@@ -1,4 +1,11 @@
1
- import React, {useContext, useEffect, useMemo, useRef} from 'react';
1
+ import React, {
2
+ useCallback,
3
+ useContext,
4
+ useEffect,
5
+ useMemo,
6
+ useRef,
7
+ useState,
8
+ } from 'react';
2
9
  import {
3
10
  KeyboardAvoidingView,
4
11
  Platform,
@@ -6,7 +13,7 @@ import {
6
13
  StyleSheet,
7
14
  View,
8
15
  } from 'react-native';
9
- import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
16
+ import {SafeAreaView} from 'react-native-safe-area-context';
10
17
  import {BottomSheetBackdrop, BottomSheetModal} from '@gorhom/bottom-sheet';
11
18
  import Navigation from './Navigation';
12
19
  import {BottomSheetParams, ModalParams} from './types';
@@ -84,7 +91,11 @@ const Modal: React.FC<ModalParams> = props => {
84
91
 
85
92
  const BottomSheet: React.FC<BottomSheetParams> = props => {
86
93
  const {theme, navigator} = useContext(ApplicationContext);
87
- const {screen, options}: BottomSheetParams = props.route.params;
94
+ const {
95
+ screen,
96
+ options,
97
+ useSnap = true,
98
+ }: BottomSheetParams = props.route.params;
88
99
  const Component = useRef(screen).current;
89
100
  const navigation = new Navigation(props.navigation, theme);
90
101
  const params = {
@@ -94,11 +105,36 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
94
105
 
95
106
  delete params.screen;
96
107
 
97
- const snapPoints = useMemo(() => ['50%', '90%'], []);
98
- const {bottom} = useSafeAreaInsets();
99
- const bottomSheetRef = useRef(null);
108
+ const [contentHeight, setContentHeight] = useState(undefined);
109
+ const snapPoints = useMemo(() => {
110
+ if (useSnap) {
111
+ return ['50%', '90%'];
112
+ }
113
+ return [contentHeight ?? '50%'];
114
+ }, [contentHeight]);
115
+
116
+ const bottomSheetRef = useRef<any>(null);
100
117
  const mountedRef = useRef(true);
101
118
 
119
+ let handleOnLayout;
120
+ if (useSnap) {
121
+ handleOnLayout = useCallback(
122
+ ({
123
+ nativeEvent: {
124
+ layout: {height},
125
+ },
126
+ }) => {
127
+ setContentHeight(height);
128
+ },
129
+ [],
130
+ );
131
+ }
132
+
133
+ let backgroundColor = theme.colors.background.default;
134
+ if (options?.surface) {
135
+ backgroundColor = theme.colors.background.surface;
136
+ }
137
+
102
138
  useEffect(() => {
103
139
  bottomSheetRef.current?.present();
104
140
  return () => {
@@ -114,11 +150,6 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
114
150
  />
115
151
  );
116
152
 
117
- let backgroundColor = theme.colors.background.default;
118
- if (options?.surface) {
119
- backgroundColor = theme.colors.background.surface;
120
- }
121
-
122
153
  return (
123
154
  <SafeAreaView style={Styles.flex}>
124
155
  <BottomSheetModal
@@ -131,9 +162,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
131
162
  }}
132
163
  handleComponent={null}
133
164
  backdropComponent={backdropComponent}>
134
- <View
135
- style={{paddingBottom: bottom}}
136
- accessibilityLabel={'BottomSheet'}>
165
+ <View onLayout={handleOnLayout} accessibilityLabel={'BottomSheet'}>
137
166
  <View style={[styles.sheetContainer, {backgroundColor}]}>
138
167
  <View style={styles.indicatorContainer}>
139
168
  <View
@@ -30,7 +30,6 @@ class Navigation {
30
30
  };
31
31
 
32
32
  setOptions = (params: NavigationOptions) => {
33
- console.log(params);
34
33
  if (__DEV__) {
35
34
  params = this.filterParams(params);
36
35
  }
@@ -1,6 +1,11 @@
1
1
  import {NavigationContainer} from './NavigationContainer';
2
2
  import Screen from '../Layout/Screen';
3
- import {HeaderRightAction, NavigationButton} from './Components';
3
+ import {
4
+ HeaderRightAction,
5
+ NavigationButton,
6
+ HeaderToolkitAction,
7
+ HeaderTitle,
8
+ } from './Components';
4
9
  import BottomTab from './BottomTab';
5
10
  import {createContext} from 'react';
6
11
  import {defaultContext} from '../Consts';
@@ -13,5 +18,7 @@ export {
13
18
  Screen,
14
19
  NavigationButton,
15
20
  HeaderRightAction,
21
+ HeaderToolkitAction,
22
+ HeaderTitle,
16
23
  BottomTab,
17
24
  };
@@ -108,6 +108,7 @@ export interface ModalParams extends ScreenParams {
108
108
  export interface BottomSheetParams extends ScreenParams {
109
109
  [key: string]: any;
110
110
  onDismiss?: () => void;
111
+ useSnap?: boolean;
111
112
  }
112
113
 
113
114
  export type NavigationButtonProps = {
@@ -171,10 +172,12 @@ export type BottomTabItemProps = {
171
172
  showDot?: boolean;
172
173
  badgeLabel?: string;
173
174
  screen: Screen;
175
+ options: NavigationOptions;
174
176
  };
175
177
 
176
178
  export type BottomTabProps = {
177
179
  tabs: BottomTabItemProps[];
180
+ navigation: Navigation;
178
181
  listeners?: {
179
182
  tabPress?: any;
180
183
  focus?: any;
package/Button/index.tsx CHANGED
@@ -65,7 +65,7 @@ const Button: FC<ButtonProps> = ({
65
65
  type = 'primary',
66
66
  size = 'large',
67
67
  useTintColor = true,
68
- full = false,
68
+ full = true,
69
69
  iconRight,
70
70
  iconLeft,
71
71
  title = 'Button',
@@ -6,41 +6,46 @@ import {ApplicationContext} from '../Application';
6
6
  import {Text} from '../Text';
7
7
  import {Icon} from '../Icon';
8
8
 
9
- const CheckBox: FC<CheckBoxProps> = props => {
9
+ const CheckBox: FC<CheckBoxProps> = ({
10
+ value,
11
+ disabled,
12
+ onChange,
13
+ style,
14
+ label,
15
+ indeterminate,
16
+ }) => {
10
17
  const {theme} = useContext(ApplicationContext);
11
- const {value, disabled, onChange, style, label, indeterminated} = props;
18
+ const haveValue = value || indeterminate;
19
+ const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
20
+ let borderColor = theme.colors.text.default;
21
+ let backgroundColor = theme.colors.background.surface;
12
22
 
13
- const haveValue = value || indeterminated;
14
- let borderColor = haveValue
15
- ? theme.colors.primary
16
- : theme.colors.text.default;
17
- let backgroundColor = haveValue
18
- ? theme.colors.primary
19
- : theme.colors.background.surface;
20
-
21
- let iconSource = indeterminated ? 'ic_minus' : 'ic_checked';
23
+ if (haveValue) {
24
+ borderColor = theme.colors.primary;
25
+ backgroundColor = theme.colors.primary;
26
+ }
22
27
 
23
28
  if (disabled) {
24
- borderColor = haveValue
25
- ? theme.colors.background.tonal
26
- : theme.colors.border.disable;
27
- backgroundColor = haveValue
28
- ? theme.colors.background.tonal
29
- : theme.colors.background.surface;
29
+ borderColor = theme.colors.border.disable;
30
+ backgroundColor = theme.colors.background.surface;
31
+ if (haveValue) {
32
+ borderColor = theme.colors.background.tonal;
33
+ backgroundColor = theme.colors.background.tonal;
34
+ }
30
35
  }
31
- const checkboxStyle = {borderColor, backgroundColor, borderWidth: 1};
32
36
 
33
- const onChangeValue = () => {
34
- onChange?.(!value);
35
- };
36
37
  return (
37
38
  <TouchableOpacity
38
- accessibilityLabel={`CheckBox/${label}`}
39
+ accessibilityLabel={`CheckBox/${label}/${value}`}
39
40
  activeOpacity={0.8}
40
- onPress={onChangeValue}
41
+ onPress={() => onChange?.(!value)}
41
42
  disabled={disabled}
42
43
  style={[style, styles.container]}>
43
- <View style={[checkboxStyle, styles.checkbox]}>
44
+ <View
45
+ style={[
46
+ {borderColor, backgroundColor, borderWidth: 1},
47
+ styles.checkbox,
48
+ ]}>
44
49
  {haveValue && (
45
50
  <Icon
46
51
  color={theme.colors.background.surface}
@@ -11,5 +11,5 @@ export default StyleSheet.create({
11
11
  justifyContent: 'center',
12
12
  alignItems: 'center',
13
13
  },
14
- container: {flexDirection: 'row'},
14
+ container: {flexDirection: 'row', alignItems: 'center'},
15
15
  });
package/CheckBox/types.ts CHANGED
@@ -28,7 +28,7 @@ export type CheckBoxProps = {
28
28
  * which is typically used to represent a "mixed" or "partial" selection state.
29
29
  * Defaults to `false` if not provided.
30
30
  */
31
- indeterminated?: boolean;
31
+ indeterminate?: boolean;
32
32
 
33
33
  /**
34
34
  * Optional. Used to apply custom styling to the CheckBox component.
package/Consts/styles.ts CHANGED
@@ -47,32 +47,6 @@ const Styles = StyleSheet.create({
47
47
  alignItems: 'flex-end',
48
48
  justifyContent: 'center',
49
49
  },
50
- //paddingHorizontal
51
- paddingHorizontal4: {
52
- paddingHorizontal: 4,
53
- },
54
- paddingHorizontal8: {
55
- paddingHorizontal: 8,
56
- },
57
- paddingHorizontal16: {
58
- paddingHorizontal: 16,
59
- },
60
- paddingHorizontal24: {
61
- paddingHorizontal: 24,
62
- },
63
- //paddingVertical
64
- paddingVertical4: {
65
- paddingVertical: 4,
66
- },
67
- paddingVertical8: {
68
- paddingVertical: 8,
69
- },
70
- paddingVertical16: {
71
- paddingVertical: 16,
72
- },
73
- paddingVertical24: {
74
- paddingVertical: 24,
75
- },
76
50
  });
77
51
 
78
52
  export {Styles};
package/Input/Input.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, {FC, useContext, useEffect, useRef, useState} from 'react';
1
+ import React, {FC, useContext, useRef, useState} from 'react';
2
2
  import {
3
3
  NativeSyntheticEvent,
4
4
  TextInput,
@@ -28,6 +28,7 @@ const Input: FC<InputProps> = ({
28
28
  floatingIconColor,
29
29
  iconColor,
30
30
  required,
31
+ errorSpacing,
31
32
  ...props
32
33
  }) => {
33
34
  const {theme} = useContext(ApplicationContext);
@@ -71,10 +72,10 @@ const Input: FC<InputProps> = ({
71
72
  return (
72
73
  <View
73
74
  style={[
74
- getSizeStyle(size),
75
- getBorderColor(focused, errorMessage, disabled),
76
75
  styles.inputWrapper,
77
76
  {backgroundColor: theme.colors.background.surface},
77
+ getSizeStyle(size),
78
+ getBorderColor(theme, focused, errorMessage, disabled),
78
79
  ]}>
79
80
  <FloatingView
80
81
  floatingValue={floatingValue}
@@ -126,7 +127,7 @@ const Input: FC<InputProps> = ({
126
127
  return (
127
128
  <View style={styles.wrapper} accessibilityLabel={`Input/${floatingValue}`}>
128
129
  {renderInputView()}
129
- <ErrorView errorMessage={errorMessage} />
130
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
130
131
  </View>
131
132
  );
132
133
  };
@@ -26,6 +26,7 @@ const InputMoney: FC<InputMoneyProps> = ({
26
26
  floatingIconColor,
27
27
  iconColor,
28
28
  required,
29
+ errorSpacing,
29
30
  ...props
30
31
  }) => {
31
32
  const {theme} = useContext(ApplicationContext);
@@ -71,10 +72,10 @@ const InputMoney: FC<InputMoneyProps> = ({
71
72
  return (
72
73
  <View
73
74
  style={[
74
- getSizeStyle(size),
75
- getBorderColor(focused, errorMessage, disabled),
76
75
  styles.inputWrapper,
77
76
  {backgroundColor: theme.colors.background.surface},
77
+ getSizeStyle(size),
78
+ getBorderColor(theme, focused, errorMessage, disabled),
78
79
  ]}>
79
80
  <FloatingView
80
81
  floatingValue={floatingValue}
@@ -127,7 +128,7 @@ const InputMoney: FC<InputMoneyProps> = ({
127
128
  style={styles.wrapper}
128
129
  accessibilityLabel={`InputMoney/${floatingValue}`}>
129
130
  {renderInputView()}
130
- <ErrorView errorMessage={errorMessage} />
131
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
131
132
  </View>
132
133
  );
133
134
  };
@@ -55,18 +55,6 @@ const InputSearch: FC<InputSearchProps> = ({
55
55
  onChangeText?.(text);
56
56
  };
57
57
 
58
- const getBorderColor = () => {
59
- let borderColor = showBorder
60
- ? theme.colors.border.default
61
- : theme.colors.background.surface;
62
-
63
- if (focused) {
64
- borderColor = theme.colors.primary;
65
- }
66
-
67
- return {borderColor};
68
- };
69
-
70
58
  const renderInputView = () => {
71
59
  let textColor = theme.colors.text.default;
72
60
  let placeholderColor = theme.colors.text.hint;
@@ -135,11 +123,13 @@ const InputSearch: FC<InputSearchProps> = ({
135
123
  accessibilityLabel={`InputSearch/${placeholder}`}>
136
124
  <View
137
125
  style={[
138
- getBorderColor(),
139
126
  styles.searchInputWrapper,
140
127
  {
141
128
  backgroundColor: theme.colors.background.surface,
129
+ borderColor: theme.colors.background.surface,
142
130
  },
131
+ showBorder && {borderColor: theme.colors.border.default},
132
+ focused && {borderColor: theme.colors.primary},
143
133
  ]}>
144
134
  <Icon
145
135
  source={'navigation_search'}
@@ -34,6 +34,7 @@ const InputTextArea: FC<InputTextAreaProps> = ({
34
34
  placeholder,
35
35
  maxLength,
36
36
  required,
37
+ errorSpacing,
37
38
  ...props
38
39
  }) => {
39
40
  const {theme} = useContext(ApplicationContext);
@@ -83,12 +84,12 @@ const InputTextArea: FC<InputTextAreaProps> = ({
83
84
  return (
84
85
  <View
85
86
  style={[
86
- getBorderColor(focused, errorMessage, disabled),
87
87
  styles.textAreaWrapper,
88
88
  {
89
89
  height: height || DEFAULT_HEIGHT,
90
90
  backgroundColor: theme.colors.background.surface,
91
91
  },
92
+ getBorderColor(theme, focused, errorMessage, disabled),
92
93
  ]}>
93
94
  <FloatingView
94
95
  floatingValue={floatingValue}
@@ -143,7 +144,7 @@ const InputTextArea: FC<InputTextAreaProps> = ({
143
144
  style={styles.wrapper}
144
145
  accessibilityLabel={`InputTextArea/${floatingValue}`}>
145
146
  {renderInputView()}
146
- <ErrorView errorMessage={errorMessage} />
147
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
147
148
  </View>
148
149
  );
149
150
  };
package/Input/common.tsx CHANGED
@@ -5,6 +5,7 @@ import React, {FC, useContext} from 'react';
5
5
  import {ApplicationContext} from '../Application';
6
6
  import {Icon} from '../Icon';
7
7
  import {Styles} from '../Consts';
8
+ import {Theme} from '../Application/types';
8
9
 
9
10
  type FloatingViewProps = {
10
11
  floatingValue?: string;
@@ -18,12 +19,11 @@ export const DEFAULT_HEIGHT = 112;
18
19
  export const MAX_LENGTH = 300;
19
20
 
20
21
  export const getBorderColor = (
22
+ theme: Theme,
21
23
  focused: boolean,
22
24
  errorMessage?: string,
23
25
  disabled?: boolean,
24
26
  ) => {
25
- const {theme} = useContext(ApplicationContext);
26
-
27
27
  let borderColor = theme.colors.border.default;
28
28
 
29
29
  if (focused) {
@@ -47,7 +47,10 @@ export const getSizeStyle = (size?: 'small' | 'large') => {
47
47
  }
48
48
  return styles.container;
49
49
  };
50
- export const ErrorView: FC<{errorMessage?: string}> = ({errorMessage}) => {
50
+ export const ErrorView: FC<{errorMessage?: string; errorSpacing?: boolean}> = ({
51
+ errorMessage,
52
+ errorSpacing,
53
+ }) => {
51
54
  const {theme} = useContext(ApplicationContext);
52
55
  const errorColor = theme.colors.error.primary;
53
56
  if (errorMessage) {
@@ -59,14 +62,17 @@ export const ErrorView: FC<{errorMessage?: string}> = ({errorMessage}) => {
59
62
  <Text
60
63
  style={Styles.flex}
61
64
  color={errorColor}
62
- numberOfLines={1}
65
+ numberOfLines={2}
63
66
  typography={'description_s'}>
64
67
  {errorMessage}
65
68
  </Text>
66
69
  </View>
67
70
  );
68
71
  }
69
- return null;
72
+ if (errorSpacing) {
73
+ return <View style={[styles.errorView, {height: 18}]} />;
74
+ }
75
+ return <View />;
70
76
  };
71
77
 
72
78
  export const FloatingView: FC<FloatingViewProps> = ({
package/Input/index.tsx CHANGED
@@ -52,6 +52,13 @@ export interface InputProps extends TextInputProps {
52
52
  * Defaults to `false` if not provided.
53
53
  */
54
54
  required?: boolean;
55
+
56
+ /**
57
+ * Optional. If `true`,
58
+ * include spacing when Input not have error message.
59
+ * Defaults to `false` if not provided.
60
+ */
61
+ errorSpacing?: boolean;
55
62
  }
56
63
 
57
64
  type InputPropsWithoutSizeAndIcon = Omit<
@@ -51,7 +51,7 @@ const GridSystem: React.FC<any> = ({
51
51
  bottom: Spacing.M,
52
52
  },
53
53
  ]}>
54
- {list.map((i, index) => {
54
+ {list.map((_, index) => {
55
55
  return (
56
56
  <View style={{flexDirection: 'row'}} key={index.toString()}>
57
57
  {index != -0 && <View style={{width: grid.gutterSize}} />}
package/Layout/Screen.tsx CHANGED
@@ -5,9 +5,8 @@ import React, {useContext, useEffect, useRef} from 'react';
5
5
  import {ScreenProps} from '../Application/types';
6
6
  import {Spacing, Styles} from '../Consts';
7
7
  import {Card, Section, validateChildren} from './index';
8
- import {ApplicationContext} from '../Application';
8
+ import {ApplicationContext, HeaderTitle} from '../Application';
9
9
  import Navigation from '../Application/Navigation';
10
- import {HeaderTitle} from '../Application/Components';
11
10
 
12
11
  const Screen: React.FC<ScreenProps> = ({
13
12
  children,
@@ -70,7 +69,6 @@ const Screen: React.FC<ScreenProps> = ({
70
69
  const stackNavigation = new Navigation(current?.getParent(), theme);
71
70
  stackNavigation?.setOptions({
72
71
  animatedValue: animatedValue.current,
73
- headerTransparent: true,
74
72
  });
75
73
  });
76
74
  }
@@ -130,8 +128,20 @@ const Screen: React.FC<ScreenProps> = ({
130
128
  </View>
131
129
  );
132
130
  });
131
+ } else {
132
+ const item: any = children;
133
+ const space = item?.props?.useMargin === false ? 0 : Spacing.M;
134
+ return (
135
+ <View
136
+ key={`ScreenItem`}
137
+ style={{
138
+ marginTop: space,
139
+ flex: item?.props?.expanded ? 1 : undefined,
140
+ }}>
141
+ {children}
142
+ </View>
143
+ );
133
144
  }
134
- return results;
135
145
  };
136
146
 
137
147
  return (
package/Layout/index.ts CHANGED
@@ -11,7 +11,7 @@ const GridContext = createContext<GridContextProps>({
11
11
  gutterSize: 12,
12
12
  margin: 12,
13
13
  sizePerSpan: 0,
14
- getSizeSpan: span => 0,
14
+ getSizeSpan: () => 0,
15
15
  });
16
16
 
17
17
  export {GridContext, Card, Section, GridSystem, validateChildren, Item};
package/Layout/utils.ts CHANGED
@@ -62,15 +62,12 @@ const useGridSystem = () => {
62
62
  );
63
63
 
64
64
  useEffect(() => {
65
- const subscription: any = Dimensions.addEventListener(
66
- 'change',
67
- ({window}: any) => {
68
- const newColumns = Dimensions.get('window').width > 600 ? 24 : 12;
69
- if (newColumns != numberOfColumns) {
70
- setNumberOfColumns(newColumns);
71
- }
72
- },
73
- );
65
+ const subscription: any = Dimensions.addEventListener('change', () => {
66
+ const newColumns = Dimensions.get('window').width > 600 ? 24 : 12;
67
+ if (newColumns != numberOfColumns) {
68
+ setNumberOfColumns(newColumns);
69
+ }
70
+ });
74
71
  return () => subscription?.remove();
75
72
  }, []);
76
73
 
@@ -14,12 +14,12 @@ const DotLoader: FC<ViewProps> = ({style}) => {
14
14
  theme.colors.primary,
15
15
  ];
16
16
 
17
- let source = animation;
18
- source.assets[0].layers[0].shapes[0].it.forEach(item => {
17
+ let source: any = animation;
18
+ source.assets[0].layers[0].shapes[0].it.forEach((item: any) => {
19
19
  if (item.ty === 'fl' && item.c) {
20
- item.c.k.forEach((fillItem, index) => {
20
+ item.c.k.forEach((fillItem: any, index: number) => {
21
21
  if (typeof fillItem !== 'number') {
22
- fillItem.s = hexToRGBA(arrayColor[index]);
22
+ fillItem.s = hexToRGBA(arrayColor[index] as string);
23
23
  }
24
24
  });
25
25
  }
@@ -8,9 +8,9 @@ import {ApplicationContext} from '../Application';
8
8
  const Spinner: FC<ViewProps> = ({style}) => {
9
9
  const {theme} = useContext(ApplicationContext);
10
10
 
11
- let source = animation;
12
- source.assets[0].layers.forEach(layer => {
13
- layer.shapes[0].it.forEach(item => {
11
+ let source: any = animation;
12
+ source.assets[0].layers.forEach((layer: any) => {
13
+ layer.shapes[0].it.forEach((item: any) => {
14
14
  if (item.ty === 'fl' && item.c) {
15
15
  item.c.k = hexToRGBA(theme.colors.primary);
16
16
  }
@@ -1,9 +1,8 @@
1
- import React, {FC, useContext} from 'react';
1
+ import React, {FC} from 'react';
2
2
  import {View} from 'react-native';
3
3
  import {ChildPaginationProps} from './types';
4
4
  import styles from './styles';
5
5
  import {Text} from '../Text';
6
- import {ApplicationContext} from '../Application';
7
6
  import {Colors} from '../Consts';
8
7
 
9
8
  const PaginationNumber: FC<ChildPaginationProps> = ({
@@ -1,16 +1,14 @@
1
- import React, {FC, useContext} from 'react';
1
+ import React, {FC} from 'react';
2
2
  import {View} from 'react-native';
3
3
  import {ChildPaginationProps} from './types';
4
4
  import styles from './styles';
5
5
  import Dot from './Dot';
6
6
  import {Colors, Spacing} from '../Consts';
7
- import {ApplicationContext} from '../Application';
8
7
 
9
8
  const PaginationWhiteDot: FC<ChildPaginationProps> = ({
10
9
  dataLength = 2,
11
10
  activeIndex = 0,
12
11
  }) => {
13
- const {theme} = useContext(ApplicationContext);
14
12
  const renderDots = () => {
15
13
  const dots = [];
16
14
  for (let i = 0; i < dataLength; i++) {
package/Popup/types.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import {TextStyle} from 'react-native';
2
+ import React from 'react';
3
+
1
4
  export type PopupNotifyProps = {
2
5
  /**
3
6
  * `image`: Optional. Represents the URL or path of the image to be displayed in the PopupNotify component.
@@ -12,7 +15,7 @@ export type PopupNotifyProps = {
12
15
  /**
13
16
  * `description`: Represents the description text to be displayed in the PopupNotify component.
14
17
  */
15
- description: string;
18
+ description: string | React.ReactNode;
16
19
 
17
20
  /**
18
21
  * `information`: Optional. Represents additional information text to be displayed in the PopupNotify component.
@@ -67,4 +70,9 @@ type PopupAction = {
67
70
  onPress: () => void;
68
71
  };
69
72
 
73
+ export type HighlightText = {
74
+ text: string;
75
+ style: TextStyle;
76
+ };
77
+
70
78
  type PopupActionDirection = 'row' | 'column' | 'auto';
package/Radio/index.tsx CHANGED
@@ -39,7 +39,7 @@ const Radio: FC<RadioProps> = ({
39
39
 
40
40
  return (
41
41
  <TouchableOpacity
42
- accessibilityLabel={`Radio/${label}`}
42
+ accessibilityLabel={`Radio/${label}/${value}`}
43
43
  onPress={onChange}
44
44
  disabled={disabled}
45
45
  style={[
package/Text/index.tsx CHANGED
@@ -3,7 +3,6 @@ import {Text as RNText, TextProps as RNTextProps} from 'react-native';
3
3
  import styles from './styles';
4
4
  import {Typography, TypographyWeight} from './types';
5
5
  import {ApplicationContext} from '../Application';
6
- import {GridContext} from '../Layout';
7
6
  import {scaleSize} from './utils';
8
7
 
9
8
  const SFProText: TypographyWeight = {
@@ -51,22 +50,14 @@ export interface TextProps extends RNTextProps {
51
50
  * It can be any valid color string (e.g., hex, rgb, rgba, etc.).
52
51
  */
53
52
  color?: string;
54
-
55
- /**
56
- * Optional. Represents the width of the Text component in terms of span numbers.
57
- * It can be used to set a specific width for the text based on a predefined grid system.
58
- */
59
- widthSpan?: number;
60
53
  }
61
54
  const Text: React.FC<TextProps> = ({
62
55
  typography,
63
56
  color,
64
57
  children,
65
58
  style,
66
- widthSpan,
67
59
  ...rest
68
60
  }) => {
69
- const grid = useContext(GridContext);
70
61
  const {theme} = useContext(ApplicationContext);
71
62
 
72
63
  const getTypoStyle = (typo: Typography) => {
@@ -101,17 +92,11 @@ const Text: React.FC<TextProps> = ({
101
92
  };
102
93
 
103
94
  const textStyle = getTypoStyle(typography);
104
- const spanStyle = widthSpan ? {width: grid.getSizeSpan(widthSpan)} : {};
105
95
  return (
106
96
  <RNText
107
97
  {...rest}
108
98
  accessibilityLabel={`Text/${children}`}
109
- style={[
110
- style,
111
- textStyle,
112
- spanStyle,
113
- {color: color ?? theme.colors.text.default},
114
- ]}>
99
+ style={[style, textStyle, {color: color ?? theme.colors.text.default}]}>
115
100
  {children ?? ''}
116
101
  </RNText>
117
102
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.77.8-beta.02",
3
+ "version": "0.77.8-beta.04",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -19,6 +19,7 @@
19
19
  "@react-navigation/core": "5.16.1",
20
20
  "@react-navigation/native": "5.9.8",
21
21
  "@react-navigation/routers": "5.7.4",
22
+ "lottie-react-native": "3.3.2",
22
23
  "@react-navigation/stack": "git+https://gitlab.com/dung.huynh1/react-navigation-stack.git#main"
23
24
  },
24
25
  "peerDependencies": {
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": ".",
4
+ "allowUnreachableCode": false,
5
+ "allowUnusedLabels": false,
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "jsx": "react",
9
+ "lib": ["esnext"],
10
+ "module": "esnext",
11
+ "moduleResolution": "node",
12
+ "noFallthroughCasesInSwitch": true,
13
+ "noImplicitReturns": false,
14
+ "noImplicitUseStrict": false,
15
+ "noStrictGenericChecks": false,
16
+ "noUncheckedIndexedAccess": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "resolveJsonModule": true,
20
+ "skipLibCheck": true,
21
+ "strict": true,
22
+ "target": "esnext",
23
+ "verbatimModuleSyntax": false
24
+ }
25
+ }
File without changes