@momo-kits/foundation 0.102.1-beta.1 → 0.102.1-beta.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.
@@ -1,4 +1,7 @@
1
- import {StackNavigationOptions} from '@react-navigation/stack';
1
+ import {
2
+ StackHeaderTitleProps,
3
+ StackNavigationOptions,
4
+ } from '@react-navigation/stack';
2
5
  import {EventArg} from '@react-navigation/core';
3
6
  import React from 'react';
4
7
  import {Animated, ViewProps} from 'react-native';
@@ -237,8 +240,21 @@ export type FloatingButtonProps = {
237
240
  onPress: () => void;
238
241
  };
239
242
 
240
- export type AnimatedHeader = {
243
+ export type AnimatedDefaultType = {
241
244
  type: 'default' | 'surface';
242
- component?: (props?: any) => React.ReactElement;
243
- headerTitle?: (props?: any) => React.ReactElement;
245
+ component?: (props?: {animatedValue: Animated.Value}) => React.ReactElement;
246
+ headerTitle?: (
247
+ props?: StackHeaderTitleProps & {animatedValue: Animated.Value}
248
+ ) => React.ReactElement;
244
249
  };
250
+
251
+ export type AnimatedNormalType = {
252
+ type: 'default';
253
+ } & AnimatedDefaultType;
254
+
255
+ export type AnimatedSurfaceType = {
256
+ type: 'surface';
257
+ alwaysShowTitle?: boolean;
258
+ } & AnimatedDefaultType;
259
+
260
+ export type AnimatedHeader = AnimatedNormalType | AnimatedSurfaceType;
package/Badge/Badge.tsx CHANGED
@@ -7,12 +7,7 @@ import styles from './styles';
7
7
  import {Colors} from '../Consts';
8
8
  import {Text} from '../Text';
9
9
 
10
- const Badge: FC<BadgeProps> = ({
11
- label = 'Label',
12
- style,
13
- backgroundColor,
14
- accessibilityLabel,
15
- }) => {
10
+ const Badge: FC<BadgeProps> = ({label = 'Label', style, backgroundColor}) => {
16
11
  const {theme} = useContext(ApplicationContext);
17
12
 
18
13
  const isValidatedColor = () => {
@@ -51,10 +46,7 @@ const Badge: FC<BadgeProps> = ({
51
46
 
52
47
  return (
53
48
  <View style={[style, styles.badge, {backgroundColor: badgeColor}]}>
54
- <Text
55
- color={Colors.black_01}
56
- typography={'action_xxs_bold'}
57
- accessibilityLabel={accessibilityLabel}>
49
+ <Text color={Colors.black_01} typography={'action_xxs_bold'}>
58
50
  {formatTitle()}
59
51
  </Text>
60
52
  </View>
package/Badge/types.ts CHANGED
@@ -18,8 +18,6 @@ export type BadgeProps = {
18
18
  * Optional. Custom background badge.
19
19
  */
20
20
  backgroundColor?: string;
21
-
22
- accessibilityLabel?: string;
23
21
  };
24
22
 
25
23
  /**
package/Input/Input.tsx CHANGED
@@ -60,8 +60,6 @@ const Input = forwardRef(
60
60
  accessibilityLabel,
61
61
  editable = true,
62
62
  onPressFloatingIcon,
63
- trailingAccessibilityLabel,
64
- closeAccessibilityLabel,
65
63
  ...props
66
64
  }: InputProps,
67
65
  ref
@@ -112,7 +110,6 @@ const Input = forwardRef(
112
110
  if (secureTextEntry) {
113
111
  return (
114
112
  <TouchableOpacity
115
- accessibilityLabel={trailingAccessibilityLabel}
116
113
  onPress={() => setSecureTextInput(!secureTextInput)}
117
114
  style={styles.icon}>
118
115
  <Icon
@@ -129,7 +126,6 @@ const Input = forwardRef(
129
126
  const renderIconTouchable = (icon: ReactNode) => {
130
127
  return (
131
128
  <TouchableOpacity
132
- accessibilityLabel={trailingAccessibilityLabel}
133
129
  onPress={onPressTrailing ?? onPressIcon}
134
130
  style={styles.icon}>
135
131
  {icon}
@@ -235,7 +231,6 @@ const Input = forwardRef(
235
231
  <View style={styles.iconView}>
236
232
  {focused && haveValue && (
237
233
  <TouchableOpacity
238
- accessibilityLabel={closeAccessibilityLabel}
239
234
  style={styles.iconWrapper}
240
235
  onPress={onClearText}>
241
236
  <Icon
package/Input/index.tsx CHANGED
@@ -118,9 +118,6 @@ export interface InputProps extends TextInputProps {
118
118
  hintText?: string;
119
119
 
120
120
  onPressFloatingIcon?: (e: GestureResponderEvent) => void;
121
-
122
- trailingAccessibilityLabel?: string;
123
- closeAccessibilityLabel?: string;
124
121
  }
125
122
 
126
123
  export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
package/Layout/Screen.tsx CHANGED
@@ -270,6 +270,9 @@ const Screen = forwardRef(
270
270
  if (animatedHeader.type === 'surface') {
271
271
  options = {
272
272
  ...options,
273
+ headerTintColor: animatedHeader.alwaysShowTitle
274
+ ? theme.colors.text.default
275
+ : undefined,
273
276
  headerBackground: (props: any) => (
274
277
  <HeaderBackground
275
278
  {...props}
@@ -278,6 +281,16 @@ const Screen = forwardRef(
278
281
  animatedValue={animatedValue.current}
279
282
  />
280
283
  ),
284
+ headerTitle: (props: any) => (
285
+ <HeaderTitle
286
+ {...props}
287
+ animatedValue={
288
+ animatedHeader.alwaysShowTitle
289
+ ? undefined
290
+ : animatedValue.current
291
+ }
292
+ />
293
+ ),
281
294
  };
282
295
  }
283
296
  if (animatedHeader.headerTitle) {
@@ -314,7 +327,10 @@ const Screen = forwardRef(
314
327
  useNativeDriver: true,
315
328
  listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
316
329
  scrollViewProps?.onScroll?.(e);
317
- if (animatedHeader?.type === 'surface') {
330
+ if (
331
+ animatedHeader?.type === 'surface' &&
332
+ !animatedHeader?.alwaysShowTitle
333
+ ) {
318
334
  const offsetY = e.nativeEvent.contentOffset.y;
319
335
  let color = Colors.black_01;
320
336
  if (offsetY > 50) {
@@ -354,6 +370,12 @@ const Screen = forwardRef(
354
370
  * render top navigation banner
355
371
  */
356
372
  const renderAnimatedHeader = () => {
373
+ if (
374
+ animatedHeader?.type === 'surface' &&
375
+ animatedHeader?.alwaysShowTitle
376
+ ) {
377
+ return <View style={{height: heightHeader}} />;
378
+ }
357
379
  if (typeof animatedHeader?.component === 'function') {
358
380
  return (
359
381
  <View style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
package/Tag/index.tsx CHANGED
@@ -31,7 +31,6 @@ const Tag: FC<TagProps> = ({
31
31
  size = 'large',
32
32
  style,
33
33
  customColor,
34
- accessibilityLabel,
35
34
  }) => {
36
35
  let labelColor = textColor[color];
37
36
  let tagColor = backgroundColor[color];
@@ -70,10 +69,7 @@ const Tag: FC<TagProps> = ({
70
69
  color={labelColor}
71
70
  />
72
71
  )}
73
- <Text
74
- color={labelColor}
75
- typography={'label_s_medium'}
76
- accessibilityLabel={accessibilityLabel}>
72
+ <Text color={labelColor} typography={'label_s_medium'}>
77
73
  {label}
78
74
  </Text>
79
75
  </View>
package/Tag/types.ts CHANGED
@@ -33,6 +33,4 @@ export type TagProps = {
33
33
  * that can be applied to the Tag component.
34
34
  */
35
35
  customColor?: string;
36
-
37
- accessibilityLabel?: string;
38
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.102.1-beta.1",
3
+ "version": "0.102.1-beta.3",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},