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

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,7 +272,6 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
272
272
  />
273
273
  {!!headerImage && (
274
274
  <Image
275
- key={headerImage}
276
275
  style={styles.headerBackground}
277
276
  source={{uri: headerImage}}
278
277
  loading={false}
@@ -5,10 +5,6 @@ import {ApplicationContext} from './index';
5
5
  import {GridSystem} from '../Layout';
6
6
  import {useHeaderHeight} from '@react-navigation/stack';
7
7
 
8
- const {
9
- ScreenContext,
10
- } = require('react-native/Libraries/Components/ScreenContext');
11
-
12
8
  const StackScreen: React.FC<ScreenParams> = props => {
13
9
  const {screen: Component, options}: ScreenParams = props.route.params;
14
10
  const {theme, showGrid, navigator} = useContext(ApplicationContext);
@@ -68,14 +64,10 @@ const StackScreen: React.FC<ScreenParams> = props => {
68
64
  }, []);
69
65
 
70
66
  return (
71
- <ScreenContext.Provider
72
- value={{
73
- screenName: Component.name,
74
- elementTracking: navigator?.maxApi?.elementTracking,
75
- }}>
67
+ <>
76
68
  <Component heightHeader={heightHeader} {...params} />
77
69
  {showGrid && <GridSystem />}
78
- </ScreenContext.Provider>
70
+ </>
79
71
  );
80
72
  };
81
73
 
package/Button/index.tsx CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  TouchableOpacityProps,
7
7
  View,
8
8
  } from 'react-native';
9
+
9
10
  import LinearGradient from 'react-native-linear-gradient';
10
11
  import {ApplicationContext} from '../Application';
11
12
  import {Text} from '../Text';
@@ -15,10 +16,6 @@ import styles from './styles';
15
16
  import {Icon} from '../Icon';
16
17
  import {Loader} from '../Loader';
17
18
 
18
- const {
19
- ScreenContext,
20
- } = require('react-native/Libraries/Components/ScreenContext');
21
-
22
19
  const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
23
20
 
24
21
  export interface ButtonProps extends TouchableOpacityProps {
@@ -97,8 +94,6 @@ const Button: FC<ButtonProps> = ({
97
94
  end: {x: 0, y: 0.5},
98
95
  };
99
96
  }
100
-
101
- const screenInfo = useContext<any>(ScreenContext);
102
97
  const getSizeStyle = () => {
103
98
  const styleSheet: {[key: string]: any} = styles;
104
99
  return styleSheet[size ?? 'small'];
@@ -296,28 +291,20 @@ const Button: FC<ButtonProps> = ({
296
291
  const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
297
292
 
298
293
  return (
299
- <ScreenContext.Provider
300
- value={{
301
- ...screenInfo,
302
- componentName: 'Button',
303
- params: {
304
- title,
305
- },
306
- }}>
307
- <TouchableOpacity
308
- {...rest}
309
- activeOpacity={activeOpacity}
310
- onPress={onPressButton}
311
- style={buttonStyle}>
312
- {renderLeading()}
313
- {renderTitle()}
314
- {renderTrailing()}
315
- {gradientPros && (
316
- <AnimationLinear {...gradientPros} style={styles.gradientView} />
317
- )}
318
- {gradientPros && <View style={styles.strokeView} />}
319
- </TouchableOpacity>
320
- </ScreenContext.Provider>
294
+ <TouchableOpacity
295
+ {...rest}
296
+ accessibilityLabel={`Button/${title}`}
297
+ activeOpacity={activeOpacity}
298
+ onPress={onPressButton}
299
+ style={buttonStyle}>
300
+ {renderLeading()}
301
+ {renderTitle()}
302
+ {renderTrailing()}
303
+ {gradientPros && (
304
+ <AnimationLinear {...gradientPros} style={styles.gradientView} />
305
+ )}
306
+ {gradientPros && <View style={styles.strokeView} />}
307
+ </TouchableOpacity>
321
308
  );
322
309
  };
323
310
 
@@ -6,10 +6,6 @@ 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
-
13
9
  const CheckBox: FC<CheckBoxProps> = ({
14
10
  value,
15
11
  disabled,
@@ -23,7 +19,6 @@ const CheckBox: FC<CheckBoxProps> = ({
23
19
  const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
24
20
  let borderColor = theme.colors.text.default;
25
21
  let backgroundColor = theme.colors.background.surface;
26
- const screenInfo = useContext<any>(ScreenContext);
27
22
 
28
23
  if (haveValue) {
29
24
  borderColor = theme.colors.primary;
@@ -40,35 +35,27 @@ const CheckBox: FC<CheckBoxProps> = ({
40
35
  }
41
36
 
42
37
  return (
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>
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>
72
59
  );
73
60
  };
74
61
 
@@ -10,10 +10,6 @@ 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
-
17
13
  export interface IconButtonProps extends TouchableOpacityProps {
18
14
  /**
19
15
  * Represents the name or key of the icon to be displayed on the IconButton.
@@ -40,7 +36,6 @@ const IconButton: React.FC<IconButtonProps> = ({
40
36
  ...rest
41
37
  }) => {
42
38
  const {theme} = useContext(ApplicationContext);
43
- const screenInfo = useContext<any>(ScreenContext);
44
39
 
45
40
  /**
46
41
  * get size icon button
@@ -126,22 +121,14 @@ const IconButton: React.FC<IconButtonProps> = ({
126
121
  const iconSize = size === 'small' ? 16 : 24;
127
122
 
128
123
  return (
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>
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>
145
132
  );
146
133
  };
147
134
 
package/Image/index.tsx CHANGED
@@ -55,6 +55,9 @@ const Image: React.FC<ImageProps> = ({
55
55
  onLoadStart={() => {
56
56
  error.current = false;
57
57
  }}
58
+ onLoad={() => {
59
+ error.current = false;
60
+ }}
58
61
  onLoadEnd={() => {
59
62
  let current: Status = 'success';
60
63
  if (error.current) {
package/Radio/index.tsx CHANGED
@@ -7,10 +7,6 @@ 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
-
14
10
  const Radio: FC<RadioProps> = ({
15
11
  value,
16
12
  groupValue,
@@ -41,38 +37,28 @@ const Radio: FC<RadioProps> = ({
41
37
  };
42
38
  }
43
39
 
44
- const screenInfo = useContext<any>(ScreenContext);
45
-
46
40
  return (
47
- <ScreenContext.Provider
48
- value={{
49
- ...screenInfo,
50
- componentName: 'Radio',
51
- params: {
52
- value,
41
+ <TouchableOpacity
42
+ accessibilityLabel={`Radio/${label}/${value}`}
43
+ onPress={onChange}
44
+ disabled={disabled}
45
+ style={[
46
+ style,
47
+ {
48
+ flexDirection: 'row',
49
+ alignItems: 'center',
53
50
  },
54
- }}>
55
- <TouchableOpacity
56
- onPress={onChange}
57
- disabled={disabled}
51
+ ]}>
52
+ <View
58
53
  style={[
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>
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>
76
62
  );
77
63
  };
78
64
 
package/Switch/index.tsx CHANGED
@@ -1,18 +1,13 @@
1
- import React, {FC, useContext} from 'react';
1
+ import React, {FC} 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
-
11
7
  const Switch: FC<SwitchProps> = props => {
12
8
  const {value, onChange, disabled, style} = props;
13
9
  const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
14
10
  const circleAlign = value ? 'flex-end' : 'flex-start';
15
- const screenInfo = useContext<any>(ScreenContext);
16
11
 
17
12
  let backgroundColor = value ? Colors.green_03 : Colors.black_07;
18
13
  if (disabled) {
@@ -20,27 +15,19 @@ const Switch: FC<SwitchProps> = props => {
20
15
  }
21
16
 
22
17
  return (
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>
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>
44
31
  );
45
32
  };
46
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.37-tracking.3",
3
+ "version": "0.81.38",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {