@momo-kits/foundation 0.92.1-rc.16 → 0.92.1-rc.2
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.
- package/Application/BottomTab/BottomTabBar.tsx +41 -13
- package/Application/BottomTab/CurvedView.tsx +27 -0
- package/Application/BottomTab/index.tsx +5 -7
- package/Application/BottomTab/path.ts +202 -0
- package/Application/StackScreen.tsx +1 -1
- package/Application/types.ts +0 -1
- package/Input/Input.tsx +1 -3
- package/Input/InputSearch.tsx +1 -1
- package/Radio/index.tsx +1 -1
- package/Text/styles.ts +1 -1
- package/Text/types.ts +1 -1
- package/Title/index.tsx +18 -24
- package/Title/styles.ts +5 -10
- package/package.json +3 -1
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import React, {useCallback} from 'react';
|
|
15
15
|
import {
|
|
16
16
|
Animated,
|
|
17
|
+
Dimensions,
|
|
17
18
|
LayoutChangeEvent,
|
|
18
19
|
Platform,
|
|
19
20
|
StyleProp,
|
|
@@ -27,8 +28,10 @@ import {EdgeInsets, useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
|
27
28
|
import {Radius} from '../../Consts';
|
|
28
29
|
import {Icon} from '../../Icon';
|
|
29
30
|
import {Text} from '../../Text';
|
|
31
|
+
import {CurvedViewComponent} from './CurvedView';
|
|
32
|
+
import {getPathUp} from './path';
|
|
30
33
|
import {FloatingButtonProps} from '../types';
|
|
31
|
-
|
|
34
|
+
const {width} = Dimensions.get('window');
|
|
32
35
|
|
|
33
36
|
type Props = BottomTabBarProps & {
|
|
34
37
|
activeTintColor?: string;
|
|
@@ -162,10 +165,10 @@ export default function BottomTabBar({
|
|
|
162
165
|
tabStyle,
|
|
163
166
|
});
|
|
164
167
|
const focusedRoute = state.routes[state.index] as any;
|
|
165
|
-
const focusedDescriptor = descriptors[focusedRoute
|
|
166
|
-
const focusedOptions = focusedDescriptor
|
|
168
|
+
const focusedDescriptor = descriptors[focusedRoute.key] as any;
|
|
169
|
+
const focusedOptions = focusedDescriptor.options;
|
|
167
170
|
const shouldShowTabBar =
|
|
168
|
-
focusedOptions
|
|
171
|
+
focusedOptions.tabBarVisible !== false && !keyboardHidesTabBar;
|
|
169
172
|
const [visible] = React.useState(
|
|
170
173
|
() => new Animated.Value(shouldShowTabBar ? 1 : 0),
|
|
171
174
|
);
|
|
@@ -173,13 +176,13 @@ export default function BottomTabBar({
|
|
|
173
176
|
const indicatorAnimated = React.useRef(new Animated.Value(0)).current;
|
|
174
177
|
|
|
175
178
|
const visibilityAnimationConfigRef = React.useRef(
|
|
176
|
-
focusedOptions
|
|
179
|
+
focusedOptions.tabBarVisibilityAnimationConfig,
|
|
177
180
|
);
|
|
178
181
|
const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);
|
|
179
182
|
const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);
|
|
180
183
|
React.useEffect(() => {
|
|
181
184
|
visibilityAnimationConfigRef.current =
|
|
182
|
-
focusedOptions
|
|
185
|
+
focusedOptions.tabBarVisibilityAnimationConfig;
|
|
183
186
|
});
|
|
184
187
|
|
|
185
188
|
const handleLayout = (e: LayoutChangeEvent) => {
|
|
@@ -247,12 +250,22 @@ export default function BottomTabBar({
|
|
|
247
250
|
const leftArr = routes.slice(0, 2);
|
|
248
251
|
const rightArr = routes.slice(2, routes.length);
|
|
249
252
|
const focusedTab = state?.routes[state.index]?.name || routes[0]?.params;
|
|
253
|
+
const tabBarHeight = getTabBarHeight({
|
|
254
|
+
state,
|
|
255
|
+
insets,
|
|
256
|
+
dimensions,
|
|
257
|
+
layout,
|
|
258
|
+
adaptive,
|
|
259
|
+
labelPosition,
|
|
260
|
+
tabStyle,
|
|
261
|
+
style,
|
|
262
|
+
});
|
|
250
263
|
|
|
251
264
|
const renderTabItem = useCallback(
|
|
252
265
|
(data: any[]) => {
|
|
253
266
|
return data?.map((route, index) => {
|
|
254
267
|
const focused = route.params.name === focusedTab;
|
|
255
|
-
const {options} = descriptors[route
|
|
268
|
+
const {options} = descriptors[route.key] as any;
|
|
256
269
|
const onPress = () => {
|
|
257
270
|
const event = navigation.emit({
|
|
258
271
|
type: 'tabPress',
|
|
@@ -317,7 +330,6 @@ export default function BottomTabBar({
|
|
|
317
330
|
labelStyle={labelStyle}
|
|
318
331
|
iconStyle={iconStyle}
|
|
319
332
|
style={tabStyle}
|
|
320
|
-
{...getAccessibilityID(`btn_tabbar_${route.name}`)}
|
|
321
333
|
/>
|
|
322
334
|
</NavigationRouteContext.Provider>
|
|
323
335
|
</NavigationContext.Provider>
|
|
@@ -410,6 +422,7 @@ export default function BottomTabBar({
|
|
|
410
422
|
position: isTabBarHidden ? 'absolute' : (null as any),
|
|
411
423
|
},
|
|
412
424
|
{
|
|
425
|
+
// height: tabBarHeight,
|
|
413
426
|
paddingBottom: paddingBottom - 0,
|
|
414
427
|
paddingHorizontal: Math.max(insets.left, insets.right),
|
|
415
428
|
},
|
|
@@ -418,7 +431,15 @@ export default function BottomTabBar({
|
|
|
418
431
|
pointerEvents={isTabBarHidden ? 'none' : 'auto'}
|
|
419
432
|
onLayout={handleLayout}>
|
|
420
433
|
<View style={styles.content}>
|
|
421
|
-
{isFloating &&
|
|
434
|
+
{isFloating && (
|
|
435
|
+
<CurvedViewComponent
|
|
436
|
+
width={width}
|
|
437
|
+
height={61 + Math.min(insets.bottom, 21)}
|
|
438
|
+
style={styles.curved}
|
|
439
|
+
bgColor="white"
|
|
440
|
+
path={getPathUp(width, tabBarHeight, 50, false, 'CENTER')}
|
|
441
|
+
/>
|
|
442
|
+
)}
|
|
422
443
|
<Animated.View
|
|
423
444
|
style={{
|
|
424
445
|
width: itemWidth,
|
|
@@ -433,18 +454,25 @@ export default function BottomTabBar({
|
|
|
433
454
|
]}
|
|
434
455
|
/>
|
|
435
456
|
</Animated.View>
|
|
436
|
-
|
|
437
|
-
{
|
|
438
|
-
{
|
|
457
|
+
|
|
458
|
+
{renderTabItem(leftArr)}
|
|
459
|
+
{renderCenterComponent()}
|
|
460
|
+
{renderTabItem(rightArr)}
|
|
439
461
|
</View>
|
|
440
462
|
</Animated.View>
|
|
441
463
|
);
|
|
442
464
|
}
|
|
443
465
|
|
|
444
466
|
const styles = StyleSheet.create({
|
|
467
|
+
curved: {
|
|
468
|
+
position: 'absolute',
|
|
469
|
+
bottom: 0,
|
|
470
|
+
// backgroundColor: 'red',
|
|
471
|
+
},
|
|
445
472
|
content: {
|
|
446
473
|
flex: 1,
|
|
447
474
|
flexDirection: 'row',
|
|
475
|
+
// backgroundColor: 'red',
|
|
448
476
|
},
|
|
449
477
|
tabBar: {
|
|
450
478
|
left: 0,
|
|
@@ -458,7 +486,7 @@ const styles = StyleSheet.create({
|
|
|
458
486
|
alignItems: 'center',
|
|
459
487
|
left: 0,
|
|
460
488
|
right: 0,
|
|
461
|
-
bottom:
|
|
489
|
+
bottom: -6,
|
|
462
490
|
},
|
|
463
491
|
floatingContent: {
|
|
464
492
|
alignItems: 'center',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {StyleProp, View, ViewStyle} from 'react-native';
|
|
3
|
+
import {Path, Svg} from 'react-native-svg';
|
|
4
|
+
|
|
5
|
+
interface ICurvedView {
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
bgColor: string;
|
|
10
|
+
path: any;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type CurvedView = React.FC<ICurvedView>;
|
|
14
|
+
|
|
15
|
+
const CurvedContainer: CurvedView = props => {
|
|
16
|
+
const {style, width, height, bgColor, path} = props;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View style={style} pointerEvents="none">
|
|
20
|
+
<Svg width={width} height={height}>
|
|
21
|
+
<Path fill={bgColor} {...{d: path}} />
|
|
22
|
+
</Svg>
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const CurvedViewComponent: CurvedView = React.memo(CurvedContainer);
|
|
@@ -4,13 +4,13 @@ import {createStackNavigator} from '@react-navigation/stack';
|
|
|
4
4
|
import React, {useContext, useEffect} from 'react';
|
|
5
5
|
import {Platform} from 'react-native';
|
|
6
6
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
7
|
+
import BottomTabBar from './BottomTabBar';
|
|
7
8
|
import {Icon} from '../../Icon';
|
|
8
9
|
import {Text} from '../../Text';
|
|
9
10
|
import {ApplicationContext} from '../index';
|
|
11
|
+
import {getAccessibilityID, getStackOptions} from '../utils';
|
|
10
12
|
import StackScreen from '../StackScreen';
|
|
11
13
|
import {BottomTabProps, NavigationScreenProps} from '../types';
|
|
12
|
-
import {getAccessibilityID, getStackOptions} from '../utils';
|
|
13
|
-
import BottomTabBar from './BottomTabBar';
|
|
14
14
|
|
|
15
15
|
const Tab = createBottomTabNavigator();
|
|
16
16
|
const Stack = createStackNavigator();
|
|
@@ -63,14 +63,11 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
63
63
|
|
|
64
64
|
return (
|
|
65
65
|
<Tab.Navigator
|
|
66
|
+
{...getAccessibilityID('tbr_main_bottom')}
|
|
66
67
|
initialRouteName={initialRouteName}
|
|
67
68
|
backBehavior={'firstRoute'}
|
|
68
69
|
tabBar={props => (
|
|
69
|
-
<BottomTabBar
|
|
70
|
-
{...getAccessibilityID('tbr_main_bottom')}
|
|
71
|
-
{...props}
|
|
72
|
-
floatingButton={floatingButton}
|
|
73
|
-
/>
|
|
70
|
+
<BottomTabBar {...props} floatingButton={floatingButton} />
|
|
74
71
|
)}
|
|
75
72
|
tabBarOptions={{
|
|
76
73
|
style: {
|
|
@@ -84,6 +81,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
84
81
|
{tabs.map(item => {
|
|
85
82
|
return (
|
|
86
83
|
<Tab.Screen
|
|
84
|
+
{...getAccessibilityID(`btn_tabbar_${item.name}`)}
|
|
87
85
|
key={item.name}
|
|
88
86
|
name={item.name}
|
|
89
87
|
component={TabScreen}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import * as shape from 'd3-shape';
|
|
2
|
+
import {Platform} from 'react-native';
|
|
3
|
+
|
|
4
|
+
export const TABBAR_ITEM_TOP = Platform.OS === 'ios' ? 8 : 4;
|
|
5
|
+
export const CIRCLE_SIZE = 50;
|
|
6
|
+
export const TABBAR_ITEM_ICON_SIZE = 28;
|
|
7
|
+
export const CIRCLE_POSITION_TOP =
|
|
8
|
+
CIRCLE_SIZE - TABBAR_ITEM_ICON_SIZE - TABBAR_ITEM_TOP;
|
|
9
|
+
export const CIRCLE_OVER_SIZE = 10;
|
|
10
|
+
export const CIRCLE_OVER_TOP = CIRCLE_POSITION_TOP + CIRCLE_OVER_SIZE;
|
|
11
|
+
|
|
12
|
+
export const scale = (number: number) => {
|
|
13
|
+
return number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const line = (width: number, height: number) => {
|
|
17
|
+
const path = (shape as any)
|
|
18
|
+
.line()
|
|
19
|
+
.x((d: {x: any}) => d.x)
|
|
20
|
+
.y((d: {y: any}) => d.y)([
|
|
21
|
+
{x: width / 2, y: scale(CIRCLE_OVER_TOP)},
|
|
22
|
+
{x: 0, y: scale(CIRCLE_OVER_TOP)},
|
|
23
|
+
{x: 0, y: height},
|
|
24
|
+
{x: width, y: height},
|
|
25
|
+
{x: width, y: scale(CIRCLE_OVER_TOP)},
|
|
26
|
+
{x: width / 2, y: scale(CIRCLE_OVER_TOP)},
|
|
27
|
+
]);
|
|
28
|
+
//M195,30L0,30L0,106L390,106L390,30L195,30
|
|
29
|
+
// MaxApi.copyToClipboard(path, 'copied');
|
|
30
|
+
return path;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//** Path Line Border Left Right Up */
|
|
34
|
+
const lineBorder = (width: number, height: number) => {
|
|
35
|
+
const border = (shape as any)
|
|
36
|
+
.line()
|
|
37
|
+
.x((d: {x: any}) => d.x)
|
|
38
|
+
.y((d: {y: any}) => d.y)
|
|
39
|
+
.curve(shape.curveBasis)([
|
|
40
|
+
// right
|
|
41
|
+
{x: width / 2, y: scale(30)},
|
|
42
|
+
{x: width - scale(20), y: scale(30)},
|
|
43
|
+
{x: width - scale(10), y: scale(32)},
|
|
44
|
+
{x: width - scale(2), y: scale(40)},
|
|
45
|
+
{x: width, y: scale(50)},
|
|
46
|
+
{x: width, y: height},
|
|
47
|
+
{x: width, y: height},
|
|
48
|
+
// bottom
|
|
49
|
+
{x: width, y: height},
|
|
50
|
+
{x: 0, y: height},
|
|
51
|
+
// left
|
|
52
|
+
{x: 0, y: height},
|
|
53
|
+
{x: 0, y: height},
|
|
54
|
+
{x: 0, y: scale(50)},
|
|
55
|
+
{x: 0 + scale(2), y: scale(40)},
|
|
56
|
+
{x: 0 + scale(10), y: scale(32)},
|
|
57
|
+
{x: 0 + scale(20), y: scale(30)},
|
|
58
|
+
{x: width / 2, y: scale(30)},
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
return border;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//** Path Line Border Left Right Down */
|
|
65
|
+
const lineBorderLeft = (width: number, height: number) => {
|
|
66
|
+
const border = (shape as any)
|
|
67
|
+
.line()
|
|
68
|
+
.x((d: {x: any}) => d.x)
|
|
69
|
+
.y((d: {y: any}) => d.y)
|
|
70
|
+
.curve(shape.curveBasis)([
|
|
71
|
+
// right
|
|
72
|
+
{x: width, y: scale(30)},
|
|
73
|
+
{x: width, y: height},
|
|
74
|
+
{x: width, y: height},
|
|
75
|
+
// bottom
|
|
76
|
+
{x: width, y: height},
|
|
77
|
+
{x: 0, y: height},
|
|
78
|
+
// left
|
|
79
|
+
{x: 0, y: height},
|
|
80
|
+
{x: 0, y: height},
|
|
81
|
+
{x: 0, y: scale(50)},
|
|
82
|
+
{x: 0 + scale(2), y: scale(40)},
|
|
83
|
+
{x: 0 + scale(10), y: scale(32)},
|
|
84
|
+
{x: 0 + scale(20), y: scale(30)},
|
|
85
|
+
{x: width / 2, y: scale(30)},
|
|
86
|
+
]);
|
|
87
|
+
|
|
88
|
+
return border;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
//** Path Line Border Left Right Down */
|
|
92
|
+
const lineBorderRight = (width: number, height: number) => {
|
|
93
|
+
const border = (shape as any)
|
|
94
|
+
.line()
|
|
95
|
+
.x((d: {x: any}) => d.x)
|
|
96
|
+
.y((d: {y: any}) => d.y)
|
|
97
|
+
.curve(shape.curveBasis)([
|
|
98
|
+
// right
|
|
99
|
+
{x: width / 2, y: scale(30)},
|
|
100
|
+
{x: width - scale(20), y: scale(30)},
|
|
101
|
+
{x: width - scale(10), y: scale(32)},
|
|
102
|
+
{x: width - scale(2), y: scale(40)},
|
|
103
|
+
{x: width, y: scale(50)},
|
|
104
|
+
{x: width, y: height},
|
|
105
|
+
{x: width, y: height},
|
|
106
|
+
// bottom
|
|
107
|
+
{x: width, y: height},
|
|
108
|
+
{x: 0, y: height},
|
|
109
|
+
// left
|
|
110
|
+
{x: 0, y: height},
|
|
111
|
+
{x: 0, y: height},
|
|
112
|
+
{x: 0, y: scale(30)},
|
|
113
|
+
]);
|
|
114
|
+
|
|
115
|
+
return border;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
//** Path Curved Up */
|
|
119
|
+
const lineCurved = (position: number, circle: number) => {
|
|
120
|
+
const circleR = circle / 2;
|
|
121
|
+
const circleRightPos = circle + position;
|
|
122
|
+
const circleOverR = circle / 2 + CIRCLE_OVER_SIZE;
|
|
123
|
+
const centerX = (position + circleRightPos) / 2; //195
|
|
124
|
+
const centerY = CIRCLE_OVER_SIZE + circleR; //33
|
|
125
|
+
// {"circle":50,"position":170,"centerX":195,"circleWidth":220}
|
|
126
|
+
// WIDTH_SCREEN: 390
|
|
127
|
+
|
|
128
|
+
const curved = (shape as any)
|
|
129
|
+
.line()
|
|
130
|
+
.x((d: {x: any}) => d.x)
|
|
131
|
+
.y((d: {y: any}) => d.y)
|
|
132
|
+
.curve(shape.curveBundle.beta(1))([
|
|
133
|
+
{x: centerX - circleOverR - scale(50), y: CIRCLE_OVER_TOP},
|
|
134
|
+
{x: centerX - circleOverR, y: CIRCLE_OVER_TOP}, //y 20
|
|
135
|
+
{
|
|
136
|
+
x: centerX + circleOverR * Math.cos(-Math.PI / 2 - Math.PI / 4),
|
|
137
|
+
y: centerY + circleOverR * Math.sin(-Math.PI / 2 - Math.PI / 4),
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
{x: centerX, y: 0},
|
|
141
|
+
|
|
142
|
+
{
|
|
143
|
+
x: centerX + circleOverR * Math.cos(-Math.PI / 2 + Math.PI / 4),
|
|
144
|
+
y: centerY + circleOverR * Math.sin(-Math.PI / 2 + Math.PI / 4),
|
|
145
|
+
},
|
|
146
|
+
{x: centerX + circleOverR, y: CIRCLE_OVER_TOP}, //y 20
|
|
147
|
+
{x: centerX + circleOverR + scale(50), y: CIRCLE_OVER_TOP},
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
return curved;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export const getPathUp = (
|
|
154
|
+
width: number,
|
|
155
|
+
iHeight: number,
|
|
156
|
+
centerWidth = 50,
|
|
157
|
+
borderTopLeftRight = false,
|
|
158
|
+
position: 'CENTER' | 'LEFT' | 'RIGHT',
|
|
159
|
+
) => {
|
|
160
|
+
const height = scale(iHeight);
|
|
161
|
+
const circleWidth = scale(centerWidth);
|
|
162
|
+
|
|
163
|
+
if (borderTopLeftRight && position === 'LEFT') {
|
|
164
|
+
return `${lineBorderRight(width, height)} ${lineCurved(
|
|
165
|
+
circleWidth / 1.7,
|
|
166
|
+
circleWidth,
|
|
167
|
+
)}`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (borderTopLeftRight && position === 'RIGHT') {
|
|
171
|
+
return `${lineBorderLeft(width, height)} ${lineCurved(
|
|
172
|
+
width - circleWidth * 1.6,
|
|
173
|
+
circleWidth,
|
|
174
|
+
)}`;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (borderTopLeftRight && position === 'CENTER') {
|
|
178
|
+
return `${lineBorder(width, height)} ${lineCurved(
|
|
179
|
+
width / 2 - circleWidth / 2,
|
|
180
|
+
circleWidth,
|
|
181
|
+
)}`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (position === 'LEFT') {
|
|
185
|
+
return `${line(width, height)} ${lineCurved(
|
|
186
|
+
circleWidth / 1.7,
|
|
187
|
+
circleWidth,
|
|
188
|
+
)}`;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (position === 'RIGHT') {
|
|
192
|
+
return `${line(width, height)} ${lineCurved(
|
|
193
|
+
width - circleWidth * 1.6,
|
|
194
|
+
circleWidth,
|
|
195
|
+
)}`;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return `${line(width, height)} ${lineCurved(
|
|
199
|
+
width / 2 - circleWidth / 2,
|
|
200
|
+
circleWidth,
|
|
201
|
+
)}`;
|
|
202
|
+
};
|
|
@@ -33,7 +33,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
33
33
|
delete data.screen;
|
|
34
34
|
delete data.initialParams;
|
|
35
35
|
|
|
36
|
-
const screenName = Component?.name || Component?.type?.name || '
|
|
36
|
+
const screenName = Component?.name || Component?.type?.name || '';
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* set options for screen
|
package/Application/types.ts
CHANGED
package/Input/Input.tsx
CHANGED
|
@@ -133,9 +133,7 @@ const Input = forwardRef(
|
|
|
133
133
|
: getAccessibilityID(
|
|
134
134
|
`${appId}/${code}/${
|
|
135
135
|
screenInfo.screenName
|
|
136
|
-
}/input_${cleanNameForTracking(
|
|
137
|
-
floatingValue ?? placeholder ?? value,
|
|
138
|
-
)}`,
|
|
136
|
+
}/input_${cleanNameForTracking(floatingValue ?? placeholder)}`,
|
|
139
137
|
);
|
|
140
138
|
|
|
141
139
|
if (disabled) {
|
package/Input/InputSearch.tsx
CHANGED
package/Radio/index.tsx
CHANGED
package/Text/styles.ts
CHANGED
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
|
|
6
6
|
header_xs_semibold: {fontSize: 12, lineHeight: 18, fontWeight: '600'},
|
|
7
7
|
body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
|
|
8
|
-
|
|
8
|
+
body_regularstrikethrought: {
|
|
9
9
|
fontSize: 14,
|
|
10
10
|
lineHeight: 20,
|
|
11
11
|
fontWeight: '400',
|
package/Text/types.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type Typography =
|
|
|
20
20
|
| 'header_s_semibold'
|
|
21
21
|
| 'header_xs_semibold'
|
|
22
22
|
| 'body_default_regular'
|
|
23
|
-
| '
|
|
23
|
+
| 'body_regularstrikethrought'
|
|
24
24
|
| 'description_default_regular'
|
|
25
25
|
| 'description_default_regularstrikethrought'
|
|
26
26
|
| 'description_xs_regular'
|
package/Title/index.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, {FC, useContext
|
|
1
|
+
import React, {FC, useContext} 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';
|
|
5
5
|
import {scaleSize, Text} from '../Text';
|
|
6
6
|
import {ApplicationContext} from '../Application';
|
|
7
|
+
import {Colors, Spacing} from '../Consts';
|
|
7
8
|
import {Badge} from '../Badge';
|
|
8
9
|
import {Typography} from '../Text/types';
|
|
9
10
|
import {TitleProps} from './types';
|
|
@@ -24,8 +25,6 @@ const Title: FC<TitleProps> = ({
|
|
|
24
25
|
buttonSize = 'small',
|
|
25
26
|
}) => {
|
|
26
27
|
const {theme} = useContext(ApplicationContext);
|
|
27
|
-
const [badgeWidth, setBadgeWidth] = useState(0);
|
|
28
|
-
const [contentWidth, setContentWidth] = useState(0);
|
|
29
28
|
const styleSheet: {
|
|
30
29
|
[key: string]: any;
|
|
31
30
|
} = styles;
|
|
@@ -34,7 +33,10 @@ const Title: FC<TitleProps> = ({
|
|
|
34
33
|
const numberOfLines = showLeftAction || !!badgeLabel ? 1 : 2;
|
|
35
34
|
const buttonTypo: Typography =
|
|
36
35
|
buttonSize === 'small' ? 'action_xs_bold' : 'action_s_bold';
|
|
37
|
-
const
|
|
36
|
+
const widthStyle =
|
|
37
|
+
!showLeftAction && !showRightAction && !badgeLabel
|
|
38
|
+
? {width: '100%'}
|
|
39
|
+
: {width: '75%'};
|
|
38
40
|
|
|
39
41
|
const renderIcon = () => {
|
|
40
42
|
if (!icon) return null;
|
|
@@ -60,32 +62,24 @@ const Title: FC<TitleProps> = ({
|
|
|
60
62
|
|
|
61
63
|
const renderContent = () => {
|
|
62
64
|
return (
|
|
63
|
-
<View style={
|
|
64
|
-
<View
|
|
65
|
-
onLayout={e => {
|
|
66
|
-
setContentWidth(e.nativeEvent.layout.width);
|
|
67
|
-
}}
|
|
68
|
-
style={[styles.iconLeftView, flexStyle]}>
|
|
65
|
+
<View style={{flex: 1}}>
|
|
66
|
+
<View style={[styles.iconLeftView, widthStyle]}>
|
|
69
67
|
<RNText
|
|
70
68
|
numberOfLines={numberOfLines}
|
|
71
69
|
style={[
|
|
72
70
|
styleSheet[typography],
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
{
|
|
72
|
+
fontWeight: 'bold',
|
|
73
|
+
marginBottom: Spacing.XS,
|
|
74
|
+
},
|
|
75
75
|
]}>
|
|
76
76
|
{title}
|
|
77
77
|
</RNText>
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
style={{
|
|
84
|
-
alignItems: 'center',
|
|
85
|
-
}}>
|
|
86
|
-
<Badge style={styles.badge} label={badgeLabel} />
|
|
87
|
-
</View>
|
|
88
|
-
)}
|
|
78
|
+
<View style={{alignItems: 'center'}}>
|
|
79
|
+
{badgeLabel && (
|
|
80
|
+
<Badge style={{marginLeft: Spacing.XS}} label={badgeLabel} />
|
|
81
|
+
)}
|
|
82
|
+
</View>
|
|
89
83
|
{renderActionLeft()}
|
|
90
84
|
</View>
|
|
91
85
|
<Text
|
|
@@ -101,7 +95,7 @@ const Title: FC<TitleProps> = ({
|
|
|
101
95
|
return (
|
|
102
96
|
<View style={styles.iconLeftView}>
|
|
103
97
|
{showLeftAction && !showRightAction && (
|
|
104
|
-
<View style={styles.iconLeft}>
|
|
98
|
+
<View style={[styles.iconLeft, {backgroundColor: Colors.black_06}]}>
|
|
105
99
|
<Icon
|
|
106
100
|
source={'arrow_chevron_right_small'}
|
|
107
101
|
size={scaleSize(18)}
|
package/Title/styles.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
2
|
import {scaleSize} from '../Text';
|
|
3
|
-
import {
|
|
3
|
+
import {Radius, Spacing} from '../Consts';
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
6
6
|
card_small: {
|
|
@@ -39,6 +39,10 @@ export default StyleSheet.create({
|
|
|
39
39
|
wrapper: {
|
|
40
40
|
flexDirection: 'row',
|
|
41
41
|
},
|
|
42
|
+
textContent: {
|
|
43
|
+
marginRight: Spacing.S,
|
|
44
|
+
flex: 1,
|
|
45
|
+
},
|
|
42
46
|
margin: {
|
|
43
47
|
marginTop: Spacing.S,
|
|
44
48
|
},
|
|
@@ -60,18 +64,9 @@ export default StyleSheet.create({
|
|
|
60
64
|
alignItems: 'center',
|
|
61
65
|
justifyContent: 'center',
|
|
62
66
|
marginHorizontal: Spacing.XS,
|
|
63
|
-
backgroundColor: Colors.black_06,
|
|
64
67
|
},
|
|
65
68
|
iconLeftView: {
|
|
66
69
|
flexDirection: 'row',
|
|
67
70
|
alignItems: 'center',
|
|
68
71
|
},
|
|
69
|
-
contentView: {marginRight: Spacing.S, flex: 1},
|
|
70
|
-
title: {
|
|
71
|
-
fontWeight: 'bold',
|
|
72
|
-
marginBottom: Spacing.XS,
|
|
73
|
-
},
|
|
74
|
-
badge: {
|
|
75
|
-
marginLeft: Spacing.XS,
|
|
76
|
-
},
|
|
77
72
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.92.1-rc.
|
|
3
|
+
"version": "0.92.1-rc.2",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"@react-navigation/native": "5.9.8",
|
|
22
22
|
"@react-navigation/routers": "5.7.4",
|
|
23
23
|
"lottie-react-native": "3.3.2",
|
|
24
|
+
"d3-shape": "1.3.7",
|
|
25
|
+
"react-native-svg": "12.1.0",
|
|
24
26
|
"@react-navigation/stack": "git+https://gitlab.com/momo-platform/react-navigation-stack.git#main"
|
|
25
27
|
},
|
|
26
28
|
"peerDependencies": {
|