@momo-kits/foundation 0.104.1-beta.13 → 0.104.1-beta.15

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.
@@ -80,7 +80,11 @@ const BottomTab: React.FC<BottomTabProps> = ({
80
80
  initialRouteName={initialRouteName}
81
81
  backBehavior={'firstRoute'}
82
82
  tabBar={props => (
83
- <BottomTabBar {...props} floatingButton={floatingButton} />
83
+ <BottomTabBar
84
+ {...props}
85
+ floatingButton={floatingButton}
86
+ inactiveTintColor={theme.colors.text.secondary}
87
+ />
84
88
  )}
85
89
  tabBarOptions={{
86
90
  style: {
@@ -90,6 +94,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
90
94
  height: 68,
91
95
  paddingVertical: 10,
92
96
  },
97
+ inactiveTintColor: theme.colors.text.secondary,
93
98
  }}>
94
99
  {tabs.map(item => {
95
100
  const isNum = !isNaN(parseInt(`${item?.badgeLabel}`));
@@ -7,7 +7,6 @@ import React, {
7
7
  useState,
8
8
  } from 'react';
9
9
  import {
10
- Alert,
11
10
  Animated,
12
11
  BackHandler,
13
12
  DeviceEventEmitter,
@@ -47,18 +46,16 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
47
46
  icon,
48
47
  tintColor,
49
48
  onPress,
50
- useBorder = true,
51
49
  badgeType,
52
50
  badgeValue,
53
51
  accessibilityLabel = '',
54
52
  }) => {
55
53
  const {theme} = useContext(ApplicationContext);
56
- let buttonStyle: ViewStyle = {backgroundColor: '#00000066'};
57
- if (tintColor !== Colors.black_01) {
54
+ let buttonStyle: ViewStyle = {};
55
+ if (tintColor === Colors.black_01) {
58
56
  buttonStyle = {
59
- backgroundColor: Colors.black_01 + '33',
60
- borderColor: '#00000066',
61
- borderWidth: useBorder ? 0.5 : 0,
57
+ backgroundColor: '#00000099',
58
+ borderColor: '#FFFFFF33',
62
59
  };
63
60
  }
64
61
 
@@ -135,7 +132,6 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
135
132
  tintColor,
136
133
  preventBack,
137
134
  onPressLeftHeader,
138
- useBorder,
139
135
  }) => {
140
136
  const context = useContext<any>(MiniAppContext);
141
137
  const {navigator} = useContext(ApplicationContext);
@@ -203,10 +199,9 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
203
199
  <View style={styles.headerLeft}>
204
200
  <NavigationButton
205
201
  accessibilityLabel="btn_navigation_back"
206
- icon="ic_back"
202
+ icon="arrow-back"
207
203
  tintColor={tintColor}
208
204
  onPress={goBackSafe}
209
- useBorder={useBorder}
210
205
  />
211
206
  </View>
212
207
  );
@@ -218,9 +213,11 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
218
213
  const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
219
214
  image,
220
215
  animatedValue,
216
+ useGradient = true,
221
217
  }) => {
222
218
  const {theme} = useContext(ApplicationContext);
223
219
  let headerImage = theme.assets?.headerBackground;
220
+ let Component: any = View;
224
221
  if (image === null) {
225
222
  headerImage = undefined;
226
223
  }
@@ -229,7 +226,9 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
229
226
  outputRange: [0, 1],
230
227
  extrapolate: 'clamp',
231
228
  });
232
-
229
+ if (useGradient) {
230
+ Component = LinearGradient;
231
+ }
233
232
  return (
234
233
  <Animated.View
235
234
  style={[
@@ -238,10 +237,11 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
238
237
  overflow: 'hidden',
239
238
  borderBottomWidth: 1,
240
239
  borderColor: theme.colors.border.default,
240
+ backgroundColor: theme.colors.background.surface,
241
241
  opacity,
242
242
  },
243
243
  ]}>
244
- <LinearGradient
244
+ <Component
245
245
  colors={['rgba(253, 202, 222, 1)', 'rgba(253, 202, 222, 0)']}
246
246
  style={styles.extendedHeader}>
247
247
  {!!headerImage && (
@@ -251,8 +251,7 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
251
251
  loading={false}
252
252
  />
253
253
  )}
254
- </LinearGradient>
255
- <Verified />
254
+ </Component>
256
255
  </Animated.View>
257
256
  );
258
257
  };
@@ -303,32 +302,10 @@ const HeaderCustom: React.FC<TitleCustomProps> = ({
303
302
  /**
304
303
  * main component for header right
305
304
  */
306
- const HeaderRight: React.FC<any> = ({type, children, onLayout, ...props}) => {
307
- if (type === 'icon') {
308
- let buttons = props?.buttons || [];
309
- if (buttons?.length > 3) {
310
- buttons = buttons.slice(0, 3);
311
- }
312
- return (
313
- <View style={styles.headerRightButton} onLayout={onLayout}>
314
- {buttons?.map?.((item: NavigationButtonProps, index: number) => {
315
- return (
316
- <View
317
- key={`HeaderRightAction ${index}`}
318
- style={{
319
- marginLeft: index !== 0 ? Spacing.S : 0,
320
- }}>
321
- <NavigationButton {...item} tintColor={props?.tintColor} />
322
- </View>
323
- );
324
- })}
325
- </View>
326
- );
327
- }
328
-
305
+ const HeaderRight: React.FC<any> = ({onLayout, ...props}) => {
329
306
  return (
330
307
  <View style={styles.headerRightButton} onLayout={onLayout}>
331
- {children ?? <HeaderToolkitAction {...props} />}
308
+ <HeaderToolkitAction {...props} />
332
309
  <Verified />
333
310
  </View>
334
311
  );
@@ -340,17 +317,18 @@ const HeaderRight: React.FC<any> = ({type, children, onLayout, ...props}) => {
340
317
  const HeaderToolkitAction: React.FC<any> = ({
341
318
  tintColor,
342
319
  pinnedTool,
343
- runtimeTools = [],
344
320
  preventClose,
345
321
  }) => {
346
322
  const {navigator} = useContext(ApplicationContext);
347
323
  const miniContext = useContext<any>(MiniAppContext);
348
324
  const [toolConfig, setToolConfig] = useState<any>();
349
- const {onAction} = toolConfig ?? {};
350
325
 
351
- let backgroundColor;
352
- if (tintColor !== Colors.black_01) {
353
- backgroundColor = Colors.black_01 + '33';
326
+ let buttonStyle: ViewStyle = {};
327
+ if (tintColor === Colors.black_01) {
328
+ buttonStyle = {
329
+ backgroundColor: '#00000099',
330
+ borderColor: '#FFFFFF33',
331
+ };
354
332
  }
355
333
 
356
334
  useEffect(() => {
@@ -374,19 +352,6 @@ const HeaderToolkitAction: React.FC<any> = ({
374
352
  );
375
353
  };
376
354
 
377
- const onMore = () => {
378
- onAction?.('onMore');
379
- navigator?.maxApi?.dispatchFunction?.(
380
- 'showTools',
381
- {runtimeTools},
382
- (res: {item: {action?: string; key: string}}) => {
383
- const {item} = res;
384
- navigator?.toolkitCallback?.(item.key);
385
- getToolkitConfig();
386
- }
387
- );
388
- };
389
-
390
355
  const onClose = () => {
391
356
  if (preventClose) {
392
357
  navigator?.showModal({
@@ -433,46 +398,35 @@ const HeaderToolkitAction: React.FC<any> = ({
433
398
  getToolkitConfig();
434
399
  }
435
400
  );
436
- navigator?.toolkitCallback?.(pinTool.key);
401
+ navigator?.toolkitCallback?.(pinTool?.key);
437
402
  }}
438
403
  />
439
404
  );
440
405
  };
441
406
 
442
- if (toolConfig) {
443
- return (
444
- <View style={Styles.row}>
445
- {renderPinnedTool()}
446
- <View
447
- style={[
448
- styles.toolkitContainer,
449
- {
450
- backgroundColor: backgroundColor ?? '#00000066',
451
- borderWidth: backgroundColor ? 0.5 : 0,
452
- marginLeft: renderPinnedTool() ? Spacing.S : 0,
453
- },
454
- ]}>
455
- <TouchableOpacity
456
- accessibilityLabel={'btn_navigation_more'}
457
- onPress={onMore}>
458
- <Icon color={tintColor} source="navigation_more_horiz" size={20} />
459
- </TouchableOpacity>
460
- <View style={[styles.divider, {backgroundColor: tintColor}]} />
461
- <TouchableOpacity
462
- accessibilityLabel={'btn_navigation_close'}
463
- onPress={onClose}>
464
- <Icon
465
- color={tintColor}
466
- source="16_navigation_close_circle"
467
- size={20}
468
- />
469
- </TouchableOpacity>
470
- </View>
407
+ return (
408
+ <View style={Styles.row}>
409
+ {renderPinnedTool()}
410
+ <View style={[styles.toolkitContainer, buttonStyle]}>
411
+ <TouchableOpacity
412
+ accessibilityLabel={'btn_navigation_help_center'}
413
+ style={styles.toolkitButton}>
414
+ <Icon color={tintColor} source="help_center" size={20} />
415
+ </TouchableOpacity>
416
+ <View style={[styles.divider, {backgroundColor: tintColor}]} />
417
+ <TouchableOpacity
418
+ accessibilityLabel={'btn_navigation_close'}
419
+ onPress={onClose}
420
+ style={styles.toolkitButton}>
421
+ <Icon
422
+ color={tintColor}
423
+ source="16_navigation_close_circle"
424
+ size={20}
425
+ />
426
+ </TouchableOpacity>
471
427
  </View>
472
- );
473
- }
474
-
475
- return <View />;
428
+ </View>
429
+ );
476
430
  };
477
431
 
478
432
  /**
@@ -671,35 +625,8 @@ const HeaderExtendHeader: React.FC<{
671
625
  return <View />;
672
626
  };
673
627
 
674
- const HeaderRightAction: React.FC<any> = ({children, ...restProps}) => {
675
- if (__DEV__) {
676
- Alert.alert(
677
- 'HeaderRightAction',
678
- 'This component is deprecated and will removed 10/2024, please use new type headerRight specs instead v0.92.34'
679
- );
680
- }
681
- const validateType = (child: React.ReactElement) => {
682
- return child;
683
- };
684
-
685
- const renderAction = () => {
686
- if (Array.isArray(children)) {
687
- return children.map((child, index) => {
688
- return (
689
- <View key={`HeaderRightAction ${index}`} style={styles.headerButton}>
690
- {React.cloneElement(validateType(child), {...restProps})}
691
- </View>
692
- );
693
- });
694
- }
695
-
696
- return (
697
- <View style={styles.headerButton}>
698
- {React.cloneElement(validateType(children), {...restProps})}
699
- </View>
700
- );
701
- };
702
- return <View style={styles.headerRightButton}>{renderAction()}</View>;
628
+ const HeaderRightAction: React.FC<any> = () => {
629
+ return <View />;
703
630
  };
704
631
 
705
632
  const Verified: React.FC<any> = () => {
@@ -717,6 +644,9 @@ const styles = StyleSheet.create({
717
644
  borderRadius: 14,
718
645
  justifyContent: 'center',
719
646
  alignItems: 'center',
647
+ backgroundColor: '#FFFFFF99',
648
+ borderColor: '#00000033',
649
+ borderWidth: 0.2,
720
650
  },
721
651
  headerBackground: {
722
652
  width: '100%',
@@ -749,18 +679,22 @@ const styles = StyleSheet.create({
749
679
  paddingRight: Spacing.M,
750
680
  },
751
681
  toolkitContainer: {
752
- padding: Spacing.XS,
682
+ paddingHorizontal: Spacing.XS,
753
683
  height: 28,
754
684
  borderRadius: 14,
755
- borderColor: '#00000066',
756
685
  justifyContent: 'center',
757
686
  alignItems: 'center',
758
687
  flexDirection: 'row',
688
+ backgroundColor: '#FFFFFF99',
689
+ borderColor: '#00000033',
690
+ borderWidth: 0.2,
691
+ },
692
+ toolkitButton: {
693
+ padding: 4,
759
694
  },
760
695
  divider: {
761
- width: 1,
696
+ width: 0.5,
762
697
  height: 12,
763
- marginHorizontal: 4,
764
698
  },
765
699
  headerLeft: {
766
700
  marginLeft: 12,
@@ -19,7 +19,10 @@ class Navigation {
19
19
  console.warn('headerLeft not allow override render by design system!');
20
20
  delete params.headerLeft;
21
21
  }
22
-
22
+ if (params.headerRight && params.headerRight !== 'object') {
23
+ console.warn('headerRight not allow type func render by design system!');
24
+ delete params.headerRight;
25
+ }
23
26
  return params;
24
27
  };
25
28
 
@@ -13,12 +13,13 @@ import {getDialogOptions, getModalOptions, getStackOptions} from './utils';
13
13
  import {NavigationContainerProps} from './types';
14
14
  import {ApplicationContext} from './index';
15
15
  import Localize from './Localize';
16
+ import {defaultTheme} from '../Consts';
16
17
 
17
18
  const Stack = createStackNavigator();
18
19
 
19
20
  const NavigationContainer: React.FC<NavigationContainerProps> = ({
20
21
  screen,
21
- theme,
22
+ theme = defaultTheme,
22
23
  options,
23
24
  maxApi,
24
25
  initialParams,
@@ -38,6 +38,7 @@ class Navigator {
38
38
  this.ref.current?.dispatch?.(StackActions.replace('Stack', params));
39
39
  }
40
40
  };
41
+
41
42
  /**
42
43
  * pop to dismiss a screen
43
44
  * @param count
@@ -61,25 +62,42 @@ class Navigator {
61
62
  /**
62
63
  * show a modal popup
63
64
  * @param params
65
+ * @param onError
64
66
  */
65
- showModal = (params: ModalParams) => {
66
- if (this.isReady.current) {
67
- this.ref.current?.dispatch?.(StackActions.push('Modal', params));
67
+ showModal = (params: ModalParams, onError?: (error: string) => void) => {
68
+ try {
69
+ if (this.isReady.current) {
70
+ this.ref.current?.dispatch?.(StackActions.push('Modal', params));
71
+ } else {
72
+ onError?.('NavigationContainer not ready');
73
+ }
74
+ } catch (error) {
75
+ onError?.(`${error}`);
68
76
  }
69
77
  };
70
78
 
71
79
  /**
72
80
  * show a bottom sheet
73
81
  * @param params
82
+ * @param onError
74
83
  */
75
- showBottomSheet = (params: BottomSheetParams) => {
76
- if (this.isReady.current) {
77
- this.ref.current?.dispatch?.(
78
- StackActions.push('Modal', {
79
- ...params,
80
- isBottomSheet: true,
81
- })
82
- );
84
+ showBottomSheet = (
85
+ params: BottomSheetParams,
86
+ onError?: (error: string) => void
87
+ ) => {
88
+ try {
89
+ if (this.isReady.current) {
90
+ this.ref.current?.dispatch?.(
91
+ StackActions.push('Modal', {
92
+ ...params,
93
+ isBottomSheet: true,
94
+ })
95
+ );
96
+ } else {
97
+ onError?.('NavigationContainer not ready');
98
+ }
99
+ } catch (error) {
100
+ onError?.(`${error}`);
83
101
  }
84
102
  };
85
103
 
@@ -50,18 +50,9 @@ const StackScreen: React.FC<ScreenParams> = props => {
50
50
  * set options for screen
51
51
  */
52
52
  useLayoutEffect(() => {
53
- let defaultOptions = {
54
- headerRight: {
55
- type: 'toolkit',
56
- },
57
- };
58
53
  if (options) {
59
- defaultOptions = {
60
- ...defaultOptions,
61
- ...options,
62
- };
54
+ navigation.setOptions(options);
63
55
  }
64
- navigation.setOptions(defaultOptions);
65
56
  }, [options]);
66
57
 
67
58
  /**
@@ -127,7 +127,6 @@ export type BottomSheetParams = {
127
127
  export type NavigationButtonProps = {
128
128
  icon: string;
129
129
  tintColor?: string;
130
- useBorder?: boolean;
131
130
  onPress: () => void;
132
131
  badgeType?: 'dot' | 'number' | 'dot-animation';
133
132
  badgeValue?: number;
@@ -152,20 +151,13 @@ export interface NavigationOptions
152
151
  onPressLeftHeader?: () => void;
153
152
  hiddenBack?: boolean;
154
153
  customTitle?: TitleCustomProps;
155
- headerRight?: HeaderRightToolkit | HeaderRightActions | any;
154
+ headerRight?: HeaderRightToolkit | any;
156
155
  }
157
156
 
158
157
  export type HeaderRightToolkit = {
159
- type?: 'toolkit';
160
158
  pinnedTool?: PinnedToolType;
161
159
  runtimeTools?: RuntimeToolType[];
162
160
  preventClose?: PopupNotifyProps;
163
- useMore?: boolean;
164
- };
165
-
166
- export type HeaderRightActions = {
167
- type?: 'icon';
168
- buttons: NavigationButtonProps[];
169
161
  };
170
162
 
171
163
  export interface HeaderBackProps extends NavigationButtonProps {
@@ -176,6 +168,8 @@ export interface HeaderBackProps extends NavigationButtonProps {
176
168
  export type HeaderBackgroundProps = {
177
169
  image?: string | null;
178
170
  animatedValue?: Animated.Value;
171
+ useGradient?: boolean;
172
+ backgroundColor?: string;
179
173
  };
180
174
 
181
175
  export type TitleCustomProps = {
@@ -236,7 +230,7 @@ export type FloatingButtonProps = {
236
230
  };
237
231
 
238
232
  export type AnimatedHeader = {
239
- type: 'default';
233
+ headerTintColor?: string;
240
234
  component?: (props?: any) => React.ReactElement;
241
235
  headerTitle?: (props?: any) => React.ReactElement;
242
236
  };
@@ -38,6 +38,7 @@ const getDialogOptions = (): StackNavigationOptions => {
38
38
  headerTitle: HeaderTitle,
39
39
  headerLeft: (props: any) => <HeaderLeft {...props} />,
40
40
  headerBackground: (props: any) => <HeaderBackground {...props} />,
41
+ headerRight: (props: any) => <HeaderRight {...props} />,
41
42
  headerTintColor: Colors.black_17,
42
43
  ...TransitionPresets.ModalTransition,
43
44
  };
@@ -121,7 +122,7 @@ const getOptions = (params: NavigationOptions, navigation?: Navigation) => {
121
122
  * header right
122
123
  */
123
124
  if (params.headerRight) {
124
- let headerRight: any = (props: any) => {
125
+ const headerRight = (props: any) => {
125
126
  return (
126
127
  <HeaderRight
127
128
  {...props}
@@ -132,19 +133,6 @@ const getOptions = (params: NavigationOptions, navigation?: Navigation) => {
132
133
  />
133
134
  );
134
135
  };
135
- if (typeof params.headerRight === 'function') {
136
- headerRight = (props: any) => {
137
- return (
138
- <HeaderRight
139
- {...props}
140
- onLayout={(e: LayoutChangeEvent) => {
141
- navigation?.onHeaderRightChange?.(e.nativeEvent.layout.width);
142
- }}>
143
- {params.headerRight(props)}
144
- </HeaderRight>
145
- );
146
- };
147
- }
148
136
  options = {
149
137
  ...options,
150
138
  headerRight,
@@ -164,6 +152,7 @@ const formatNameLength = (name = '') => {
164
152
  }
165
153
  return formattedName;
166
154
  };
155
+
167
156
  export {
168
157
  getStackOptions,
169
158
  getDialogOptions,
package/Assets/icon.json CHANGED
@@ -4027,5 +4027,11 @@
4027
4027
  },
4028
4028
  "travel_suitcase": {
4029
4029
  "uri": "https://static.momocdn.net/app/img/kits/travel_suitcase.png"
4030
+ },
4031
+ "help_center": {
4032
+ "uri": "https://static.momocdn.net/app/img/kits/help-center.png"
4033
+ },
4034
+ "arrow-back": {
4035
+ "uri": "https://static.momocdn.net/app/img/kits/arrow-back.png"
4030
4036
  }
4031
4037
  }
package/Button/index.tsx CHANGED
@@ -289,14 +289,6 @@ const Button: FC<ButtonProps> = ({
289
289
  full && {width: '100%'},
290
290
  ]);
291
291
 
292
- const onPressButton = () => {
293
- if (type === 'disabled') {
294
- return () => {};
295
- }
296
- onPress?.();
297
- };
298
-
299
- const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
300
292
  return (
301
293
  <ComponentContext.Provider
302
294
  value={{
@@ -309,9 +301,10 @@ const Button: FC<ButtonProps> = ({
309
301
  }}>
310
302
  <TouchableOpacity
311
303
  {...rest}
304
+ disabled={type === 'disabled'}
312
305
  accessibilityLabel={accessibilityLabel}
313
- activeOpacity={activeOpacity}
314
- onPress={onPressButton}
306
+ activeOpacity={0.5}
307
+ onPress={onPress}
315
308
  style={buttonStyle}>
316
309
  {renderLeading()}
317
310
  {renderTitle()}
package/Icon/index.tsx CHANGED
@@ -10,6 +10,7 @@ const Icon: React.FC<IconProps> = ({
10
10
  size = 24,
11
11
  color,
12
12
  style = {},
13
+ accessibilityLabel,
13
14
  }) => {
14
15
  const {theme} = useContext(ApplicationContext);
15
16
 
@@ -34,6 +35,7 @@ const Icon: React.FC<IconProps> = ({
34
35
  source={getIconSource()}
35
36
  style={[style, {width: size, height: size}]}
36
37
  resizeMode="contain"
38
+ accessibilityLabel={accessibilityLabel}
37
39
  {...tintColorProps}
38
40
  />
39
41
  );
package/Icon/types.ts CHANGED
@@ -24,4 +24,9 @@ export type IconProps = {
24
24
  * Accepts an object of style properties.
25
25
  */
26
26
  style?: StyleProp<ImageStyle>;
27
+
28
+ /**
29
+ * Optional. Represents the accessibility label for the icon.
30
+ */
31
+ accessibilityLabel?: string;
27
32
  };
@@ -1,6 +1,5 @@
1
1
  import React, {useContext} from 'react';
2
2
  import {
3
- GestureResponderEvent,
4
3
  StyleSheet,
5
4
  TouchableOpacity,
6
5
  TouchableOpacityProps,
@@ -109,17 +108,6 @@ const IconButton: React.FC<IconButtonProps> = ({
109
108
  }
110
109
  };
111
110
 
112
- /**
113
- * handle press
114
- * @param e
115
- */
116
- const onPressButton = (e: GestureResponderEvent) => {
117
- if (type === 'disabled') {
118
- return () => {};
119
- }
120
- onPress?.(e);
121
- };
122
-
123
111
  const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
124
112
  const buttonStyle = StyleSheet.flatten([getTypeStyle(), getSizeStyle()]);
125
113
  const iconSize = size === 'small' ? 16 : 24;
@@ -136,9 +124,10 @@ const IconButton: React.FC<IconButtonProps> = ({
136
124
  }}>
137
125
  <TouchableOpacity
138
126
  {...rest}
127
+ disabled={type === 'disabled'}
139
128
  accessibilityLabel={accessibilityLabel}
140
129
  activeOpacity={activeOpacity}
141
- onPress={onPressButton}
130
+ onPress={onPress}
142
131
  style={buttonStyle}>
143
132
  <Icon size={iconSize} source={icon} color={getIconColor()} />
144
133
  </TouchableOpacity>
package/Image/index.tsx CHANGED
@@ -1,12 +1,8 @@
1
- import React, {useContext, useEffect, useRef, useState} from 'react';
1
+ import React, {useContext, useRef, useState} from 'react';
2
2
  import {StyleSheet, View} from 'react-native';
3
3
  import FastImage, {Source} from 'react-native-fast-image';
4
4
  import styles from './styles';
5
- import {
6
- ApplicationContext,
7
- ComponentContext,
8
- MiniAppContext,
9
- } from '../Application';
5
+ import {ApplicationContext} from '../Application';
10
6
  import {Skeleton} from '../Skeleton';
11
7
  import {Icon} from '../Icon';
12
8
  import {Styles} from '../Consts';
@@ -23,8 +19,6 @@ const Image: React.FC<ImageProps> = ({
23
19
  ...rest
24
20
  }) => {
25
21
  const {theme} = useContext(ApplicationContext);
26
- const app = useContext<any>(MiniAppContext);
27
- const component = useContext<any>(ComponentContext);
28
22
  const error = useRef(false);
29
23
  const [status, setStatus] = useState<Status>('success');
30
24
 
@@ -32,13 +26,6 @@ const Image: React.FC<ImageProps> = ({
32
26
  accessibilityLabel: accessibilityLabel || `img|${(source as Source).uri}`,
33
27
  };
34
28
 
35
- useEffect(() => {
36
- if (app.enableAutoId) {
37
- component?.addChildren?.(test.accessibilityLabel, 'add');
38
- return () => component?.addChildren?.(test.accessibilityLabel, 'remove');
39
- }
40
- }, []);
41
-
42
29
  /**
43
30
  * render content loading | fail | rendered
44
31
  */
package/Layout/Screen.tsx CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  } from '../Application';
27
27
  import Navigation from '../Application/Navigation';
28
28
  import {AnimatedHeader, NavigationOptions} from '../Application/types';
29
- import {Spacing, Styles} from '../Consts';
29
+ import {Colors, Spacing, Styles} from '../Consts';
30
30
  import {FloatingButton, FloatingButtonProps} from './FloatingButton';
31
31
  import {Card, Section, validateChildren} from './index';
32
32
  import styles from './styles';
@@ -138,6 +138,7 @@ const Screen = forwardRef(
138
138
  const insets = useSafeAreaInsets();
139
139
  const heightHeader = useHeaderHeight();
140
140
  const animatedValue = useRef<Animated.Value>(new Animated.Value(0));
141
+ const currentTint = useRef<string>(Colors.black_01);
141
142
  const isTab = navigation?.instance?.getState?.()?.type === 'tab';
142
143
 
143
144
  let handleScroll;
@@ -193,6 +194,7 @@ const Screen = forwardRef(
193
194
  headerTransparent: false,
194
195
  headerShown: true,
195
196
  headerBackground: (props: any) => <HeaderBackground {...props} />,
197
+ headerTitle: (props: any) => <HeaderTitle {...props} />,
196
198
  };
197
199
  if (inputSearchProps) {
198
200
  options = {
@@ -219,11 +221,13 @@ const Screen = forwardRef(
219
221
  */
220
222
  if (animatedHeader) {
221
223
  options = {
224
+ headerTintColor: animatedHeader.headerTintColor ?? Colors.black_01,
222
225
  headerTransparent: true,
223
226
  headerBackground: (props: any) => (
224
227
  <HeaderBackground
225
228
  {...props}
226
229
  animatedValue={animatedValue.current}
230
+ useGradient={false}
227
231
  />
228
232
  ),
229
233
  headerTitle: (props: any) => (
@@ -233,11 +237,12 @@ const Screen = forwardRef(
233
237
  if (animatedHeader.headerTitle) {
234
238
  options = {
235
239
  ...options,
236
- headerTitle: (props: any) =>
237
- animatedHeader.headerTitle?.({
240
+ headerTitle: (props: any) => {
241
+ return animatedHeader.headerTitle?.({
238
242
  ...props,
239
243
  animatedValue: animatedValue.current,
240
- }),
244
+ });
245
+ },
241
246
  };
242
247
  }
243
248
  }
@@ -250,24 +255,34 @@ const Screen = forwardRef(
250
255
  */
251
256
  if (scrollable) {
252
257
  Component = Animated.ScrollView;
253
- handleScroll = scrollViewProps?.onScroll;
254
- if (animatedHeader || floatingButtonProps?.icon || inputSearchProps) {
255
- handleScroll = Animated.event(
256
- [
257
- {
258
- nativeEvent: {
259
- contentOffset: {y: animatedValue.current as Animated.Value},
260
- },
261
- },
262
- ],
258
+ handleScroll = Animated.event(
259
+ [
263
260
  {
264
- useNativeDriver: true,
265
- listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
266
- scrollViewProps?.onScroll?.(e);
261
+ nativeEvent: {
262
+ contentOffset: {y: animatedValue.current as Animated.Value},
267
263
  },
268
- }
269
- );
270
- }
264
+ },
265
+ ],
266
+ {
267
+ useNativeDriver: true,
268
+ listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
269
+ scrollViewProps?.onScroll?.(e);
270
+ if (animatedHeader) {
271
+ const offsetY = e.nativeEvent.contentOffset.y;
272
+ let color = Colors.black_01;
273
+ if (offsetY > 50) {
274
+ color = theme.colors.text.default;
275
+ }
276
+ if (color !== currentTint.current) {
277
+ currentTint.current = color;
278
+ navigation?.setOptions({
279
+ headerTintColor: color,
280
+ });
281
+ }
282
+ }
283
+ },
284
+ }
285
+ );
271
286
  }
272
287
 
273
288
  /**
package/Layout/styles.ts CHANGED
@@ -42,7 +42,6 @@ export default StyleSheet.create({
42
42
  padding: 12,
43
43
  },
44
44
  item: {
45
- overflow: 'hidden',
46
45
  margin: undefined,
47
46
  marginTop: undefined,
48
47
  marginBottom: undefined,
@@ -5,7 +5,7 @@ import {ApplicationContext} from '../Application';
5
5
  import {hexToRGBA} from './utils';
6
6
  import {LoaderProps} from './types';
7
7
 
8
- const DotLoader: FC<LoaderProps> = ({color}) => {
8
+ const DotLoader: FC<LoaderProps> = ({color, style}) => {
9
9
  const {theme} = useContext(ApplicationContext);
10
10
 
11
11
  const arrayColor = [
@@ -28,7 +28,7 @@ const DotLoader: FC<LoaderProps> = ({color}) => {
28
28
  return (
29
29
  <AnimatedLottieView
30
30
  source={source}
31
- style={{width: 52, height: 18}}
31
+ style={[{width: 52, height: 18}, style]}
32
32
  autoPlay
33
33
  />
34
34
  );
@@ -5,7 +5,7 @@ import {hexToRGBA} from './utils';
5
5
  import {ApplicationContext} from '../Application';
6
6
  import {LoaderProps} from './types';
7
7
 
8
- const Spinner: FC<LoaderProps> = ({color}) => {
8
+ const Spinner: FC<LoaderProps> = ({color, style}) => {
9
9
  const {theme} = useContext(ApplicationContext);
10
10
 
11
11
  let source: any = animation;
@@ -20,7 +20,7 @@ const Spinner: FC<LoaderProps> = ({color}) => {
20
20
  return (
21
21
  <AnimatedLottieView
22
22
  source={source}
23
- style={{width: 24, height: 24}}
23
+ style={[{width: 24, height: 24}, style]}
24
24
  autoPlay
25
25
  />
26
26
  );
package/Text/utils.ts CHANGED
@@ -12,10 +12,11 @@ const scaleSize = (size: number) => {
12
12
  return size;
13
13
  };
14
14
  const getAccessibilityID = (accessibilityLabel = '') => {
15
- if (Platform.OS ==='ios') {
15
+ if (Platform.OS === 'ios') {
16
16
  return {
17
17
  accessible: true,
18
18
  testID: accessibilityLabel,
19
+ accessibilityLabel: undefined,
19
20
  };
20
21
  } else {
21
22
  return {
@@ -23,4 +24,4 @@ const getAccessibilityID = (accessibilityLabel = '') => {
23
24
  };
24
25
  }
25
26
  };
26
- export {scaleSize,getAccessibilityID};
27
+ export {scaleSize, getAccessibilityID};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.104.1-beta.13",
3
+ "version": "0.104.1-beta.15",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},