@momo-kits/foundation 0.92.1-rc.11 → 0.92.1-rc.12

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.
@@ -28,6 +28,7 @@ import {Radius} from '../../Consts';
28
28
  import {Icon} from '../../Icon';
29
29
  import {Text} from '../../Text';
30
30
  import {FloatingButtonProps} from '../types';
31
+ import {getAccessibilityID} from '../utils';
31
32
 
32
33
  type Props = BottomTabBarProps & {
33
34
  activeTintColor?: string;
@@ -316,6 +317,7 @@ export default function BottomTabBar({
316
317
  labelStyle={labelStyle}
317
318
  iconStyle={iconStyle}
318
319
  style={tabStyle}
320
+ {...getAccessibilityID(`btn_tabbar_${route.name}`)}
319
321
  />
320
322
  </NavigationRouteContext.Provider>
321
323
  </NavigationContext.Provider>
@@ -63,11 +63,14 @@ const BottomTab: React.FC<BottomTabProps> = ({
63
63
 
64
64
  return (
65
65
  <Tab.Navigator
66
- {...getAccessibilityID('tbr_main_bottom')}
67
66
  initialRouteName={initialRouteName}
68
67
  backBehavior={'firstRoute'}
69
68
  tabBar={props => (
70
- <BottomTabBar {...props} floatingButton={floatingButton} />
69
+ <BottomTabBar
70
+ {...getAccessibilityID('tbr_main_bottom')}
71
+ {...props}
72
+ floatingButton={floatingButton}
73
+ />
71
74
  )}
72
75
  tabBarOptions={{
73
76
  style: {
@@ -81,7 +84,6 @@ const BottomTab: React.FC<BottomTabProps> = ({
81
84
  {tabs.map(item => {
82
85
  return (
83
86
  <Tab.Screen
84
- {...getAccessibilityID(`btn_tabbar_${item.name}`)}
85
87
  key={item.name}
86
88
  name={item.name}
87
89
  component={TabScreen}
package/Input/Input.tsx CHANGED
@@ -133,7 +133,9 @@ const Input = forwardRef(
133
133
  : getAccessibilityID(
134
134
  `${appId}/${code}/${
135
135
  screenInfo.screenName
136
- }/input_${cleanNameForTracking(floatingValue ?? placeholder)}`,
136
+ }/input_${cleanNameForTracking(
137
+ floatingValue ?? placeholder ?? value,
138
+ )}`,
137
139
  );
138
140
 
139
141
  if (disabled) {
package/Radio/index.tsx CHANGED
@@ -54,7 +54,7 @@ const Radio: FC<RadioProps> = ({
54
54
  const accessibilityID = getAccessibilityID?.(
55
55
  `${appId}/${code}/${screenInfo.screenName}/rdo_${cleanNameForTracking(
56
56
  label,
57
- )}_${value}`,
57
+ )}_${selected}`,
58
58
  );
59
59
 
60
60
  return (
package/Title/index.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, {FC, useContext} from 'react';
1
+ import React, {FC, useContext, useState} from 'react';
2
2
  import {Text as RNText, TouchableOpacity, View, ViewStyle} from 'react-native';
3
3
  import styles from './styles';
4
4
  import {Icon} from '../Icon';
@@ -24,7 +24,8 @@ const Title: FC<TitleProps> = ({
24
24
  buttonSize = 'small',
25
25
  }) => {
26
26
  const {theme} = useContext(ApplicationContext);
27
-
27
+ const [badgeWidth, setBadgeWidth] = useState(0);
28
+ const [contentWidth, setContentWidth] = useState(0);
28
29
  const styleSheet: {
29
30
  [key: string]: any;
30
31
  } = styles;
@@ -33,6 +34,7 @@ const Title: FC<TitleProps> = ({
33
34
  const numberOfLines = showLeftAction || !!badgeLabel ? 1 : 2;
34
35
  const buttonTypo: Typography =
35
36
  buttonSize === 'small' ? 'action_xs_bold' : 'action_s_bold';
37
+ const flexStyle = showLeftAction && {maxWidth: '70%'};
36
38
 
37
39
  const renderIcon = () => {
38
40
  if (!icon) return null;
@@ -59,16 +61,31 @@ const Title: FC<TitleProps> = ({
59
61
  const renderContent = () => {
60
62
  return (
61
63
  <View style={styles.contentView}>
62
- <View style={[styles.iconLeftView]}>
64
+ <View
65
+ onLayout={e => {
66
+ setContentWidth(e.nativeEvent.layout.width);
67
+ }}
68
+ style={[styles.iconLeftView, flexStyle]}>
63
69
  <RNText
64
70
  numberOfLines={numberOfLines}
65
- style={[styleSheet[typography], styles.title]}>
71
+ style={[
72
+ styleSheet[typography],
73
+ styles.title,
74
+ {maxWidth: contentWidth - badgeWidth},
75
+ ]}>
66
76
  {title}
67
77
  </RNText>
68
-
69
- <View style={{alignItems: 'center'}}>
70
- {badgeLabel && <Badge style={styles.badge} label={badgeLabel} />}
71
- </View>
78
+ {badgeLabel && (
79
+ <View
80
+ onLayout={e => {
81
+ setBadgeWidth(e.nativeEvent.layout.width);
82
+ }}
83
+ style={{
84
+ alignItems: 'center',
85
+ }}>
86
+ <Badge style={styles.badge} label={badgeLabel} />
87
+ </View>
88
+ )}
72
89
  {renderActionLeft()}
73
90
  </View>
74
91
  <Text
package/Title/styles.ts CHANGED
@@ -70,7 +70,6 @@ export default StyleSheet.create({
70
70
  title: {
71
71
  fontWeight: 'bold',
72
72
  marginBottom: Spacing.XS,
73
- flex: 1,
74
73
  },
75
74
  badge: {
76
75
  marginLeft: Spacing.XS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.1-rc.11",
3
+ "version": "0.92.1-rc.12",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {