@momo-kits/foundation 0.77.8-beta.4 → 0.77.8-beta.6
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/ModalScreen.tsx +6 -33
- package/Application/NavigationContainer.tsx +22 -1
- package/Application/types.ts +15 -16
- package/Button/index.tsx +20 -0
- package/Divider/index.tsx +2 -0
- package/Input/Input.tsx +126 -107
- package/Input/InputMoney.tsx +118 -111
- package/Input/InputSearch.tsx +129 -124
- package/Input/InputTextArea.tsx +126 -119
- package/Input/index.tsx +5 -0
- package/Layout/Card.tsx +9 -2
- package/Layout/Item.tsx +15 -2
- package/Layout/Screen.tsx +61 -3
- package/Layout/Section.tsx +36 -3
- package/Layout/types.ts +0 -37
- package/Loader/DotLoader.tsx +10 -12
- package/Loader/Loader.tsx +3 -4
- package/Loader/Spinner.tsx +8 -10
- package/Loader/types.ts +24 -0
- package/Popup/PopupNotify.tsx +2 -10
- package/Skeleton/types.ts +3 -0
- package/Text/utils.ts +1 -1
- package/package.json +1 -1
package/Input/InputTextArea.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {FC, useContext, useRef, useState} from 'react';
|
|
1
|
+
import React, {FC, forwardRef, useContext, useRef, useState} from 'react';
|
|
2
2
|
import {
|
|
3
3
|
NativeSyntheticEvent,
|
|
4
4
|
TextInput,
|
|
@@ -19,135 +19,142 @@ import {InputTextAreaProps} from './index';
|
|
|
19
19
|
import {Icon} from '../Icon';
|
|
20
20
|
import {ApplicationContext} from '../Application';
|
|
21
21
|
|
|
22
|
-
const InputTextArea: FC<InputTextAreaProps> = (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
const InputTextArea: FC<InputTextAreaProps> = forwardRef(
|
|
23
|
+
(
|
|
24
|
+
{
|
|
25
|
+
errorMessage,
|
|
26
|
+
onChangeText,
|
|
27
|
+
floatingIconColor,
|
|
28
|
+
floatingIcon,
|
|
29
|
+
floatingValue,
|
|
30
|
+
onFocus,
|
|
31
|
+
onBlur,
|
|
32
|
+
disabled,
|
|
33
|
+
value,
|
|
34
|
+
defaultValue,
|
|
35
|
+
height,
|
|
36
|
+
placeholder,
|
|
37
|
+
maxLength,
|
|
38
|
+
required,
|
|
39
|
+
errorSpacing,
|
|
40
|
+
...props
|
|
41
|
+
},
|
|
42
|
+
ref,
|
|
43
|
+
) => {
|
|
44
|
+
const {theme} = useContext(ApplicationContext);
|
|
45
|
+
const [focused, setFocused] = useState(false);
|
|
46
|
+
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
47
|
+
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
const onClearText = () => {
|
|
50
|
+
inputRef?.current?.clear();
|
|
51
|
+
_onChangeText('');
|
|
52
|
+
};
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
const _onChangeText = (text: string) => {
|
|
55
|
+
onChangeText?.(text);
|
|
56
|
+
setInputValue(text);
|
|
57
|
+
};
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
60
|
+
setFocused(true);
|
|
61
|
+
onFocus?.(e);
|
|
62
|
+
};
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
const _onBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
65
|
+
setFocused(false);
|
|
66
|
+
onBlur?.(e);
|
|
67
|
+
};
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
const renderCountingView = () => {
|
|
70
|
+
return (
|
|
71
|
+
<View style={styles.countingView}>
|
|
72
|
+
<Text color={theme.colors.text.hint} typography={'description_xs'}>
|
|
73
|
+
{`${inputValue.length}/${maxLength}`}
|
|
74
|
+
</Text>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
const renderInputView = () => {
|
|
79
|
+
const disabledColor = theme.colors.text.disable;
|
|
80
|
+
let textColor = theme.colors.text.default;
|
|
81
|
+
let placeholderColor = theme.colors.text.hint;
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
if (disabled) {
|
|
84
|
+
textColor = disabledColor;
|
|
85
|
+
placeholderColor = disabledColor;
|
|
86
|
+
}
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/>
|
|
126
|
-
</View>
|
|
127
|
-
{focused && inputValue.length > 0 && (
|
|
128
|
-
<TouchableOpacity style={styles.iconWrapper} onPress={onClearText}>
|
|
129
|
-
<Icon
|
|
130
|
-
source="24_navigation_close_circle_full"
|
|
131
|
-
size={16}
|
|
132
|
-
color={theme.colors.text.hint}
|
|
88
|
+
return (
|
|
89
|
+
<View
|
|
90
|
+
style={[
|
|
91
|
+
styles.textAreaWrapper,
|
|
92
|
+
{
|
|
93
|
+
height: height || DEFAULT_HEIGHT,
|
|
94
|
+
backgroundColor: theme.colors.background.surface,
|
|
95
|
+
},
|
|
96
|
+
getBorderColor(theme, focused, errorMessage, disabled),
|
|
97
|
+
]}>
|
|
98
|
+
<FloatingView
|
|
99
|
+
floatingValue={floatingValue}
|
|
100
|
+
floatingIconColor={floatingIconColor}
|
|
101
|
+
disabled={disabled}
|
|
102
|
+
floatingIcon={floatingIcon}
|
|
103
|
+
required={required}
|
|
104
|
+
/>
|
|
105
|
+
<View style={styles.rowArea}>
|
|
106
|
+
<View style={styles.textAreaView}>
|
|
107
|
+
<TextInput
|
|
108
|
+
{...props}
|
|
109
|
+
accessibilityLabel={`TextInput`}
|
|
110
|
+
ref={inputRef}
|
|
111
|
+
editable={!disabled}
|
|
112
|
+
textAlignVertical="top"
|
|
113
|
+
style={[
|
|
114
|
+
styles.textArea,
|
|
115
|
+
{
|
|
116
|
+
color: textColor,
|
|
117
|
+
},
|
|
118
|
+
]}
|
|
119
|
+
maxLength={maxLength}
|
|
120
|
+
textBreakStrategy="highQuality"
|
|
121
|
+
multiline={true}
|
|
122
|
+
value={value}
|
|
123
|
+
onChangeText={_onChangeText}
|
|
124
|
+
onFocus={_onFocus}
|
|
125
|
+
onBlur={_onBlur}
|
|
126
|
+
placeholder={placeholder}
|
|
127
|
+
selectionColor={theme.colors.primary}
|
|
128
|
+
placeholderTextColor={placeholderColor}
|
|
133
129
|
/>
|
|
134
|
-
</
|
|
135
|
-
|
|
130
|
+
</View>
|
|
131
|
+
{focused && inputValue.length > 0 && (
|
|
132
|
+
<TouchableOpacity
|
|
133
|
+
style={styles.iconWrapper}
|
|
134
|
+
onPress={onClearText}>
|
|
135
|
+
<Icon
|
|
136
|
+
source="24_navigation_close_circle_full"
|
|
137
|
+
size={16}
|
|
138
|
+
color={theme.colors.text.hint}
|
|
139
|
+
/>
|
|
140
|
+
</TouchableOpacity>
|
|
141
|
+
)}
|
|
142
|
+
</View>
|
|
143
|
+
{renderCountingView()}
|
|
136
144
|
</View>
|
|
137
|
-
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<View
|
|
150
|
+
style={styles.wrapper}
|
|
151
|
+
accessibilityLabel={`InputTextArea/${floatingValue}`}>
|
|
152
|
+
{renderInputView()}
|
|
153
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
138
154
|
</View>
|
|
139
155
|
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return (
|
|
143
|
-
<View
|
|
144
|
-
style={styles.wrapper}
|
|
145
|
-
accessibilityLabel={`InputTextArea/${floatingValue}`}>
|
|
146
|
-
{renderInputView()}
|
|
147
|
-
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
148
|
-
</View>
|
|
149
|
-
);
|
|
150
|
-
};
|
|
156
|
+
},
|
|
157
|
+
);
|
|
151
158
|
|
|
152
159
|
InputTextArea.defaultProps = {
|
|
153
160
|
maxLength: MAX_LENGTH,
|
package/Input/index.tsx
CHANGED
|
@@ -59,6 +59,11 @@ export interface InputProps extends TextInputProps {
|
|
|
59
59
|
* Defaults to `false` if not provided.
|
|
60
60
|
*/
|
|
61
61
|
errorSpacing?: boolean;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* If true, the icon of input will use be show indicator loading.
|
|
65
|
+
*/
|
|
66
|
+
loading?: boolean;
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
type InputPropsWithoutSizeAndIcon = Omit<
|
package/Layout/Card.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import {Dimensions, View} from 'react-native';
|
|
2
|
+
import {Dimensions, View, ViewProps} from 'react-native';
|
|
3
3
|
import {useGridSystem, validateChildren} from './utils';
|
|
4
|
-
import {
|
|
4
|
+
import {GridContextProps} from './types';
|
|
5
5
|
import {GridContext, GridSystem} from './index';
|
|
6
6
|
import Item from './Item';
|
|
7
7
|
import {Image} from '../Image';
|
|
@@ -9,6 +9,13 @@ import {ApplicationContext} from '../Application';
|
|
|
9
9
|
import styles from './styles';
|
|
10
10
|
import {Colors, Spacing} from '../Consts';
|
|
11
11
|
|
|
12
|
+
export interface CardProps extends ViewProps {
|
|
13
|
+
/**
|
|
14
|
+
* Optional. Background image for the card.
|
|
15
|
+
*/
|
|
16
|
+
backgroundImage?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
const Card: React.FC<CardProps> = ({children, style, backgroundImage}) => {
|
|
13
20
|
const {showGrid} = useContext(ApplicationContext);
|
|
14
21
|
const {numberOfColumns} = useGridSystem();
|
package/Layout/Item.tsx
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
2
|
+
import {View, ViewProps} from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {ItemProps} from './types';
|
|
5
4
|
import {GridContext} from './index';
|
|
6
5
|
import {ApplicationContext} from '../Application';
|
|
7
6
|
import styles from './styles';
|
|
8
7
|
|
|
8
|
+
type SpanNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
9
|
+
|
|
10
|
+
export interface ItemProps extends ViewProps {
|
|
11
|
+
/**
|
|
12
|
+
* Represents the width of the Card component in terms of span numbers (1-12).
|
|
13
|
+
*/
|
|
14
|
+
widthSpan?: SpanNumber;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Optional. Represents the height of the Card component in terms of span numbers (1-12).
|
|
18
|
+
*/
|
|
19
|
+
heightSpan?: SpanNumber;
|
|
20
|
+
}
|
|
21
|
+
|
|
9
22
|
const Item: React.FC<ItemProps> = ({
|
|
10
23
|
widthSpan,
|
|
11
24
|
heightSpan,
|
package/Layout/Screen.tsx
CHANGED
|
@@ -1,13 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Animated,
|
|
3
|
+
KeyboardAvoidingView,
|
|
4
|
+
Platform,
|
|
5
|
+
ScrollViewProps,
|
|
6
|
+
View,
|
|
7
|
+
ViewProps,
|
|
8
|
+
} from 'react-native';
|
|
2
9
|
import {useHeaderHeight} from '@react-navigation/stack';
|
|
3
10
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
4
|
-
import React, {useContext, useEffect, useRef} from 'react';
|
|
5
|
-
import {ScreenProps} from '../Application/types';
|
|
11
|
+
import React, {ReactNode, useContext, useEffect, useRef} from 'react';
|
|
6
12
|
import {Spacing, Styles} from '../Consts';
|
|
7
13
|
import {Card, Section, validateChildren} from './index';
|
|
8
14
|
import {ApplicationContext, HeaderTitle} from '../Application';
|
|
9
15
|
import Navigation from '../Application/Navigation';
|
|
10
16
|
|
|
17
|
+
export interface ScreenProps extends ViewProps {
|
|
18
|
+
/**
|
|
19
|
+
* Optional. Navigation object for handling navigation actions.
|
|
20
|
+
*/
|
|
21
|
+
navigation?: Navigation;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Optional. If `true`, enable keyboard avoiding view for the screen.
|
|
25
|
+
*/
|
|
26
|
+
enableKeyboardAvoidingView?: boolean;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Optional. Background color of the header.
|
|
30
|
+
*/
|
|
31
|
+
headerBackground?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Optional. If `true`, the screen content is scrollable.
|
|
35
|
+
*/
|
|
36
|
+
scrollable?: boolean;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Optional. If `true`, use an animated header for the screen.
|
|
40
|
+
*/
|
|
41
|
+
useAnimatedHeader?: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Optional. If `true`, use an extended header for the screen.
|
|
45
|
+
*/
|
|
46
|
+
useExtendedHeader?: boolean;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Optional. Props for the underlying ScrollView component when `scrollable` is `true`.
|
|
50
|
+
*/
|
|
51
|
+
scrollViewProps?: ScrollViewProps;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Optional. ReactNode representing the footer component of the screen.
|
|
55
|
+
*/
|
|
56
|
+
footerComponent?: ReactNode;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Optional. Margin for the header component.
|
|
60
|
+
*/
|
|
61
|
+
marginHeader?: number;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Optional. Background color of the screen.
|
|
65
|
+
*/
|
|
66
|
+
backgroundColor?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
11
69
|
const Screen: React.FC<ScreenProps> = ({
|
|
12
70
|
children,
|
|
13
71
|
enableKeyboardAvoidingView = false,
|
package/Layout/Section.tsx
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import {Dimensions, View} from 'react-native';
|
|
2
|
+
import {Dimensions, View, ViewProps} from 'react-native';
|
|
3
3
|
import {useGridSystem, validateChildren} from './utils';
|
|
4
|
-
import {GridContextProps
|
|
4
|
+
import {GridContextProps} from './types';
|
|
5
5
|
import {GridContext} from './index';
|
|
6
6
|
import Item from './Item';
|
|
7
7
|
import {ApplicationContext} from '../Application';
|
|
8
8
|
import styles from './styles';
|
|
9
9
|
import {Image} from '../Image';
|
|
10
10
|
|
|
11
|
+
export interface SectionProps extends ViewProps {
|
|
12
|
+
/**
|
|
13
|
+
* Optional. If `true`, the Section component will be displayed in an expanded state.
|
|
14
|
+
* Defaults to `false` if not provided.
|
|
15
|
+
*/
|
|
16
|
+
expanded?: boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Optional. If `true`, margin will be applied to the Section component.
|
|
20
|
+
* Defaults to `false` if not provided.
|
|
21
|
+
*/
|
|
22
|
+
useMargin?: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Optional. Background color for the Section component.
|
|
26
|
+
*/
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Optional. Background image for the Section component.
|
|
31
|
+
*/
|
|
32
|
+
backgroundImage?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
11
35
|
const Section: React.FC<SectionProps> = ({
|
|
12
36
|
children,
|
|
13
37
|
useMargin = true,
|
|
@@ -116,7 +140,16 @@ const Section: React.FC<SectionProps> = ({
|
|
|
116
140
|
};
|
|
117
141
|
|
|
118
142
|
return (
|
|
119
|
-
<GridContext.Provider
|
|
143
|
+
<GridContext.Provider
|
|
144
|
+
value={{
|
|
145
|
+
numberOfColumns,
|
|
146
|
+
gutterSize,
|
|
147
|
+
margin,
|
|
148
|
+
sizePerSpan,
|
|
149
|
+
getSizeSpan: span => {
|
|
150
|
+
return span * sizePerSpan + (span - 1) * gutterSize;
|
|
151
|
+
},
|
|
152
|
+
}}>
|
|
120
153
|
<View
|
|
121
154
|
accessibilityLabel={`Section`}
|
|
122
155
|
style={{
|
package/Layout/types.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {ViewProps} from 'react-native';
|
|
2
|
-
|
|
3
|
-
type SpanNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
4
|
-
|
|
5
1
|
export type GridContextProps = {
|
|
6
2
|
/**
|
|
7
3
|
* Represents the number of columns in the grid.
|
|
@@ -28,36 +24,3 @@ export type GridContextProps = {
|
|
|
28
24
|
*/
|
|
29
25
|
getSizeSpan: (span: number) => number;
|
|
30
26
|
};
|
|
31
|
-
export interface SectionProps extends ViewProps {
|
|
32
|
-
/**
|
|
33
|
-
* Optional. If `true`, the Section component will be displayed in an expanded state.
|
|
34
|
-
* Defaults to `false` if not provided.
|
|
35
|
-
*/
|
|
36
|
-
expanded?: boolean;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Optional. If `true`, margin will be applied to the Section component.
|
|
40
|
-
* Defaults to `false` if not provided.
|
|
41
|
-
*/
|
|
42
|
-
useMargin?: boolean;
|
|
43
|
-
|
|
44
|
-
backgroundColor?: string;
|
|
45
|
-
|
|
46
|
-
backgroundImage?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface ItemProps extends ViewProps {
|
|
50
|
-
/**
|
|
51
|
-
* Represents the width of the Card component in terms of span numbers (1-12).
|
|
52
|
-
*/
|
|
53
|
-
widthSpan?: SpanNumber;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Optional. Represents the height of the Card component in terms of span numbers (1-12).
|
|
57
|
-
*/
|
|
58
|
-
heightSpan?: SpanNumber;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface CardProps extends ViewProps {
|
|
62
|
-
backgroundImage?: string;
|
|
63
|
-
}
|
package/Loader/DotLoader.tsx
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {View, ViewProps} from 'react-native';
|
|
3
2
|
import AnimatedLottieView from 'lottie-react-native';
|
|
4
3
|
import animation from '../Assets/DotAnimation.json';
|
|
5
4
|
import {ApplicationContext} from '../Application';
|
|
6
5
|
import {hexToRGBA} from './utils';
|
|
6
|
+
import {LoaderProps} from './types';
|
|
7
7
|
|
|
8
|
-
const DotLoader: FC<
|
|
8
|
+
const DotLoader: FC<LoaderProps> = ({color}) => {
|
|
9
9
|
const {theme} = useContext(ApplicationContext);
|
|
10
10
|
|
|
11
11
|
const arrayColor = [
|
|
12
|
-
theme.colors.primary,
|
|
13
|
-
theme.colors.
|
|
14
|
-
theme.colors.primary,
|
|
12
|
+
color ?? theme.colors.primary,
|
|
13
|
+
theme.colors.background.surface,
|
|
14
|
+
color ?? theme.colors.primary,
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
let source: any = animation;
|
|
@@ -26,13 +26,11 @@ const DotLoader: FC<ViewProps> = ({style}) => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/>
|
|
35
|
-
</View>
|
|
29
|
+
<AnimatedLottieView
|
|
30
|
+
source={source}
|
|
31
|
+
style={{width: 52, height: 18}}
|
|
32
|
+
autoPlay
|
|
33
|
+
/>
|
|
36
34
|
);
|
|
37
35
|
};
|
|
38
36
|
|
package/Loader/Loader.tsx
CHANGED
|
@@ -3,12 +3,11 @@ import {LoaderProps} from './types';
|
|
|
3
3
|
import DotLoader from './DotLoader';
|
|
4
4
|
import Spinner from './Spinner';
|
|
5
5
|
|
|
6
|
-
const Loader: FC<LoaderProps> = ({type = 'dot',
|
|
6
|
+
const Loader: FC<LoaderProps> = ({type = 'dot', ...props}) => {
|
|
7
7
|
if (type === 'spinner') {
|
|
8
|
-
return <Spinner
|
|
8
|
+
return <Spinner {...props} key={props.color} />;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
return <DotLoader style={style} />;
|
|
10
|
+
return <DotLoader {...props} key={props.color} />;
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
export default Loader;
|
package/Loader/Spinner.tsx
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {View, ViewProps} from 'react-native';
|
|
3
2
|
import AnimatedLottieView from 'lottie-react-native';
|
|
4
3
|
import animation from '../Assets/SpinnerAnimation.json';
|
|
5
4
|
import {hexToRGBA} from './utils';
|
|
6
5
|
import {ApplicationContext} from '../Application';
|
|
6
|
+
import {LoaderProps} from './types';
|
|
7
7
|
|
|
8
|
-
const Spinner: FC<
|
|
8
|
+
const Spinner: FC<LoaderProps> = ({color}) => {
|
|
9
9
|
const {theme} = useContext(ApplicationContext);
|
|
10
10
|
|
|
11
11
|
let source: any = animation;
|
|
12
12
|
source.assets[0].layers.forEach((layer: any) => {
|
|
13
13
|
layer.shapes[0].it.forEach((item: any) => {
|
|
14
14
|
if (item.ty === 'fl' && item.c) {
|
|
15
|
-
item.c.k = hexToRGBA(theme.colors.primary);
|
|
15
|
+
item.c.k = hexToRGBA(color ?? theme.colors.primary);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/>
|
|
27
|
-
</View>
|
|
21
|
+
<AnimatedLottieView
|
|
22
|
+
source={source}
|
|
23
|
+
style={{width: 24, height: 24}}
|
|
24
|
+
autoPlay
|
|
25
|
+
/>
|
|
28
26
|
);
|
|
29
27
|
};
|
|
30
28
|
|
package/Loader/types.ts
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import {ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
3
|
export type LoaderProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Optional. Type of loader, can be 'dot' or 'spinner'.
|
|
6
|
+
*/
|
|
4
7
|
type?: 'dot' | 'spinner';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Optional. Color for the loader.
|
|
11
|
+
*/
|
|
12
|
+
color?: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Optional. Style or styles for the loader component.
|
|
16
|
+
*/
|
|
5
17
|
style?: ViewStyle | ViewStyle[];
|
|
6
18
|
};
|
|
7
19
|
|
|
8
20
|
export type ProgressBarProps = {
|
|
21
|
+
/**
|
|
22
|
+
* Required. Percentage value to display on the progress bar.
|
|
23
|
+
*/
|
|
9
24
|
percent: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Optional. Color for the progress bar.
|
|
28
|
+
*/
|
|
29
|
+
color?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Optional. Style or styles for the progress bar component.
|
|
33
|
+
*/
|
|
10
34
|
style?: ViewStyle | ViewStyle[];
|
|
11
35
|
};
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -10,8 +10,8 @@ import {Icon} from '../Icon';
|
|
|
10
10
|
|
|
11
11
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
12
12
|
image,
|
|
13
|
-
title,
|
|
14
|
-
description,
|
|
13
|
+
title = 'Title',
|
|
14
|
+
description = 'Description',
|
|
15
15
|
information,
|
|
16
16
|
secondary,
|
|
17
17
|
primary,
|
|
@@ -206,12 +206,4 @@ const styles = StyleSheet.create({
|
|
|
206
206
|
},
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
PopupNotify.defaultProps = {
|
|
210
|
-
title: 'Title',
|
|
211
|
-
primary: {
|
|
212
|
-
title: 'Primary',
|
|
213
|
-
onPress: () => {},
|
|
214
|
-
},
|
|
215
|
-
};
|
|
216
|
-
|
|
217
209
|
export default PopupNotify;
|