@momo-kits/foundation 0.81.37-tracking.1 → 0.81.37-tracking.3

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.
@@ -272,6 +272,7 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
272
272
  />
273
273
  {!!headerImage && (
274
274
  <Image
275
+ key={headerImage}
275
276
  style={styles.headerBackground}
276
277
  source={{uri: headerImage}}
277
278
  loading={false}
@@ -31,7 +31,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
31
31
  const [language, setLanguage] = useState<'vi' | 'en'>('vi');
32
32
  const [config, setConfig] = useState<any>(undefined);
33
33
  let assets = theme.assets;
34
- if (config) {
34
+ if (config && theme.assets?.headerBackground) {
35
35
  assets = {...assets, headerBackground: config.navigationBar?.headerBar};
36
36
  }
37
37
 
package/Button/index.tsx CHANGED
@@ -85,7 +85,6 @@ const Button: FC<ButtonProps> = ({
85
85
  loading = false,
86
86
  title = 'Button',
87
87
  onPress,
88
- accessibilityLabel,
89
88
  ...rest
90
89
  }) => {
91
90
  const {theme, config} = useContext(ApplicationContext);
@@ -303,14 +302,10 @@ const Button: FC<ButtonProps> = ({
303
302
  componentName: 'Button',
304
303
  params: {
305
304
  title,
306
- accessibilityLabel,
307
305
  },
308
306
  }}>
309
307
  <TouchableOpacity
310
308
  {...rest}
311
- accessibilityLabel={`${screenInfo.screenName}/Button/${
312
- accessibilityLabel ?? title
313
- }`}
314
309
  activeOpacity={activeOpacity}
315
310
  onPress={onPressButton}
316
311
  style={buttonStyle}>
@@ -6,6 +6,10 @@ import {ApplicationContext} from '../Application';
6
6
  import {Text} from '../Text';
7
7
  import {Icon} from '../Icon';
8
8
 
9
+ const {
10
+ ScreenContext,
11
+ } = require('react-native/Libraries/Components/ScreenContext');
12
+
9
13
  const CheckBox: FC<CheckBoxProps> = ({
10
14
  value,
11
15
  disabled,
@@ -19,6 +23,7 @@ const CheckBox: FC<CheckBoxProps> = ({
19
23
  const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
20
24
  let borderColor = theme.colors.text.default;
21
25
  let backgroundColor = theme.colors.background.surface;
26
+ const screenInfo = useContext<any>(ScreenContext);
22
27
 
23
28
  if (haveValue) {
24
29
  borderColor = theme.colors.primary;
@@ -35,27 +40,35 @@ const CheckBox: FC<CheckBoxProps> = ({
35
40
  }
36
41
 
37
42
  return (
38
- <TouchableOpacity
39
- accessibilityLabel={`CheckBox/${label}/${value}`}
40
- activeOpacity={0.8}
41
- onPress={() => onChange?.(!value)}
42
- disabled={disabled}
43
- style={[style, styles.container]}>
44
- <View
45
- style={[
46
- {borderColor, backgroundColor, borderWidth: 1},
47
- styles.checkbox,
48
- ]}>
49
- {haveValue && (
50
- <Icon
51
- color={theme.colors.background.surface}
52
- size={20}
53
- source={iconSource}
54
- />
55
- )}
56
- </View>
57
- {!!label && <Text typography={'description_default'}>{label}</Text>}
58
- </TouchableOpacity>
43
+ <ScreenContext.Provider
44
+ value={{
45
+ ...screenInfo,
46
+ componentName: 'CheckBox',
47
+ params: {
48
+ value,
49
+ },
50
+ }}>
51
+ <TouchableOpacity
52
+ activeOpacity={0.8}
53
+ onPress={() => onChange?.(!value)}
54
+ disabled={disabled}
55
+ style={[style, styles.container]}>
56
+ <View
57
+ style={[
58
+ {borderColor, backgroundColor, borderWidth: 1},
59
+ styles.checkbox,
60
+ ]}>
61
+ {haveValue && (
62
+ <Icon
63
+ color={theme.colors.background.surface}
64
+ size={20}
65
+ source={iconSource}
66
+ />
67
+ )}
68
+ </View>
69
+ {!!label && <Text typography={'description_default'}>{label}</Text>}
70
+ </TouchableOpacity>
71
+ </ScreenContext.Provider>
59
72
  );
60
73
  };
61
74
 
@@ -10,6 +10,10 @@ import {Colors} from '../Consts';
10
10
  import {Icon} from '../Icon';
11
11
  import styles from './styles';
12
12
 
13
+ const {
14
+ ScreenContext,
15
+ } = require('react-native/Libraries/Components/ScreenContext');
16
+
13
17
  export interface IconButtonProps extends TouchableOpacityProps {
14
18
  /**
15
19
  * Represents the name or key of the icon to be displayed on the IconButton.
@@ -36,6 +40,7 @@ const IconButton: React.FC<IconButtonProps> = ({
36
40
  ...rest
37
41
  }) => {
38
42
  const {theme} = useContext(ApplicationContext);
43
+ const screenInfo = useContext<any>(ScreenContext);
39
44
 
40
45
  /**
41
46
  * get size icon button
@@ -121,14 +126,22 @@ const IconButton: React.FC<IconButtonProps> = ({
121
126
  const iconSize = size === 'small' ? 16 : 24;
122
127
 
123
128
  return (
124
- <TouchableOpacity
125
- {...rest}
126
- accessibilityLabel={`IconButton/${icon}`}
127
- activeOpacity={activeOpacity}
128
- onPress={onPressButton}
129
- style={buttonStyle}>
130
- <Icon size={iconSize} source={icon} color={getIconColor()} />
131
- </TouchableOpacity>
129
+ <ScreenContext.Provider
130
+ value={{
131
+ ...screenInfo,
132
+ componentName: 'IconButton',
133
+ params: {
134
+ icon,
135
+ },
136
+ }}>
137
+ <TouchableOpacity
138
+ {...rest}
139
+ activeOpacity={activeOpacity}
140
+ onPress={onPressButton}
141
+ style={buttonStyle}>
142
+ <Icon size={iconSize} source={icon} color={getIconColor()} />
143
+ </TouchableOpacity>
144
+ </ScreenContext.Provider>
132
145
  );
133
146
  };
134
147
 
package/Layout/Screen.tsx CHANGED
@@ -311,7 +311,6 @@ const Screen = forwardRef(
311
311
  uri: headerBackground,
312
312
  }}
313
313
  style={styles.extendedHeader}
314
- loading={false}
315
314
  />
316
315
  <View style={{height: heightHeader}} />
317
316
  </>
package/Radio/index.tsx CHANGED
@@ -7,6 +7,10 @@ import styles from './styles';
7
7
  import {ApplicationContext} from '../Application';
8
8
  import {Spacing} from '../Consts';
9
9
 
10
+ const {
11
+ ScreenContext,
12
+ } = require('react-native/Libraries/Components/ScreenContext');
13
+
10
14
  const Radio: FC<RadioProps> = ({
11
15
  value,
12
16
  groupValue,
@@ -37,28 +41,38 @@ const Radio: FC<RadioProps> = ({
37
41
  };
38
42
  }
39
43
 
44
+ const screenInfo = useContext<any>(ScreenContext);
45
+
40
46
  return (
41
- <TouchableOpacity
42
- accessibilityLabel={`Radio/${label}/${value}`}
43
- onPress={onChange}
44
- disabled={disabled}
45
- style={[
46
- style,
47
- {
48
- flexDirection: 'row',
49
- alignItems: 'center',
47
+ <ScreenContext.Provider
48
+ value={{
49
+ ...screenInfo,
50
+ componentName: 'Radio',
51
+ params: {
52
+ value,
50
53
  },
51
- ]}>
52
- <View
54
+ }}>
55
+ <TouchableOpacity
56
+ onPress={onChange}
57
+ disabled={disabled}
53
58
  style={[
54
- styles.radio,
55
- checkBoxStyle,
56
- disabledStyle,
57
- {marginRight: label ? Spacing.XS : 0},
58
- ]}
59
- />
60
- {!!label && <Text typography={'description_default'}>{label}</Text>}
61
- </TouchableOpacity>
59
+ style,
60
+ {
61
+ flexDirection: 'row',
62
+ alignItems: 'center',
63
+ },
64
+ ]}>
65
+ <View
66
+ style={[
67
+ styles.radio,
68
+ checkBoxStyle,
69
+ disabledStyle,
70
+ {marginRight: label ? Spacing.XS : 0},
71
+ ]}
72
+ />
73
+ {!!label && <Text typography={'description_default'}>{label}</Text>}
74
+ </TouchableOpacity>
75
+ </ScreenContext.Provider>
62
76
  );
63
77
  };
64
78
 
package/Switch/index.tsx CHANGED
@@ -1,13 +1,18 @@
1
- import React, {FC} from 'react';
1
+ import React, {FC, useContext} from 'react';
2
2
  import {TouchableOpacity, View} from 'react-native';
3
3
  import {SwitchProps} from './types';
4
4
  import styles from './styles';
5
5
  import {Colors} from '../Consts';
6
6
 
7
+ const {
8
+ ScreenContext,
9
+ } = require('react-native/Libraries/Components/ScreenContext');
10
+
7
11
  const Switch: FC<SwitchProps> = props => {
8
12
  const {value, onChange, disabled, style} = props;
9
13
  const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
10
14
  const circleAlign = value ? 'flex-end' : 'flex-start';
15
+ const screenInfo = useContext<any>(ScreenContext);
11
16
 
12
17
  let backgroundColor = value ? Colors.green_03 : Colors.black_07;
13
18
  if (disabled) {
@@ -15,19 +20,27 @@ const Switch: FC<SwitchProps> = props => {
15
20
  }
16
21
 
17
22
  return (
18
- <TouchableOpacity
19
- accessibilityLabel={'Switch'}
20
- disabled={disabled}
21
- onPress={() => onChange?.(!value)}
22
- style={[
23
- style,
24
- styles.container,
25
- {backgroundColor, alignItems: circleAlign},
26
- ]}>
27
- <View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
28
- <View style={[styles.circleSmall, {backgroundColor}]} />
29
- </View>
30
- </TouchableOpacity>
23
+ <ScreenContext.Provider
24
+ value={{
25
+ ...screenInfo,
26
+ componentName: 'Switch',
27
+ params: {
28
+ value,
29
+ },
30
+ }}>
31
+ <TouchableOpacity
32
+ disabled={disabled}
33
+ onPress={() => onChange?.(!value)}
34
+ style={[
35
+ style,
36
+ styles.container,
37
+ {backgroundColor, alignItems: circleAlign},
38
+ ]}>
39
+ <View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
40
+ <View style={[styles.circleSmall, {backgroundColor}]} />
41
+ </View>
42
+ </TouchableOpacity>
43
+ </ScreenContext.Provider>
31
44
  );
32
45
  };
33
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.37-tracking.1",
3
+ "version": "0.81.37-tracking.3",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {