@momo-kits/foundation 0.81.1-optimize.21 → 0.81.1-rc.0
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/BottomSheet.tsx +27 -23
- package/Application/BottomTab/BottomTabBar.tsx +2 -2
- package/Application/BottomTab/index.tsx +2 -3
- package/Application/Components.tsx +288 -42
- package/Application/Localize.ts +44 -0
- package/Application/ModalScreen.tsx +2 -2
- package/Application/Navigation.ts +4 -18
- package/Application/NavigationContainer.tsx +10 -21
- package/Application/Navigator.ts +14 -16
- package/Application/StackScreen.tsx +211 -113
- package/Application/index.ts +5 -3
- package/Application/types.ts +30 -11
- package/Application/utils.tsx +60 -18
- package/Badge/BadgeDotAnimation.tsx +95 -0
- package/Badge/index.tsx +2 -1
- package/Badge/styles.ts +50 -6
- package/Button/index.tsx +0 -1
- package/Icon/types.ts +0 -1
- package/Input/Input.tsx +51 -17
- package/Input/InputDropDown.tsx +44 -47
- package/Input/InputMoney.tsx +56 -6
- package/Input/InputOTP.tsx +10 -6
- package/Input/InputSearch.tsx +259 -146
- package/Input/TextTyping.tsx +113 -0
- package/Input/common.tsx +29 -10
- package/Input/index.tsx +75 -74
- package/Input/styles.ts +43 -7
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +3 -2
- package/Layout/Screen.tsx +174 -91
- package/Layout/styles.ts +0 -6
- package/Layout/types.ts +1 -1
- package/Pagination/PaginationScroll.tsx +2 -2
- package/Pagination/styles.ts +1 -1
- package/Popup/PopupNotify.tsx +3 -3
- package/Tag/index.tsx +9 -2
- package/Tag/styles.ts +3 -2
- package/Tag/types.ts +12 -0
- package/Title/index.tsx +6 -9
- package/Title/styles.ts +4 -4
- package/code-scanner.js +4 -4
- package/package.json +6 -5
- package/publish.sh +12 -22
- package/verify.js +36 -42
package/Layout/Screen.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import React, {
|
|
|
3
3
|
forwardRef,
|
|
4
4
|
Fragment,
|
|
5
5
|
ReactNode,
|
|
6
|
+
Ref,
|
|
6
7
|
useContext,
|
|
7
8
|
useEffect,
|
|
8
9
|
useRef,
|
|
@@ -27,10 +28,11 @@ import Navigation from '../Application/Navigation';
|
|
|
27
28
|
import {AnimatedHeader, NavigationOptions} from '../Application/types';
|
|
28
29
|
import {Colors, Spacing, Styles} from '../Consts';
|
|
29
30
|
import {FloatingButton, FloatingButtonProps} from './FloatingButton';
|
|
30
|
-
import {Image} from '../Image';
|
|
31
31
|
import {Card, Section, validateChildren} from './index';
|
|
32
32
|
import styles from './styles';
|
|
33
33
|
import {HeaderType} from './types';
|
|
34
|
+
import {InputRef, InputSearchProps} from '../Input';
|
|
35
|
+
import {HeaderExtendHeader} from '../Application/Components';
|
|
34
36
|
|
|
35
37
|
export interface ScreenProps extends ViewProps {
|
|
36
38
|
/**
|
|
@@ -101,6 +103,13 @@ export interface ScreenProps extends ViewProps {
|
|
|
101
103
|
* Optional. If `true`, the screen content is using grid layout by span.
|
|
102
104
|
*/
|
|
103
105
|
useGridLayout?: boolean;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Optional. specs for input search.
|
|
109
|
+
*/
|
|
110
|
+
inputSearchProps?: InputSearchProps;
|
|
111
|
+
|
|
112
|
+
inputSearchRef?: Ref<InputRef>;
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
const Screen = forwardRef(
|
|
@@ -120,32 +129,132 @@ const Screen = forwardRef(
|
|
|
120
129
|
floatingButtonProps,
|
|
121
130
|
useGridLayout = true,
|
|
122
131
|
keyboardVerticalOffset,
|
|
132
|
+
inputSearchProps,
|
|
133
|
+
inputSearchRef,
|
|
123
134
|
}: ScreenProps,
|
|
124
|
-
ref
|
|
135
|
+
ref: any
|
|
125
136
|
) => {
|
|
126
|
-
const animatedValue = useRef<Animated.Value>(new Animated.Value(0));
|
|
127
137
|
const {theme} = useContext(ApplicationContext);
|
|
128
138
|
const insets = useSafeAreaInsets();
|
|
129
139
|
const heightHeader = useHeaderHeight();
|
|
140
|
+
const animatedValue = useRef<Animated.Value>(new Animated.Value(0));
|
|
130
141
|
const currentTint = useRef(Colors.black_01);
|
|
131
|
-
const isTab = navigation?.instance?.getState?.()?.type
|
|
142
|
+
const isTab = navigation?.instance?.getState?.()?.type === 'tab';
|
|
132
143
|
|
|
133
|
-
let styleAnimatedHeader: NavigationOptions;
|
|
134
144
|
let handleScroll;
|
|
135
|
-
let headerBackground: string | undefined = undefined;
|
|
136
145
|
let Component: any = View;
|
|
137
146
|
let keyboardOffset = heightHeader - 20;
|
|
138
|
-
if (headerType
|
|
147
|
+
if (headerType === 'extended' || animatedHeader || inputSearchProps) {
|
|
139
148
|
keyboardOffset = -20;
|
|
140
149
|
}
|
|
141
150
|
|
|
142
|
-
if (headerType == 'extended') {
|
|
143
|
-
headerBackground = theme.assets?.headerBackground;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
151
|
useEffect(() => {
|
|
152
|
+
let options: NavigationOptions;
|
|
153
|
+
/**
|
|
154
|
+
* handle for basic header type
|
|
155
|
+
*/
|
|
156
|
+
switch (headerType) {
|
|
157
|
+
case 'none':
|
|
158
|
+
options = {
|
|
159
|
+
headerTransparent: true,
|
|
160
|
+
headerBackground: () => null,
|
|
161
|
+
headerShown: false,
|
|
162
|
+
};
|
|
163
|
+
break;
|
|
164
|
+
|
|
165
|
+
case 'surface':
|
|
166
|
+
options = {
|
|
167
|
+
headerTransparent: false,
|
|
168
|
+
headerShown: true,
|
|
169
|
+
headerTintColor: theme.colors.text.default,
|
|
170
|
+
headerBackground: (props: any) => (
|
|
171
|
+
<HeaderBackground {...props} image={null} useSurface={true} />
|
|
172
|
+
),
|
|
173
|
+
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
174
|
+
};
|
|
175
|
+
if (inputSearchProps) {
|
|
176
|
+
options = {
|
|
177
|
+
headerShown: true,
|
|
178
|
+
headerTransparent: true,
|
|
179
|
+
headerTintColor: theme.colors.text.default,
|
|
180
|
+
headerBackground: () => null,
|
|
181
|
+
headerTitle: (props: any) => (
|
|
182
|
+
<HeaderTitle
|
|
183
|
+
{...props}
|
|
184
|
+
interpolate={{
|
|
185
|
+
inputRange: [0, 50],
|
|
186
|
+
outputRange: [1, 0],
|
|
187
|
+
extrapolate: 'clamp',
|
|
188
|
+
}}
|
|
189
|
+
animatedValue={animatedValue.current}
|
|
190
|
+
/>
|
|
191
|
+
),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
|
|
196
|
+
case 'extended':
|
|
197
|
+
options = {
|
|
198
|
+
headerShown: true,
|
|
199
|
+
headerTransparent: true,
|
|
200
|
+
headerTintColor: Colors.black_01,
|
|
201
|
+
headerBackground: () => null,
|
|
202
|
+
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
203
|
+
};
|
|
204
|
+
if (inputSearchProps) {
|
|
205
|
+
options = {
|
|
206
|
+
headerShown: true,
|
|
207
|
+
headerTransparent: true,
|
|
208
|
+
headerTintColor: Colors.black_01,
|
|
209
|
+
headerBackground: () => null,
|
|
210
|
+
headerTitle: (props: any) => (
|
|
211
|
+
<HeaderTitle
|
|
212
|
+
{...props}
|
|
213
|
+
interpolate={{
|
|
214
|
+
inputRange: [0, 50],
|
|
215
|
+
outputRange: [1, 0],
|
|
216
|
+
extrapolate: 'clamp',
|
|
217
|
+
}}
|
|
218
|
+
animatedValue={animatedValue.current}
|
|
219
|
+
/>
|
|
220
|
+
),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
|
|
225
|
+
default:
|
|
226
|
+
options = {
|
|
227
|
+
headerTransparent: false,
|
|
228
|
+
headerShown: true,
|
|
229
|
+
headerTintColor: Colors.black_01,
|
|
230
|
+
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
231
|
+
};
|
|
232
|
+
if (inputSearchProps) {
|
|
233
|
+
options = {
|
|
234
|
+
headerShown: true,
|
|
235
|
+
headerTransparent: true,
|
|
236
|
+
headerTintColor: Colors.black_01,
|
|
237
|
+
headerBackground: () => null,
|
|
238
|
+
headerTitle: (props: any) => (
|
|
239
|
+
<HeaderTitle
|
|
240
|
+
{...props}
|
|
241
|
+
interpolate={{
|
|
242
|
+
inputRange: [0, 50],
|
|
243
|
+
outputRange: [1, 0],
|
|
244
|
+
extrapolate: 'clamp',
|
|
245
|
+
}}
|
|
246
|
+
animatedValue={animatedValue.current}
|
|
247
|
+
/>
|
|
248
|
+
),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* override options for animated header
|
|
255
|
+
*/
|
|
147
256
|
if (animatedHeader) {
|
|
148
|
-
|
|
257
|
+
options = {
|
|
149
258
|
headerTransparent: true,
|
|
150
259
|
headerBackground: (props: any) => (
|
|
151
260
|
<HeaderBackground
|
|
@@ -157,9 +266,9 @@ const Screen = forwardRef(
|
|
|
157
266
|
<HeaderTitle {...props} animatedValue={animatedValue.current} />
|
|
158
267
|
),
|
|
159
268
|
};
|
|
160
|
-
if (animatedHeader.type
|
|
161
|
-
|
|
162
|
-
...
|
|
269
|
+
if (animatedHeader.type === 'surface') {
|
|
270
|
+
options = {
|
|
271
|
+
...options,
|
|
163
272
|
headerBackground: (props: any) => (
|
|
164
273
|
<HeaderBackground
|
|
165
274
|
{...props}
|
|
@@ -171,8 +280,8 @@ const Screen = forwardRef(
|
|
|
171
280
|
};
|
|
172
281
|
}
|
|
173
282
|
if (animatedHeader.headerTitle) {
|
|
174
|
-
|
|
175
|
-
...
|
|
283
|
+
options = {
|
|
284
|
+
...options,
|
|
176
285
|
headerTitle: (props: any) =>
|
|
177
286
|
animatedHeader.headerTitle?.({
|
|
178
287
|
...props,
|
|
@@ -180,55 +289,10 @@ const Screen = forwardRef(
|
|
|
180
289
|
}),
|
|
181
290
|
};
|
|
182
291
|
}
|
|
183
|
-
navigation?.setOptions(styleAnimatedHeader);
|
|
184
292
|
}
|
|
185
|
-
}, [animatedHeader]);
|
|
186
|
-
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
if (!animatedHeader) {
|
|
189
|
-
let headerOptions: NavigationOptions;
|
|
190
|
-
switch (headerType) {
|
|
191
|
-
case 'none':
|
|
192
|
-
headerOptions = {
|
|
193
|
-
headerTransparent: true,
|
|
194
|
-
headerBackground: () => null,
|
|
195
|
-
headerShown: false,
|
|
196
|
-
};
|
|
197
|
-
break;
|
|
198
293
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
headerTransparent: false,
|
|
202
|
-
headerShown: true,
|
|
203
|
-
headerTintColor: theme.colors.text.default,
|
|
204
|
-
headerBackground: (props: any) => (
|
|
205
|
-
<HeaderBackground {...props} image={null} useSurface={true} />
|
|
206
|
-
),
|
|
207
|
-
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
208
|
-
};
|
|
209
|
-
break;
|
|
210
|
-
|
|
211
|
-
case 'extended':
|
|
212
|
-
headerOptions = {
|
|
213
|
-
headerShown: true,
|
|
214
|
-
headerTransparent: true,
|
|
215
|
-
headerTintColor: Colors.black_01,
|
|
216
|
-
headerBackground: () => null,
|
|
217
|
-
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
218
|
-
};
|
|
219
|
-
break;
|
|
220
|
-
|
|
221
|
-
default:
|
|
222
|
-
headerOptions = {
|
|
223
|
-
headerTransparent: false,
|
|
224
|
-
headerShown: true,
|
|
225
|
-
headerTintColor: Colors.black_01,
|
|
226
|
-
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
navigation?.setOptions(headerOptions);
|
|
230
|
-
}
|
|
231
|
-
}, [headerType]);
|
|
294
|
+
navigation?.setOptions(options);
|
|
295
|
+
}, [headerType, animatedHeader, inputSearchProps]);
|
|
232
296
|
|
|
233
297
|
/**
|
|
234
298
|
* animated when use scroll && animated value
|
|
@@ -236,7 +300,7 @@ const Screen = forwardRef(
|
|
|
236
300
|
if (scrollable) {
|
|
237
301
|
Component = Animated.ScrollView;
|
|
238
302
|
handleScroll = scrollViewProps?.onScroll;
|
|
239
|
-
if (animatedHeader || floatingButtonProps?.icon) {
|
|
303
|
+
if (animatedHeader || floatingButtonProps?.icon || inputSearchProps) {
|
|
240
304
|
handleScroll = Animated.event(
|
|
241
305
|
[
|
|
242
306
|
{
|
|
@@ -249,13 +313,13 @@ const Screen = forwardRef(
|
|
|
249
313
|
useNativeDriver: true,
|
|
250
314
|
listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
251
315
|
scrollViewProps?.onScroll?.(e);
|
|
252
|
-
if (animatedHeader?.type
|
|
316
|
+
if (animatedHeader?.type === 'surface') {
|
|
253
317
|
const offsetY = e.nativeEvent.contentOffset.y;
|
|
254
318
|
let color = Colors.black_01;
|
|
255
319
|
if (offsetY > 50) {
|
|
256
320
|
color = theme.colors.text.default;
|
|
257
321
|
}
|
|
258
|
-
if (color
|
|
322
|
+
if (color !== currentTint.current) {
|
|
259
323
|
currentTint.current = color;
|
|
260
324
|
navigation?.setOptions({
|
|
261
325
|
headerTintColor: color,
|
|
@@ -263,31 +327,52 @@ const Screen = forwardRef(
|
|
|
263
327
|
}
|
|
264
328
|
}
|
|
265
329
|
},
|
|
266
|
-
}
|
|
330
|
+
}
|
|
267
331
|
);
|
|
268
332
|
}
|
|
269
333
|
}
|
|
270
334
|
|
|
335
|
+
/**
|
|
336
|
+
* handle scroll end
|
|
337
|
+
* @param e
|
|
338
|
+
*/
|
|
339
|
+
const handleScrollEnd = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
340
|
+
const offsetY = e.nativeEvent.contentOffset.y;
|
|
341
|
+
if (inputSearchProps && offsetY < 100 && offsetY > 0) {
|
|
342
|
+
Animated.timing(animatedValue.current, {
|
|
343
|
+
toValue: 0,
|
|
344
|
+
useNativeDriver: true,
|
|
345
|
+
duration: 300,
|
|
346
|
+
}).start();
|
|
347
|
+
ref?.scrollTo({y: 0, animated: true});
|
|
348
|
+
}
|
|
349
|
+
scrollViewProps?.onScrollEndDrag?.(e);
|
|
350
|
+
};
|
|
351
|
+
|
|
271
352
|
/**
|
|
272
353
|
* render top navigation banner
|
|
273
354
|
*/
|
|
274
|
-
const
|
|
355
|
+
const renderAnimatedHeader = () => {
|
|
275
356
|
if (typeof animatedHeader?.component === 'function') {
|
|
276
|
-
return
|
|
277
|
-
|
|
278
|
-
|
|
357
|
+
return (
|
|
358
|
+
<View style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
|
|
359
|
+
{animatedHeader?.component({
|
|
360
|
+
animatedValue: animatedValue.current,
|
|
361
|
+
})}
|
|
362
|
+
</View>
|
|
363
|
+
);
|
|
279
364
|
}
|
|
280
365
|
};
|
|
281
366
|
|
|
282
367
|
/**
|
|
283
|
-
* build content for screen
|
|
368
|
+
* build content for screen for grid rule
|
|
284
369
|
*/
|
|
285
370
|
const renderContent = (children: any): any => {
|
|
286
371
|
const results = validateChildren(children, [Section, Card, undefined]);
|
|
287
372
|
if (Array.isArray(results)) {
|
|
288
373
|
return results.map((item, index) => {
|
|
289
374
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
290
|
-
if (item?.type
|
|
375
|
+
if (item?.type === Fragment) {
|
|
291
376
|
return renderContent(item?.props?.children);
|
|
292
377
|
}
|
|
293
378
|
if (item) {
|
|
@@ -307,7 +392,7 @@ const Screen = forwardRef(
|
|
|
307
392
|
} else {
|
|
308
393
|
const item: any = children;
|
|
309
394
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
310
|
-
if (item?.type
|
|
395
|
+
if (item?.type === Fragment) {
|
|
311
396
|
return renderContent(item?.props?.children);
|
|
312
397
|
}
|
|
313
398
|
return (
|
|
@@ -326,17 +411,15 @@ const Screen = forwardRef(
|
|
|
326
411
|
|
|
327
412
|
return (
|
|
328
413
|
<View style={[Styles.flex, {backgroundColor}]}>
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
</>
|
|
339
|
-
)}
|
|
414
|
+
<HeaderExtendHeader
|
|
415
|
+
headerType={headerType}
|
|
416
|
+
heightHeader={heightHeader}
|
|
417
|
+
animatedValue={animatedValue.current}
|
|
418
|
+
inputSearchProps={inputSearchProps}
|
|
419
|
+
navigation={navigation}
|
|
420
|
+
inputSearchRef={inputSearchRef}
|
|
421
|
+
/>
|
|
422
|
+
|
|
340
423
|
<KeyboardAvoidingView
|
|
341
424
|
style={Styles.flex}
|
|
342
425
|
enabled={enableKeyboardAvoidingView}
|
|
@@ -352,11 +435,11 @@ const Screen = forwardRef(
|
|
|
352
435
|
ref={ref}
|
|
353
436
|
showsVerticalScrollIndicator={false}
|
|
354
437
|
onScroll={handleScroll}
|
|
438
|
+
onScrollEndDrag={handleScrollEnd}
|
|
439
|
+
scrollEventThrottle={16}
|
|
355
440
|
style={Styles.flex}>
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
{renderHeader()}
|
|
359
|
-
</View>
|
|
441
|
+
{renderAnimatedHeader()}
|
|
442
|
+
|
|
360
443
|
{useGridLayout ? renderContent(children) : children}
|
|
361
444
|
</Component>
|
|
362
445
|
|
|
@@ -387,7 +470,7 @@ const Screen = forwardRef(
|
|
|
387
470
|
</KeyboardAvoidingView>
|
|
388
471
|
</View>
|
|
389
472
|
);
|
|
390
|
-
}
|
|
473
|
+
}
|
|
391
474
|
);
|
|
392
475
|
|
|
393
476
|
export default Screen;
|
package/Layout/styles.ts
CHANGED
|
@@ -2,12 +2,6 @@ import {Platform, StyleSheet} from 'react-native';
|
|
|
2
2
|
import {Colors, Radius, Spacing} from '../Consts';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
|
-
extendedHeader: {
|
|
6
|
-
aspectRatio: 1.75,
|
|
7
|
-
position: 'absolute',
|
|
8
|
-
width: '100%',
|
|
9
|
-
height: 210,
|
|
10
|
-
},
|
|
11
5
|
screenBanner: {
|
|
12
6
|
width: '100%',
|
|
13
7
|
},
|
package/Layout/types.ts
CHANGED
|
@@ -42,7 +42,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
],
|
|
45
|
-
{useNativeDriver: true}
|
|
45
|
+
{useNativeDriver: true}
|
|
46
46
|
)}
|
|
47
47
|
alwaysBounceHorizontal={false}
|
|
48
48
|
showsHorizontalScrollIndicator={false}
|
|
@@ -80,7 +80,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
80
80
|
return (
|
|
81
81
|
<View style={[style, styles.scrollContainer]}>
|
|
82
82
|
{renderScrollView()}
|
|
83
|
-
{renderIndicator()}
|
|
83
|
+
{scrollContentWidth > scrollViewWidth && renderIndicator()}
|
|
84
84
|
</View>
|
|
85
85
|
);
|
|
86
86
|
};
|
package/Pagination/styles.ts
CHANGED
|
@@ -29,7 +29,6 @@ export default StyleSheet.create({
|
|
|
29
29
|
justifyContent: 'center',
|
|
30
30
|
},
|
|
31
31
|
scrollContainer: {
|
|
32
|
-
alignItems: 'center',
|
|
33
32
|
width: '100%',
|
|
34
33
|
},
|
|
35
34
|
scrollView: {
|
|
@@ -42,6 +41,7 @@ export default StyleSheet.create({
|
|
|
42
41
|
borderRadius: Radius.XS,
|
|
43
42
|
},
|
|
44
43
|
indicatorContainer: {
|
|
44
|
+
alignSelf: 'center',
|
|
45
45
|
width: 72,
|
|
46
46
|
height: 4,
|
|
47
47
|
borderRadius: Radius.XS,
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {Button} from '../Button';
|
|
|
5
5
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
6
6
|
import {Icon} from '../Icon';
|
|
7
7
|
import {Image} from '../Image';
|
|
8
|
-
import {Text} from '../Text';
|
|
8
|
+
import {scaleSize, Text} from '../Text';
|
|
9
9
|
import {PopupNotifyProps} from './types';
|
|
10
10
|
|
|
11
11
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
@@ -27,7 +27,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
27
27
|
let Description: any = View;
|
|
28
28
|
if (scrollContent) {
|
|
29
29
|
Description = ScrollView;
|
|
30
|
-
descriptionStyle = {
|
|
30
|
+
descriptionStyle = {maxHeight: scaleSize(172)};
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* tracking
|
|
@@ -195,7 +195,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
195
195
|
]}>
|
|
196
196
|
{!!image && <Image source={{uri: image}} style={styles.image} />}
|
|
197
197
|
<View style={styles.content}>
|
|
198
|
-
<Text typography={'header_default_bold'} numberOfLines={
|
|
198
|
+
<Text typography={'header_default_bold'} numberOfLines={3}>
|
|
199
199
|
{title}
|
|
200
200
|
</Text>
|
|
201
201
|
<Description style={[styles.description, descriptionStyle]}>
|
package/Tag/index.tsx
CHANGED
|
@@ -31,6 +31,8 @@ const Tag: FC<TagProps> = ({
|
|
|
31
31
|
size = 'large',
|
|
32
32
|
style,
|
|
33
33
|
customColor,
|
|
34
|
+
accessibilityLabelContainer,
|
|
35
|
+
accessibilityLabelText,
|
|
34
36
|
}) => {
|
|
35
37
|
let labelColor = textColor[color];
|
|
36
38
|
let tagColor = backgroundColor[color];
|
|
@@ -60,7 +62,9 @@ const Tag: FC<TagProps> = ({
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
return (
|
|
63
|
-
<View
|
|
65
|
+
<View
|
|
66
|
+
style={[style, sizeStyle, {backgroundColor: tagColor}]}
|
|
67
|
+
accessibilityLabel={accessibilityLabelContainer}>
|
|
64
68
|
{!!icon && (
|
|
65
69
|
<Icon
|
|
66
70
|
style={styles.icon}
|
|
@@ -69,7 +73,10 @@ const Tag: FC<TagProps> = ({
|
|
|
69
73
|
color={labelColor}
|
|
70
74
|
/>
|
|
71
75
|
)}
|
|
72
|
-
<Text
|
|
76
|
+
<Text
|
|
77
|
+
color={labelColor}
|
|
78
|
+
typography={'label_s_medium'}
|
|
79
|
+
accessibilityLabel={accessibilityLabelText}>
|
|
73
80
|
{label}
|
|
74
81
|
</Text>
|
|
75
82
|
</View>
|
package/Tag/styles.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
2
|
import {Radius, Spacing} from '../Consts';
|
|
3
|
+
import {scaleSize} from '../Text';
|
|
3
4
|
|
|
4
5
|
export default StyleSheet.create({
|
|
5
6
|
container: {
|
|
6
7
|
paddingHorizontal: Spacing.S,
|
|
7
8
|
borderRadius: Radius.S,
|
|
8
9
|
flexDirection: 'row',
|
|
9
|
-
height: 24,
|
|
10
|
+
height: scaleSize(24),
|
|
10
11
|
alignItems: 'center',
|
|
11
12
|
justifyContent: 'center',
|
|
12
13
|
},
|
|
13
14
|
mediumContainer: {
|
|
14
15
|
paddingHorizontal: Spacing.S,
|
|
15
16
|
borderRadius: Radius.S,
|
|
16
|
-
height: 18,
|
|
17
|
+
height: scaleSize(18),
|
|
17
18
|
alignItems: 'center',
|
|
18
19
|
flexDirection: 'row',
|
|
19
20
|
justifyContent: 'center',
|
package/Tag/types.ts
CHANGED
|
@@ -33,4 +33,16 @@ export type TagProps = {
|
|
|
33
33
|
* that can be applied to the Tag component.
|
|
34
34
|
*/
|
|
35
35
|
customColor?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
|
|
39
|
+
* label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
|
|
40
|
+
*/
|
|
41
|
+
accessibilityLabelContainer?: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
|
|
45
|
+
* label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
|
|
46
|
+
*/
|
|
47
|
+
accessibilityLabelText?: string;
|
|
36
48
|
};
|
package/Title/index.tsx
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import React, {FC, useContext, useState} from 'react';
|
|
2
2
|
import {Text as RNText, TouchableOpacity, View, ViewStyle} from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ApplicationContext,
|
|
9
|
-
scaleSize,
|
|
10
|
-
Text,
|
|
11
|
-
} from '@momo-kits/foundation';
|
|
3
|
+
import {Icon} from '../Icon';
|
|
4
|
+
import {scaleSize, Text} from '../Text';
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
|
+
import {Badge} from '../Badge';
|
|
7
|
+
import {Colors} from '../Consts';
|
|
12
8
|
import styles from './styles';
|
|
13
9
|
import {TitleProps} from './types';
|
|
10
|
+
import {Typography} from '../Text/types';
|
|
14
11
|
|
|
15
12
|
const Title: FC<TitleProps> = ({
|
|
16
13
|
title = 'Title',
|
package/Title/styles.ts
CHANGED
|
@@ -46,16 +46,16 @@ export default StyleSheet.create({
|
|
|
46
46
|
marginRight: Spacing.S,
|
|
47
47
|
},
|
|
48
48
|
iconRight: {
|
|
49
|
-
width:
|
|
50
|
-
height:
|
|
49
|
+
width: 22,
|
|
50
|
+
height: 22,
|
|
51
51
|
borderRadius: Radius.M,
|
|
52
52
|
alignItems: 'center',
|
|
53
53
|
justifyContent: 'center',
|
|
54
54
|
marginLeft: Spacing.S,
|
|
55
55
|
},
|
|
56
56
|
iconLeft: {
|
|
57
|
-
width:
|
|
58
|
-
height:
|
|
57
|
+
width: 18,
|
|
58
|
+
height: 18,
|
|
59
59
|
borderRadius: Radius.M,
|
|
60
60
|
alignItems: 'center',
|
|
61
61
|
justifyContent: 'center',
|
package/code-scanner.js
CHANGED
|
@@ -15,7 +15,7 @@ const calculateAdoptionRate = async (
|
|
|
15
15
|
kitJsonPath,
|
|
16
16
|
miniappJsonPath,
|
|
17
17
|
reactNativeJsonPath,
|
|
18
|
-
fsJsonPath
|
|
18
|
+
fsJsonPath
|
|
19
19
|
) => {
|
|
20
20
|
const kitJson = require(kitJsonPath);
|
|
21
21
|
const miniAppJson = require(miniappJsonPath);
|
|
@@ -98,8 +98,8 @@ const main = async () => {
|
|
|
98
98
|
|
|
99
99
|
const allKitsReg = /@momo-kits/;
|
|
100
100
|
const fsReg =
|
|
101
|
-
/^(?:@fs-mobile-platform\/(components
|
|
102
|
-
const RNReg =
|
|
101
|
+
/^(?:@fs-mobile-platform\/(components(\/.*)?|investment(\/.*)?|screens(\/.*)?|foundation(\/.*)?)|@miniapp-platform\/(components(\/.*)?|foundation(\/.*)?))$/;
|
|
102
|
+
const RNReg = /react-native|react-native-svg/;
|
|
103
103
|
|
|
104
104
|
const config1 = {
|
|
105
105
|
crawlFrom: scanPath,
|
|
@@ -148,7 +148,7 @@ const main = async () => {
|
|
|
148
148
|
kitJsonPath,
|
|
149
149
|
miniappJsonPath,
|
|
150
150
|
reactNativeJsonPath,
|
|
151
|
-
fsJsonPath
|
|
151
|
+
fsJsonPath
|
|
152
152
|
);
|
|
153
153
|
sendMessage(result);
|
|
154
154
|
console.log(result);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.81.1-
|
|
3
|
+
"version": "0.81.1-rc.0",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"react-native-gesture-handler": "1.10.3",
|
|
15
15
|
"react-native-modalize": "2.1.1",
|
|
16
16
|
"react-native-fast-image": "8.1.5",
|
|
17
|
-
"@react-navigation/bottom-tabs": "https://
|
|
17
|
+
"@react-navigation/bottom-tabs": "https://gitlab.mservice.com.vn/momo-platform/react-native-bottom-tabs.git",
|
|
18
18
|
"@react-navigation/core": "5.16.1",
|
|
19
19
|
"@react-navigation/native": "5.9.8",
|
|
20
20
|
"@react-navigation/routers": "5.7.4",
|
|
21
21
|
"lottie-react-native": "git+https://gitlab.mservice.com.vn/momo-platform/momo-lottie-react-native.git",
|
|
22
|
-
"@react-navigation/stack": "https://
|
|
22
|
+
"@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react-native": "*"
|
|
@@ -39,8 +39,9 @@
|
|
|
39
39
|
"react-test-renderer": "17.0.1",
|
|
40
40
|
"typescript": "^4.0.3",
|
|
41
41
|
"@momo-platform/versions": "4.1.11",
|
|
42
|
-
"react-scanner": "^1.1.0"
|
|
42
|
+
"react-scanner": "^1.1.0",
|
|
43
|
+
"@types/color": "3.0.6"
|
|
43
44
|
},
|
|
44
45
|
"author": "@momo-kits/foundation",
|
|
45
46
|
"license": "ISC"
|
|
46
|
-
}
|
|
47
|
+
}
|