@momo-kits/foundation 0.150.2-phuc.13 → 0.150.2-scaleSize.35
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 +39 -114
- package/Application/BottomTab/Badge.tsx +15 -2
- package/Application/BottomTab/BottomTabBar.tsx +1 -1
- package/Application/BottomTab/CustomBottomTabItem.tsx +5 -3
- package/Application/BottomTab/TabBarIcon.tsx +8 -6
- package/Application/BottomTab/index.tsx +82 -87
- package/Application/Components/BackgroundImageView.tsx +1 -1
- package/Application/Components/HeaderAnimated.tsx +12 -11
- package/Application/Components/HeaderBackground.tsx +1 -1
- package/Application/Components/HeaderExtendHeader.tsx +31 -26
- package/Application/Components/HeaderLeft.tsx +2 -2
- package/Application/Components/HeaderRight.tsx +24 -20
- package/Application/Components/HeaderTitle.tsx +19 -7
- package/Application/Components/NavigationButton.tsx +12 -11
- package/Application/Components/SearchHeader.tsx +20 -3
- package/Application/ModalScreen.tsx +14 -1
- package/Application/NavigationContainer.tsx +13 -7
- package/Application/StackScreen.tsx +100 -155
- package/Application/WidgetContainer.tsx +1 -1
- package/Application/index.ts +12 -31
- package/Application/types.ts +66 -18
- package/Application/utils.tsx +41 -17
- package/Assets/language.json +6 -2
- package/Assets/lottie_circle_loader.json +1 -0
- package/Badge/Badge.tsx +14 -11
- package/Badge/BadgeRibbon.tsx +1 -1
- package/Button/index.tsx +47 -32
- package/CheckBox/index.tsx +23 -19
- package/CheckBox/styles.ts +1 -0
- package/Context/index.ts +23 -0
- package/Divider/DashDivider.tsx +10 -9
- package/Divider/index.tsx +7 -7
- package/FoundationList/index.tsx +7 -4
- package/Icon/index.tsx +9 -9
- package/IconButton/index.tsx +12 -10
- package/Image/index.tsx +9 -2
- package/Input/Input.tsx +3 -5
- package/Input/InputDropDown.tsx +31 -23
- package/Input/InputMoney.tsx +3 -5
- package/Input/InputOTP.tsx +7 -7
- package/Input/InputPhoneNumber.tsx +271 -0
- package/Input/InputSearch.tsx +3 -5
- package/Input/InputTextArea.tsx +2 -1
- package/Input/TextTyping.tsx +8 -2
- package/Input/common.tsx +31 -24
- package/Input/index.tsx +21 -1
- package/Input/styles.ts +17 -12
- package/Input/utils.ts +42 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/GridSystem.tsx +15 -14
- package/Layout/Item.tsx +1 -1
- package/Layout/Screen.tsx +8 -5
- package/Layout/Section.tsx +1 -1
- package/Layout/TrackingScope.tsx +3 -3
- package/Loader/DotLoader.tsx +7 -7
- package/Loader/ProgressBar.tsx +10 -9
- package/Loader/Spinner.tsx +7 -7
- package/Pagination/Dot.tsx +10 -7
- package/Pagination/PaginationDot.tsx +8 -8
- package/Pagination/PaginationScroll.tsx +12 -10
- package/Popup/PopupNotify.tsx +2 -2
- package/Popup/PopupPromotion.tsx +1 -1
- package/Radio/index.tsx +18 -18
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +17 -12
- package/Text/index.tsx +4 -4
- package/Text/styles.ts +37 -36
- package/Text/types.ts +1 -0
- package/Text/utils.ts +33 -4
- package/Title/index.tsx +48 -29
- package/index.ts +1 -0
- package/package.json +35 -34
- package/Application/Components/index.ts +0 -7
package/Input/index.tsx
CHANGED
|
@@ -9,6 +9,8 @@ import InputMoney from './InputMoney';
|
|
|
9
9
|
import InputOTP from './InputOTP';
|
|
10
10
|
import InputSearch from './InputSearch';
|
|
11
11
|
import InputTextArea from './InputTextArea';
|
|
12
|
+
import InputPhoneNumber from './InputPhoneNumber';
|
|
13
|
+
import { checkValidPhoneNumber } from './utils';
|
|
12
14
|
|
|
13
15
|
export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
|
|
14
16
|
|
|
@@ -343,6 +345,14 @@ export interface InputDropDownProps extends TouchableOpacityProps {
|
|
|
343
345
|
onPressFloatingIcon?: () => void;
|
|
344
346
|
}
|
|
345
347
|
|
|
348
|
+
export interface InputPhoneNumberProps extends InputProps {
|
|
349
|
+
/**
|
|
350
|
+
* Optional. Represents the country code to be displayed in the InputPhoneNumber component.
|
|
351
|
+
* It should be in the format of a string, e.g., "+1" for the United States.
|
|
352
|
+
*/
|
|
353
|
+
countryCode?: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
346
356
|
export type InputRef = {
|
|
347
357
|
clear: () => void;
|
|
348
358
|
focus: () => void | undefined;
|
|
@@ -350,4 +360,14 @@ export type InputRef = {
|
|
|
350
360
|
setText: (text: string) => void;
|
|
351
361
|
};
|
|
352
362
|
|
|
353
|
-
export {
|
|
363
|
+
export {
|
|
364
|
+
Input,
|
|
365
|
+
InputDropDown,
|
|
366
|
+
InputMoney,
|
|
367
|
+
InputOTP,
|
|
368
|
+
InputSearch,
|
|
369
|
+
InputTextArea,
|
|
370
|
+
InputPhoneNumber,
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
export {checkValidPhoneNumber};
|
package/Input/styles.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Platform, StyleSheet} from 'react-native';
|
|
2
|
-
import {Colors, Radius, Spacing} from '../Consts';
|
|
3
|
-
import {scaleSize} from '../Text';
|
|
1
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors, Radius, Spacing } from '../Consts';
|
|
3
|
+
import { scaleSize } from '../Text';
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
6
6
|
//input style
|
|
@@ -31,8 +31,8 @@ export default StyleSheet.create({
|
|
|
31
31
|
flexDirection: 'row',
|
|
32
32
|
alignItems: 'center',
|
|
33
33
|
},
|
|
34
|
-
floatingIcon: {marginLeft: Spacing.XS},
|
|
35
|
-
errorIcon: {marginRight: Spacing.XS, marginTop: Spacing.XXS},
|
|
34
|
+
floatingIcon: { marginLeft: Spacing.XS },
|
|
35
|
+
errorIcon: { marginRight: Spacing.XS, marginTop: Spacing.XXS },
|
|
36
36
|
errorView: {
|
|
37
37
|
flexDirection: 'row',
|
|
38
38
|
marginTop: Spacing.XS,
|
|
@@ -119,8 +119,8 @@ export default StyleSheet.create({
|
|
|
119
119
|
iconSearchInput: {
|
|
120
120
|
marginLeft: Spacing.S,
|
|
121
121
|
},
|
|
122
|
-
searchInputContainer: {flexDirection: 'row', alignItems: 'center'},
|
|
123
|
-
textButton: {marginLeft: Spacing.L},
|
|
122
|
+
searchInputContainer: { flexDirection: 'row', alignItems: 'center' },
|
|
123
|
+
textButton: { marginLeft: Spacing.L },
|
|
124
124
|
divider: {
|
|
125
125
|
width: 1,
|
|
126
126
|
height: 20,
|
|
@@ -178,16 +178,17 @@ export default StyleSheet.create({
|
|
|
178
178
|
position: 'absolute',
|
|
179
179
|
width: '100%',
|
|
180
180
|
height: '100%',
|
|
181
|
-
opacity: 0.
|
|
181
|
+
opacity: 0.02,
|
|
182
182
|
backgroundColor: 'transparent',
|
|
183
|
+
zIndex: 2,
|
|
183
184
|
},
|
|
184
185
|
otpRealInput: {
|
|
185
|
-
opacity: 0.01,
|
|
186
186
|
width: '100%',
|
|
187
187
|
height: '100%',
|
|
188
|
-
zIndex:
|
|
188
|
+
zIndex: 2,
|
|
189
|
+
opacity: 0.02,
|
|
190
|
+
letterSpacing: Spacing.XXL,
|
|
189
191
|
},
|
|
190
|
-
|
|
191
192
|
//DropDown
|
|
192
193
|
inputDropDownWrapper: {
|
|
193
194
|
flexDirection: 'row',
|
|
@@ -216,5 +217,9 @@ export default StyleSheet.create({
|
|
|
216
217
|
borderRadius: Radius.XS,
|
|
217
218
|
overflow: 'hidden',
|
|
218
219
|
},
|
|
219
|
-
currency: {fontSize: scaleSize(20), fontWeight: 'bold'},
|
|
220
|
+
currency: { fontSize: scaleSize(20), fontWeight: 'bold' },
|
|
221
|
+
phoneNumberDivider: {
|
|
222
|
+
width: 1,
|
|
223
|
+
marginLeft: Spacing.M
|
|
224
|
+
},
|
|
220
225
|
});
|
package/Input/utils.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Localize } from '../Application';
|
|
2
|
+
|
|
1
3
|
const formatNumberToMoney = (number: number, currency = '') => {
|
|
2
4
|
if (!number || isNaN(number) || Number(number) === 0) {
|
|
3
5
|
return `0${currency}`;
|
|
@@ -64,4 +66,43 @@ const checkTyping = (text: string, value: boolean, setValue: any) => {
|
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
// --- PHONE VALIDATION ---
|
|
70
|
+
function formatPhoneNumber(phone: string): string {
|
|
71
|
+
return phone.replace(/\D/g, '');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function checkValidPhoneNumber(phone: string): {
|
|
75
|
+
phoneFormatted: string;
|
|
76
|
+
error?: string;
|
|
77
|
+
} {
|
|
78
|
+
let phoneNumber = phone;
|
|
79
|
+
|
|
80
|
+
// if not starting with 0 and has 9 digits => prepend 0
|
|
81
|
+
if (
|
|
82
|
+
phoneNumber.length > 0 &&
|
|
83
|
+
phoneNumber[0] !== '0' &&
|
|
84
|
+
/^\d$/.test(phoneNumber[0]) &&
|
|
85
|
+
phoneNumber.length === 9
|
|
86
|
+
) {
|
|
87
|
+
phoneNumber = '0' + phoneNumber;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const phoneFormatted = formatPhoneNumber(phoneNumber);
|
|
91
|
+
const localize = new Localize({ vi: {}, en: {} });
|
|
92
|
+
let error: string | undefined;
|
|
93
|
+
|
|
94
|
+
if (phoneFormatted.length === 0) {
|
|
95
|
+
error = localize.translate('enterPhoneNumber');
|
|
96
|
+
} else if (phoneFormatted.length < 10 || phoneFormatted.length > 11) {
|
|
97
|
+
error = localize.translate('invalidPhoneNumber');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return { phoneFormatted: phoneFormatted, error };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
formatMoneyToNumber,
|
|
105
|
+
formatNumberToMoney,
|
|
106
|
+
checkTyping,
|
|
107
|
+
checkValidPhoneNumber,
|
|
108
|
+
};
|
package/Layout/Card.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useGridSystem } from './utils';
|
|
|
4
4
|
import { GridContextProps } from './types';
|
|
5
5
|
import { GridContext, GridSystem } from './index';
|
|
6
6
|
import { Image } from '../Image';
|
|
7
|
-
import { ApplicationContext } from '../
|
|
7
|
+
import { ApplicationContext } from '../Context';
|
|
8
8
|
import styles from './styles';
|
|
9
9
|
import { Colors, Radius, Shadow, Spacing } from '../Consts';
|
|
10
10
|
|
|
@@ -33,9 +33,10 @@ const Card: React.FC<CardProps> = ({
|
|
|
33
33
|
const gutterSize = 8;
|
|
34
34
|
const margin = 12;
|
|
35
35
|
const widthSection = Dimensions.get('window').width - margin * 2;
|
|
36
|
-
|
|
36
|
+
let sizePerSpan =
|
|
37
37
|
(widthSection - margin * 2 - gutterSize * (numberOfColumns - 1)) /
|
|
38
|
-
|
|
38
|
+
numberOfColumns -
|
|
39
|
+
1 / numberOfColumns;
|
|
39
40
|
|
|
40
41
|
const gridContext: GridContextProps = {
|
|
41
42
|
numberOfColumns,
|
package/Layout/GridSystem.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
3
|
-
import {Dimensions, StyleSheet, View} from 'react-native';
|
|
4
|
-
import {ApplicationContext} from '../
|
|
5
|
-
import {Colors, Spacing} from '../Consts';
|
|
6
|
-
import {GridContextProps} from './types';
|
|
7
|
-
import {useGridSystem} from './utils';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { ApplicationContext } from '../Context';
|
|
5
|
+
import { Colors, Spacing } from '../Consts';
|
|
6
|
+
import { GridContextProps } from './types';
|
|
7
|
+
import { useGridSystem } from './utils';
|
|
8
8
|
|
|
9
9
|
const GridSystem: React.FC<any> = ({
|
|
10
10
|
width = Dimensions.get('window').width,
|
|
@@ -13,8 +13,8 @@ const GridSystem: React.FC<any> = ({
|
|
|
13
13
|
screenGrid = true,
|
|
14
14
|
gridColor = Colors.blue_07,
|
|
15
15
|
}) => {
|
|
16
|
-
const {theme} = useContext(ApplicationContext);
|
|
17
|
-
const {numberOfColumns} = useGridSystem();
|
|
16
|
+
const { theme } = useContext(ApplicationContext);
|
|
17
|
+
const { numberOfColumns } = useGridSystem();
|
|
18
18
|
|
|
19
19
|
const margin = useMargin ? Spacing.M : 0;
|
|
20
20
|
const widthSection = width - margin * 2;
|
|
@@ -49,11 +49,12 @@ const GridSystem: React.FC<any> = ({
|
|
|
49
49
|
top: Spacing.M,
|
|
50
50
|
bottom: Spacing.M,
|
|
51
51
|
},
|
|
52
|
-
]}
|
|
52
|
+
]}
|
|
53
|
+
>
|
|
53
54
|
{list.map((_, index) => {
|
|
54
55
|
return (
|
|
55
|
-
<View style={{flexDirection: 'row'}} key={index.toString()}>
|
|
56
|
-
{index !== 0 && <View style={{width: grid.gutterSize}} />}
|
|
56
|
+
<View style={{ flexDirection: 'row' }} key={index.toString()}>
|
|
57
|
+
{index !== 0 && <View style={{ width: grid.gutterSize }} />}
|
|
57
58
|
<View
|
|
58
59
|
key={`Grid${index.toString()}`}
|
|
59
60
|
pointerEvents="none"
|
|
@@ -75,11 +76,11 @@ const GridSystem: React.FC<any> = ({
|
|
|
75
76
|
<View pointerEvents="none" style={styles.dangerRightContainer} />
|
|
76
77
|
<View
|
|
77
78
|
pointerEvents="none"
|
|
78
|
-
style={[styles.dangerTopContainer, {height: Spacing.M}]}
|
|
79
|
+
style={[styles.dangerTopContainer, { height: Spacing.M }]}
|
|
79
80
|
/>
|
|
80
81
|
<View
|
|
81
82
|
pointerEvents="none"
|
|
82
|
-
style={[styles.dangerBottomContainer, {height: insets.bottom}]}
|
|
83
|
+
style={[styles.dangerBottomContainer, { height: insets.bottom }]}
|
|
83
84
|
/>
|
|
84
85
|
</>
|
|
85
86
|
)}
|
package/Layout/Item.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { View, ViewProps } from 'react-native';
|
|
3
3
|
import { GridContext } from './index';
|
|
4
|
-
import { ApplicationContext } from '../
|
|
4
|
+
import { ApplicationContext } from '../Context';
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
import { SpanNumber } from './types';
|
|
7
7
|
|
package/Layout/Screen.tsx
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
ViewProps,
|
|
27
27
|
} from 'react-native';
|
|
28
28
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
29
|
-
import { ApplicationContext, ScreenContext } from '../
|
|
29
|
+
import { ApplicationContext, ScreenContext } from '../Context';
|
|
30
30
|
import Navigation from '../Application/Navigation';
|
|
31
31
|
import {
|
|
32
32
|
AnimatedHeader,
|
|
@@ -36,17 +36,19 @@ import {
|
|
|
36
36
|
} from '../Application/types';
|
|
37
37
|
import { Colors, Spacing, Styles } from '../Consts';
|
|
38
38
|
import { FloatingButton, FloatingButtonProps } from './FloatingButton';
|
|
39
|
-
import { Section, validateChildren } from './index';
|
|
40
39
|
import styles from './styles';
|
|
41
40
|
import { HeaderType } from './types';
|
|
42
41
|
import { InputRef } from '../Input';
|
|
43
42
|
import { exportHeaderTitle, getOptions } from '../Application/utils';
|
|
43
|
+
import { validateChildren } from './utils';
|
|
44
|
+
import Section from './Section';
|
|
44
45
|
import {
|
|
45
46
|
HeaderBackground,
|
|
46
47
|
HeaderExtendHeader,
|
|
48
|
+
HeaderLeft,
|
|
47
49
|
HeaderTitle,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
SearchHeader,
|
|
51
|
+
} from '../Application';
|
|
50
52
|
|
|
51
53
|
export interface ScreenProps extends ViewProps {
|
|
52
54
|
/**
|
|
@@ -385,7 +387,8 @@ const Screen = forwardRef(
|
|
|
385
387
|
margin: 0,
|
|
386
388
|
left: Spacing.M,
|
|
387
389
|
},
|
|
388
|
-
headerLeft: () =>
|
|
390
|
+
headerLeft: (props: any) =>
|
|
391
|
+
params?.hiddenBack ? null : <HeaderLeft {...props} />,
|
|
389
392
|
headerTitle: () => (
|
|
390
393
|
<SearchHeader {...params} animatedValue={animatedValue.current} />
|
|
391
394
|
),
|
package/Layout/Section.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Dimensions, View, ViewProps } from 'react-native';
|
|
|
3
3
|
import { useGridSystem } from './utils';
|
|
4
4
|
import { GridContextProps } from './types';
|
|
5
5
|
import { GridContext } from './index';
|
|
6
|
-
import { ApplicationContext } from '../
|
|
6
|
+
import { ApplicationContext } from '../Context';
|
|
7
7
|
import styles from './styles';
|
|
8
8
|
import { Image } from '../Image';
|
|
9
9
|
import { Spacing } from '../Consts';
|
package/Layout/TrackingScope.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {TrackingScopeContext} from '../
|
|
2
|
+
import { TrackingScopeContext } from '../Context';
|
|
3
3
|
|
|
4
4
|
const TrackingScope = ({
|
|
5
5
|
scopeName,
|
|
@@ -9,10 +9,10 @@ const TrackingScope = ({
|
|
|
9
9
|
children: any;
|
|
10
10
|
}) => {
|
|
11
11
|
return (
|
|
12
|
-
<TrackingScopeContext.Provider value={{scopeName}}>
|
|
12
|
+
<TrackingScopeContext.Provider value={{ scopeName }}>
|
|
13
13
|
{children}
|
|
14
14
|
</TrackingScopeContext.Provider>
|
|
15
15
|
);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export {TrackingScope};
|
|
18
|
+
export { TrackingScope };
|
package/Loader/DotLoader.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
2
|
import AnimatedLottieView from 'lottie-react-native';
|
|
3
3
|
import animation from '../Assets/DotAnimation.json';
|
|
4
|
-
import {ApplicationContext} from '../
|
|
5
|
-
import {hexToRGBA} from './utils';
|
|
6
|
-
import {LoaderProps} from './types';
|
|
4
|
+
import { ApplicationContext } from '../Context';
|
|
5
|
+
import { hexToRGBA } from './utils';
|
|
6
|
+
import { LoaderProps } from './types';
|
|
7
7
|
|
|
8
|
-
const DotLoader: FC<LoaderProps> = ({color, style}) => {
|
|
9
|
-
const {theme} = useContext(ApplicationContext);
|
|
8
|
+
const DotLoader: FC<LoaderProps> = ({ color, style }) => {
|
|
9
|
+
const { theme } = useContext(ApplicationContext);
|
|
10
10
|
|
|
11
11
|
const arrayColor = [
|
|
12
12
|
color ?? theme.colors.primary,
|
|
@@ -28,7 +28,7 @@ const DotLoader: FC<LoaderProps> = ({color, style}) => {
|
|
|
28
28
|
return (
|
|
29
29
|
<AnimatedLottieView
|
|
30
30
|
source={source}
|
|
31
|
-
style={[{width: 52, height: 18}, style]}
|
|
31
|
+
style={[{ width: 52, height: 18 }, style]}
|
|
32
32
|
autoPlay
|
|
33
33
|
/>
|
|
34
34
|
);
|
package/Loader/ProgressBar.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext, useEffect, useRef} from 'react';
|
|
2
|
-
import {Animated, View} from 'react-native';
|
|
1
|
+
import React, { FC, useContext, useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, View } from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
|
-
import {ProgressBarProps} from './types';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
6
|
-
import {Radius} from '../Consts';
|
|
4
|
+
import { ProgressBarProps } from './types';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
|
+
import { Radius } from '../Consts';
|
|
7
7
|
|
|
8
|
-
const ProgressBar: FC<ProgressBarProps> = ({percent = 0, style}) => {
|
|
9
|
-
const {theme} = useContext(ApplicationContext);
|
|
8
|
+
const ProgressBar: FC<ProgressBarProps> = ({ percent = 0, style }) => {
|
|
9
|
+
const { theme } = useContext(ApplicationContext);
|
|
10
10
|
const animation = useRef(new Animated.Value(0)).current;
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
@@ -27,8 +27,9 @@ const ProgressBar: FC<ProgressBarProps> = ({percent = 0, style}) => {
|
|
|
27
27
|
style={[
|
|
28
28
|
style,
|
|
29
29
|
styles.progressContainer,
|
|
30
|
-
{backgroundColor: theme.colors.background.default},
|
|
31
|
-
]}
|
|
30
|
+
{ backgroundColor: theme.colors.background.default },
|
|
31
|
+
]}
|
|
32
|
+
>
|
|
32
33
|
<Animated.View
|
|
33
34
|
style={{
|
|
34
35
|
height: 4,
|
package/Loader/Spinner.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
2
|
import AnimatedLottieView from 'lottie-react-native';
|
|
3
3
|
import animation from '../Assets/SpinnerAnimation.json';
|
|
4
|
-
import {hexToRGBA} from './utils';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
6
|
-
import {LoaderProps} from './types';
|
|
4
|
+
import { hexToRGBA } from './utils';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
|
+
import { LoaderProps } from './types';
|
|
7
7
|
|
|
8
|
-
const Spinner: FC<LoaderProps> = ({color, style}) => {
|
|
9
|
-
const {theme} = useContext(ApplicationContext);
|
|
8
|
+
const Spinner: FC<LoaderProps> = ({ color, style }) => {
|
|
9
|
+
const { theme } = useContext(ApplicationContext);
|
|
10
10
|
|
|
11
11
|
let source: any = animation;
|
|
12
12
|
source.assets[0].layers.forEach((layer: any) => {
|
|
@@ -20,7 +20,7 @@ const Spinner: FC<LoaderProps> = ({color, style}) => {
|
|
|
20
20
|
return (
|
|
21
21
|
<AnimatedLottieView
|
|
22
22
|
source={source}
|
|
23
|
-
style={[{width: 24, height: 24}, style]}
|
|
23
|
+
style={[{ width: 24, height: 24 }, style]}
|
|
24
24
|
autoPlay
|
|
25
25
|
/>
|
|
26
26
|
);
|
package/Pagination/Dot.tsx
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {Animated} from 'react-native';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
|
-
import {DotProps} from './types';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
4
|
+
import { DotProps } from './types';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
6
|
|
|
7
|
-
const Dot: FC<DotProps> = ({active, style}) => {
|
|
8
|
-
const {theme} = useContext(ApplicationContext);
|
|
7
|
+
const Dot: FC<DotProps> = ({ active, style }) => {
|
|
8
|
+
const { theme } = useContext(ApplicationContext);
|
|
9
9
|
const dotStyle = active
|
|
10
10
|
? [styles.activeDot]
|
|
11
|
-
: [
|
|
11
|
+
: [
|
|
12
|
+
styles.inactiveDot,
|
|
13
|
+
{ backgroundColor: theme.colors.background.pressed },
|
|
14
|
+
];
|
|
12
15
|
|
|
13
16
|
return <Animated.View style={[style, dotStyle]} />;
|
|
14
17
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
3
|
-
import {ChildPaginationProps} from './types';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { ChildPaginationProps } from './types';
|
|
4
4
|
import Dot from './Dot';
|
|
5
5
|
import styles from './styles';
|
|
6
|
-
import {Spacing} from '../Consts';
|
|
7
|
-
import {ApplicationContext} from '../
|
|
6
|
+
import { Spacing } from '../Consts';
|
|
7
|
+
import { ApplicationContext } from '../Context';
|
|
8
8
|
|
|
9
9
|
const PaginationDot: FC<ChildPaginationProps> = ({
|
|
10
10
|
dataLength = 2,
|
|
11
11
|
activeIndex = 0,
|
|
12
12
|
style,
|
|
13
13
|
}) => {
|
|
14
|
-
const {theme} = useContext(ApplicationContext);
|
|
14
|
+
const { theme } = useContext(ApplicationContext);
|
|
15
15
|
const renderDots = () => {
|
|
16
16
|
const dots: React.ReactElement[] = [];
|
|
17
17
|
for (let i = 0; i < dataLength; i++) {
|
|
@@ -19,8 +19,8 @@ const PaginationDot: FC<ChildPaginationProps> = ({
|
|
|
19
19
|
<Dot
|
|
20
20
|
key={`Dot${i}`}
|
|
21
21
|
style={[
|
|
22
|
-
i !== dataLength - 1 ? {marginRight: Spacing.XS} : {},
|
|
23
|
-
{backgroundColor: theme.colors.primary},
|
|
22
|
+
i !== dataLength - 1 ? { marginRight: Spacing.XS } : {},
|
|
23
|
+
{ backgroundColor: theme.colors.primary },
|
|
24
24
|
]}
|
|
25
25
|
active={activeIndex === i}
|
|
26
26
|
/>,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, {FC, useContext, useRef, useState} from 'react';
|
|
2
|
-
import {Animated, View} from 'react-native';
|
|
3
|
-
import {ScrollIndicatorProps} from './types';
|
|
1
|
+
import React, { FC, useContext, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, View } from 'react-native';
|
|
3
|
+
import { ScrollIndicatorProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
6
|
|
|
7
7
|
const INDICATOR_WIDTH = 24;
|
|
8
8
|
const INDICATOR_CONTAINER_WIDTH = 72;
|
|
@@ -11,7 +11,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
11
11
|
children,
|
|
12
12
|
scrollViewRef,
|
|
13
13
|
}) => {
|
|
14
|
-
const {theme} = useContext(ApplicationContext);
|
|
14
|
+
const { theme } = useContext(ApplicationContext);
|
|
15
15
|
const left = useRef(new Animated.Value(0)).current;
|
|
16
16
|
const [scrollViewWidth, setScrollViewWidth] = useState(0);
|
|
17
17
|
const [scrollContentWidth, setScrollContentWidth] = useState(0);
|
|
@@ -23,7 +23,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
23
23
|
outputRange: [0, INDICATOR_CONTAINER_WIDTH - INDICATOR_WIDTH],
|
|
24
24
|
extrapolate: 'clamp',
|
|
25
25
|
});
|
|
26
|
-
return {transform: [{translateX: value}]};
|
|
26
|
+
return { transform: [{ translateX: value }] };
|
|
27
27
|
}
|
|
28
28
|
return {};
|
|
29
29
|
};
|
|
@@ -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}
|
|
@@ -53,7 +53,8 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
53
53
|
}}
|
|
54
54
|
onLayout={e => {
|
|
55
55
|
setScrollViewWidth(e.nativeEvent.layout.width);
|
|
56
|
-
}}
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
57
58
|
{children}
|
|
58
59
|
</Animated.ScrollView>
|
|
59
60
|
);
|
|
@@ -63,8 +64,9 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
63
64
|
<View
|
|
64
65
|
style={[
|
|
65
66
|
styles.indicatorContainer,
|
|
66
|
-
{backgroundColor: theme.colors.background.pressed},
|
|
67
|
-
]}
|
|
67
|
+
{ backgroundColor: theme.colors.background.pressed },
|
|
68
|
+
]}
|
|
69
|
+
>
|
|
68
70
|
<Animated.View
|
|
69
71
|
style={[
|
|
70
72
|
styles.indicator,
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import { ApplicationContext, MiniAppContext } from '../
|
|
9
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
10
10
|
import { Button } from '../Button';
|
|
11
11
|
import { Radius, Spacing, Styles } from '../Consts';
|
|
12
12
|
import { Icon } from '../Icon';
|
|
@@ -226,7 +226,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
226
226
|
<Text
|
|
227
227
|
accessibilityLabel={'description_popup_notify'}
|
|
228
228
|
typography={'body_default_regular'}
|
|
229
|
-
onTextLayout={({nativeEvent: {lines}}) => {
|
|
229
|
+
onTextLayout={({ nativeEvent: { lines } }) => {
|
|
230
230
|
const enableScroll = lines.length > 8.5;
|
|
231
231
|
if (enableScroll !== scrollContent) {
|
|
232
232
|
setScrollContent(enableScroll);
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
2
2
|
import { Dimensions, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { PopupPromotionProps } from './types';
|
|
4
|
-
import { ApplicationContext, MiniAppContext } from '../
|
|
4
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
5
5
|
import { Image } from '../Image';
|
|
6
6
|
import { Radius, Spacing } from '../Consts';
|
|
7
7
|
import { Icon } from '../Icon';
|
package/Radio/index.tsx
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {TouchableOpacity, View} from 'react-native';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {RadioProps} from './types';
|
|
5
|
-
import {Text} from '../Text';
|
|
4
|
+
import { RadioProps } from './types';
|
|
5
|
+
import { Text } from '../Text';
|
|
6
6
|
import styles from './styles';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
useComponentId,
|
|
11
|
-
} from '../Application';
|
|
12
|
-
import {Spacing} from '../Consts';
|
|
7
|
+
import { useComponentId } from '../Application';
|
|
8
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
9
|
+
import { Spacing } from '../Consts';
|
|
13
10
|
|
|
14
11
|
const Radio: FC<RadioProps> = ({
|
|
15
12
|
value,
|
|
@@ -23,12 +20,12 @@ const Radio: FC<RadioProps> = ({
|
|
|
23
20
|
accessibilityLabel,
|
|
24
21
|
...props
|
|
25
22
|
}) => {
|
|
26
|
-
const {theme} = useContext(ApplicationContext);
|
|
23
|
+
const { theme } = useContext(ApplicationContext);
|
|
27
24
|
const selected = value === groupValue;
|
|
28
25
|
const componentName = 'Radio';
|
|
29
|
-
const {componentId} = useComponentId(
|
|
26
|
+
const { componentId } = useComponentId(
|
|
30
27
|
`${componentName}${label ? `/${label}` : ''}`,
|
|
31
|
-
accessibilityLabel
|
|
28
|
+
accessibilityLabel,
|
|
32
29
|
);
|
|
33
30
|
let disabledStyle = {};
|
|
34
31
|
let checkBoxStyle = {
|
|
@@ -58,7 +55,8 @@ const Radio: FC<RadioProps> = ({
|
|
|
58
55
|
params,
|
|
59
56
|
state: disabled ? 'disabled' : 'enabled',
|
|
60
57
|
action: 'click',
|
|
61
|
-
}}
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
62
60
|
<TouchableOpacity
|
|
63
61
|
{...props}
|
|
64
62
|
disabled={disabled}
|
|
@@ -75,20 +73,22 @@ const Radio: FC<RadioProps> = ({
|
|
|
75
73
|
disabled: disabled as boolean,
|
|
76
74
|
...accessibilityState,
|
|
77
75
|
}}
|
|
78
|
-
accessibilityLabel={componentId}
|
|
76
|
+
accessibilityLabel={componentId}
|
|
77
|
+
>
|
|
79
78
|
<View
|
|
80
79
|
style={[
|
|
81
80
|
styles.radio,
|
|
82
81
|
checkBoxStyle,
|
|
83
82
|
disabledStyle,
|
|
84
|
-
{marginRight: label ? Spacing.S : 0},
|
|
83
|
+
{ marginRight: label ? Spacing.S : 0 },
|
|
85
84
|
]}
|
|
86
85
|
/>
|
|
87
86
|
{!!label && (
|
|
88
87
|
<Text
|
|
89
88
|
typography={'body_default_regular'}
|
|
90
89
|
style={styles.radioText}
|
|
91
|
-
accessibilityLabel={componentId + '|text'}
|
|
90
|
+
accessibilityLabel={componentId + '|text'}
|
|
91
|
+
>
|
|
92
92
|
{label}
|
|
93
93
|
</Text>
|
|
94
94
|
)}
|
|
@@ -97,4 +97,4 @@ const Radio: FC<RadioProps> = ({
|
|
|
97
97
|
);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
export {Radio};
|
|
100
|
+
export { Radio };
|
package/Skeleton/index.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import LinearGradient from 'react-native-linear-gradient';
|
|
|
12
12
|
import { SkeletonTypes } from './types';
|
|
13
13
|
import { Colors, Styles } from '../Consts';
|
|
14
14
|
import styles from './styles';
|
|
15
|
-
import { ScreenContext, SkeletonContext } from '../
|
|
15
|
+
import { ScreenContext, SkeletonContext } from '../Context';
|
|
16
16
|
|
|
17
17
|
const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
18
18
|
const screen = useContext<any>(ScreenContext);
|