@momo-kits/foundation 0.80.8-beta.2 → 0.80.8-beta.8
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/Components.tsx +40 -2
- package/Application/Navigation.ts +2 -1
- package/Application/NavigationContainer.tsx +2 -2
- package/Application/index.ts +12 -5
- package/Application/types.ts +9 -6
- package/Application/utils.tsx +15 -47
- package/Input/Input.tsx +5 -3
- package/Input/InputDropDown.tsx +6 -3
- package/Input/InputMoney.tsx +6 -3
- package/Input/InputOTP.tsx +7 -9
- package/Input/InputSearch.tsx +6 -9
- package/Input/InputTextArea.tsx +5 -3
- package/Input/common.tsx +2 -2
- package/Input/index.tsx +3 -1
- package/Layout/Screen.tsx +84 -76
- package/Pagination/PaginationDot.tsx +6 -1
- package/Pagination/PaginationNumber.tsx +7 -4
- package/Pagination/PaginationWhiteDot.tsx +6 -1
- package/Pagination/styles.ts +3 -0
- package/Pagination/types.ts +2 -0
- package/Radio/types.ts +2 -2
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
Platform,
|
|
7
7
|
StatusBar,
|
|
8
8
|
StyleSheet,
|
|
9
|
-
TouchableOpacity
|
|
9
|
+
TouchableOpacity,
|
|
10
10
|
View,
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import {TouchableOpacity as TouchableGesture} from 'react-native-gesture-handler';
|
|
@@ -14,6 +14,7 @@ import {ApplicationContext} from './index';
|
|
|
14
14
|
import {Colors, Radius, Spacing, Styles} from '../Consts';
|
|
15
15
|
import {Image} from '../Image';
|
|
16
16
|
import {
|
|
17
|
+
HeaderAnimatedProps,
|
|
17
18
|
HeaderBackgroundProps,
|
|
18
19
|
HeaderBackProps,
|
|
19
20
|
HeaderToolkitProps,
|
|
@@ -24,7 +25,8 @@ import {scaleSize, Text} from '../Text';
|
|
|
24
25
|
import {Icon} from '../Icon';
|
|
25
26
|
import {PopupNotify} from '../Popup';
|
|
26
27
|
|
|
27
|
-
const Touchable =
|
|
28
|
+
const Touchable =
|
|
29
|
+
Platform.OS === 'android' ? TouchableGesture : TouchableOpacity;
|
|
28
30
|
|
|
29
31
|
const styles = StyleSheet.create({
|
|
30
32
|
navigationButton: {
|
|
@@ -416,6 +418,41 @@ const HeaderToolkitAction: React.FC<any> = ({tintColor}) => {
|
|
|
416
418
|
return <View />;
|
|
417
419
|
};
|
|
418
420
|
|
|
421
|
+
const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
|
|
422
|
+
animatedValue,
|
|
423
|
+
image,
|
|
424
|
+
onPress,
|
|
425
|
+
}) => {
|
|
426
|
+
const scale = animatedValue.interpolate({
|
|
427
|
+
inputRange: [-300, 0, 300],
|
|
428
|
+
outputRange: [2, 1, 1],
|
|
429
|
+
extrapolate: 'clamp',
|
|
430
|
+
});
|
|
431
|
+
const opacity = animatedValue.interpolate({
|
|
432
|
+
inputRange: [0, 150, 300],
|
|
433
|
+
outputRange: [1, 0.5, 0],
|
|
434
|
+
extrapolate: 'clamp',
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
return (
|
|
438
|
+
<TouchableOpacity onPress={onPress}>
|
|
439
|
+
<Animated.View
|
|
440
|
+
style={{
|
|
441
|
+
aspectRatio: 1.75,
|
|
442
|
+
opacity: opacity,
|
|
443
|
+
transform: [{scale: scale}],
|
|
444
|
+
}}>
|
|
445
|
+
<Image
|
|
446
|
+
source={{
|
|
447
|
+
uri: image,
|
|
448
|
+
}}
|
|
449
|
+
style={{width: '100%', height: '100%'}}
|
|
450
|
+
/>
|
|
451
|
+
</Animated.View>
|
|
452
|
+
</TouchableOpacity>
|
|
453
|
+
);
|
|
454
|
+
};
|
|
455
|
+
|
|
419
456
|
export {
|
|
420
457
|
NavigationButton,
|
|
421
458
|
HeaderTitle,
|
|
@@ -424,4 +461,5 @@ export {
|
|
|
424
461
|
HeaderRightAction,
|
|
425
462
|
HeaderToolkitAction,
|
|
426
463
|
HeaderCustom,
|
|
464
|
+
HeaderAnimated,
|
|
427
465
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import {NavigationProp} from '@react-navigation/native';
|
|
2
3
|
import {Alert} from 'react-native';
|
|
3
4
|
import {NavigationOptions, Theme} from './types';
|
|
@@ -16,7 +17,7 @@ class Navigation {
|
|
|
16
17
|
|
|
17
18
|
private filterParams = (params: NavigationOptions) => {
|
|
18
19
|
if (params.headerRight) {
|
|
19
|
-
const headerRight = params.headerRight?.();
|
|
20
|
+
const headerRight = params.headerRight?.({}) as React.ReactElement;
|
|
20
21
|
const type = headerRight?.type;
|
|
21
22
|
if (type !== HeaderRightAction && type !== HeaderToolkitAction) {
|
|
22
23
|
Alert.alert(
|
|
@@ -93,12 +93,12 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
93
93
|
name="Stack"
|
|
94
94
|
component={StackScreen}
|
|
95
95
|
initialParams={{screen}}
|
|
96
|
-
options={{...getStackOptions(
|
|
96
|
+
options={{...getStackOptions(), ...options}}
|
|
97
97
|
/>
|
|
98
98
|
<Stack.Screen
|
|
99
99
|
name="Dialog"
|
|
100
100
|
component={StackScreen}
|
|
101
|
-
options={getDialogOptions(
|
|
101
|
+
options={getDialogOptions()}
|
|
102
102
|
initialParams={{screen}}
|
|
103
103
|
/>
|
|
104
104
|
<Stack.Screen
|
package/Application/index.ts
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import {NavigationContainer} from './NavigationContainer';
|
|
2
2
|
import Screen from '../Layout/Screen';
|
|
3
3
|
import {
|
|
4
|
-
HeaderRightAction,
|
|
5
4
|
NavigationButton,
|
|
6
|
-
HeaderToolkitAction,
|
|
7
5
|
HeaderTitle,
|
|
6
|
+
HeaderLeft,
|
|
7
|
+
HeaderBackground,
|
|
8
|
+
HeaderRightAction,
|
|
9
|
+
HeaderToolkitAction,
|
|
10
|
+
HeaderCustom,
|
|
11
|
+
HeaderAnimated,
|
|
8
12
|
} from './Components';
|
|
9
13
|
import BottomTab from './BottomTab';
|
|
10
14
|
import {createContext} from 'react';
|
|
11
15
|
import {defaultContext} from '../Consts';
|
|
12
16
|
|
|
13
17
|
const ApplicationContext = createContext(defaultContext);
|
|
14
|
-
|
|
15
18
|
export {
|
|
16
19
|
NavigationContainer,
|
|
17
20
|
ApplicationContext,
|
|
18
21
|
Screen,
|
|
22
|
+
BottomTab,
|
|
19
23
|
NavigationButton,
|
|
24
|
+
HeaderTitle,
|
|
25
|
+
HeaderLeft,
|
|
26
|
+
HeaderBackground,
|
|
20
27
|
HeaderRightAction,
|
|
21
28
|
HeaderToolkitAction,
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
HeaderCustom,
|
|
30
|
+
HeaderAnimated,
|
|
24
31
|
};
|
package/Application/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {Animated} from 'react-native';
|
|
2
|
+
import {StackNavigationOptions} from '@react-navigation/stack';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import Navigator from './Navigator';
|
|
4
5
|
import {PopupNotifyProps} from '../Popup/types';
|
|
@@ -119,19 +120,15 @@ export type NavigationButtonProps = {
|
|
|
119
120
|
accessibilityLabel?: string;
|
|
120
121
|
};
|
|
121
122
|
|
|
122
|
-
export
|
|
123
|
+
export interface NavigationOptions extends StackNavigationOptions {
|
|
123
124
|
preventBack?: PopupNotifyProps;
|
|
124
125
|
onPressLeftHeader?: () => void;
|
|
125
126
|
surface?: boolean;
|
|
126
|
-
headerTransparent?: boolean;
|
|
127
127
|
hiddenBack?: boolean;
|
|
128
|
-
title?: string;
|
|
129
|
-
headerTitle?: (props?: any) => React.ReactElement;
|
|
130
128
|
headerTitleAlign?: 'left' | 'center';
|
|
131
129
|
customTitle?: TitleCustomProps;
|
|
132
|
-
headerRight?: (props?: any) => React.ReactElement;
|
|
133
130
|
animatedValue?: Animated.Value;
|
|
134
|
-
}
|
|
131
|
+
}
|
|
135
132
|
|
|
136
133
|
export interface HeaderBackProps extends NavigationButtonProps {
|
|
137
134
|
preventBack?: PopupNotifyProps;
|
|
@@ -164,6 +161,12 @@ export type HeaderToolkitProps = {
|
|
|
164
161
|
onAction?: (action: string) => void;
|
|
165
162
|
};
|
|
166
163
|
|
|
164
|
+
export type HeaderAnimatedProps = {
|
|
165
|
+
animatedValue: Animated.Value;
|
|
166
|
+
image: string;
|
|
167
|
+
onPress?: () => void;
|
|
168
|
+
};
|
|
169
|
+
|
|
167
170
|
export type BottomTabItemProps = {
|
|
168
171
|
name: string;
|
|
169
172
|
label: string;
|
package/Application/utils.tsx
CHANGED
|
@@ -13,35 +13,24 @@ import {
|
|
|
13
13
|
import {NavigationOptions, Theme} from './types';
|
|
14
14
|
import {Colors} from '../Consts';
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
if (theme.assets?.headerBackground) {
|
|
18
|
-
return {
|
|
19
|
-
headerTintColor: Colors.black_01,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
headerTintColor: theme.colors.text.default,
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const getStackOptions = (theme: Theme): StackNavigationOptions => {
|
|
16
|
+
const getStackOptions = (): StackNavigationOptions => {
|
|
28
17
|
return {
|
|
29
18
|
headerTitleAlign: 'left',
|
|
30
19
|
headerTitle: HeaderTitle,
|
|
31
|
-
headerBackground: HeaderBackground
|
|
20
|
+
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
32
21
|
headerLeft: (props: any) => <HeaderLeft {...props} />,
|
|
33
22
|
headerRight: (props: any) => <HeaderToolkitAction {...props} />,
|
|
34
|
-
|
|
23
|
+
headerTintColor: Colors.black_01,
|
|
35
24
|
};
|
|
36
25
|
};
|
|
37
26
|
|
|
38
|
-
const getDialogOptions = (
|
|
27
|
+
const getDialogOptions = (): StackNavigationOptions => {
|
|
39
28
|
return {
|
|
40
29
|
headerTitleAlign: 'left',
|
|
41
30
|
headerTitle: HeaderTitle,
|
|
42
31
|
headerLeft: (props: any) => <HeaderLeft {...props} />,
|
|
43
|
-
headerBackground: HeaderBackground
|
|
44
|
-
|
|
32
|
+
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
33
|
+
headerTintColor: Colors.black_01,
|
|
45
34
|
...TransitionPresets.ModalTransition,
|
|
46
35
|
};
|
|
47
36
|
};
|
|
@@ -72,8 +61,6 @@ const getModalOptions = (): StackNavigationOptions => {
|
|
|
72
61
|
};
|
|
73
62
|
|
|
74
63
|
const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
75
|
-
let backgroundProps: any;
|
|
76
|
-
let titleProps: any;
|
|
77
64
|
let options = {};
|
|
78
65
|
|
|
79
66
|
if (
|
|
@@ -99,36 +86,24 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
99
86
|
if (params.surface) {
|
|
100
87
|
options = {
|
|
101
88
|
...options,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
useBorder: true,
|
|
89
|
+
headerTintColor: theme.colors.text.default,
|
|
90
|
+
headerBackground: () => (
|
|
91
|
+
<HeaderBackground
|
|
92
|
+
image={null}
|
|
93
|
+
backgroundColor={theme.colors.background.surface}
|
|
94
|
+
useBorder={true}
|
|
95
|
+
/>
|
|
96
|
+
),
|
|
111
97
|
};
|
|
112
98
|
} else {
|
|
113
99
|
options = {
|
|
114
100
|
...options,
|
|
115
|
-
|
|
101
|
+
headerTintColor: Colors.black_01,
|
|
116
102
|
headerBackground: HeaderBackground,
|
|
117
103
|
};
|
|
118
104
|
}
|
|
119
105
|
}
|
|
120
106
|
|
|
121
|
-
if (params.animatedValue) {
|
|
122
|
-
backgroundProps = {...backgroundProps, animatedValue: params.animatedValue};
|
|
123
|
-
titleProps = {animatedValue: params.animatedValue};
|
|
124
|
-
options = {
|
|
125
|
-
...options,
|
|
126
|
-
headerTitle: (props: any) => {
|
|
127
|
-
return <HeaderTitle {...titleProps} {...props} />;
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
107
|
if (params.customTitle) {
|
|
133
108
|
options = {
|
|
134
109
|
...options,
|
|
@@ -139,13 +114,6 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
139
114
|
};
|
|
140
115
|
}
|
|
141
116
|
|
|
142
|
-
if (backgroundProps) {
|
|
143
|
-
options = {
|
|
144
|
-
...options,
|
|
145
|
-
headerBackground: () => <HeaderBackground {...backgroundProps} />,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
117
|
return {
|
|
150
118
|
...params,
|
|
151
119
|
...options,
|
package/Input/Input.tsx
CHANGED
|
@@ -35,6 +35,7 @@ const Input = forwardRef(
|
|
|
35
35
|
loading,
|
|
36
36
|
leadingIcon,
|
|
37
37
|
leadingIconColor,
|
|
38
|
+
style,
|
|
38
39
|
...props
|
|
39
40
|
}: InputProps,
|
|
40
41
|
ref,
|
|
@@ -43,6 +44,7 @@ const Input = forwardRef(
|
|
|
43
44
|
const [focused, setFocused] = useState(false);
|
|
44
45
|
const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
|
|
45
46
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
47
|
+
const accessibilityLabel = `Input/${floatingValue ?? placeholder}`;
|
|
46
48
|
|
|
47
49
|
const onClearText = () => {
|
|
48
50
|
inputRef?.current?.clear();
|
|
@@ -112,7 +114,7 @@ const Input = forwardRef(
|
|
|
112
114
|
)}
|
|
113
115
|
<TextInput
|
|
114
116
|
{...props}
|
|
115
|
-
accessibilityLabel={
|
|
117
|
+
accessibilityLabel={accessibilityLabel}
|
|
116
118
|
editable={!disabled}
|
|
117
119
|
textAlignVertical="center"
|
|
118
120
|
ref={inputRef}
|
|
@@ -153,8 +155,8 @@ const Input = forwardRef(
|
|
|
153
155
|
|
|
154
156
|
return (
|
|
155
157
|
<View
|
|
156
|
-
style={styles.wrapper}
|
|
157
|
-
accessibilityLabel={
|
|
158
|
+
style={[style, styles.wrapper]}
|
|
159
|
+
accessibilityLabel={accessibilityLabel}>
|
|
158
160
|
{renderInputView()}
|
|
159
161
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
160
162
|
</View>
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -25,10 +25,13 @@ const InputDropDown = ({
|
|
|
25
25
|
loading,
|
|
26
26
|
leadingIcon,
|
|
27
27
|
leadingIconColor,
|
|
28
|
+
style,
|
|
28
29
|
...props
|
|
29
30
|
}: InputDropDownProps) => {
|
|
30
31
|
const {theme} = useContext(ApplicationContext);
|
|
31
32
|
const full = !!value || !!placeholder;
|
|
33
|
+
const accessibilityLabel = `InputDropDown/${floatingValue ?? placeholder}`;
|
|
34
|
+
|
|
32
35
|
const renderIcon = (color: string | undefined) => {
|
|
33
36
|
if (loading) {
|
|
34
37
|
return <Loader type={'spinner'} color={color} />;
|
|
@@ -79,7 +82,7 @@ const InputDropDown = ({
|
|
|
79
82
|
<TextInput
|
|
80
83
|
{...props}
|
|
81
84
|
onPressIn={onPress}
|
|
82
|
-
accessibilityLabel={
|
|
85
|
+
accessibilityLabel={accessibilityLabel}
|
|
83
86
|
editable={false}
|
|
84
87
|
textAlignVertical="top"
|
|
85
88
|
style={[
|
|
@@ -105,8 +108,8 @@ const InputDropDown = ({
|
|
|
105
108
|
return (
|
|
106
109
|
<TouchableOpacity
|
|
107
110
|
onPress={onPress}
|
|
108
|
-
style={full && styles.wrapper}
|
|
109
|
-
accessibilityLabel={
|
|
111
|
+
style={[style, full && styles.wrapper]}
|
|
112
|
+
accessibilityLabel={accessibilityLabel}>
|
|
110
113
|
{renderInputView()}
|
|
111
114
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
112
115
|
</TouchableOpacity>
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -29,6 +29,7 @@ const InputMoney = forwardRef(
|
|
|
29
29
|
iconColor,
|
|
30
30
|
required,
|
|
31
31
|
errorSpacing,
|
|
32
|
+
style,
|
|
32
33
|
...props
|
|
33
34
|
}: InputMoneyProps,
|
|
34
35
|
ref,
|
|
@@ -37,6 +38,8 @@ const InputMoney = forwardRef(
|
|
|
37
38
|
const [focused, setFocused] = useState(false);
|
|
38
39
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
39
40
|
const [value, setValue] = useState('');
|
|
41
|
+
const accessibilityLabel = `InputMoney/${floatingValue}`;
|
|
42
|
+
|
|
40
43
|
const onClearText = () => {
|
|
41
44
|
inputRef?.current?.clear();
|
|
42
45
|
setValue('');
|
|
@@ -91,7 +94,7 @@ const InputMoney = forwardRef(
|
|
|
91
94
|
<View style={styles.inputView}>
|
|
92
95
|
<TextInput
|
|
93
96
|
{...props}
|
|
94
|
-
accessibilityLabel={
|
|
97
|
+
accessibilityLabel={accessibilityLabel}
|
|
95
98
|
editable={!disabled}
|
|
96
99
|
textAlignVertical="top"
|
|
97
100
|
ref={inputRef}
|
|
@@ -131,8 +134,8 @@ const InputMoney = forwardRef(
|
|
|
131
134
|
|
|
132
135
|
return (
|
|
133
136
|
<View
|
|
134
|
-
style={styles.wrapper}
|
|
135
|
-
accessibilityLabel={
|
|
137
|
+
style={[style, styles.wrapper]}
|
|
138
|
+
accessibilityLabel={accessibilityLabel}>
|
|
136
139
|
{renderInputView()}
|
|
137
140
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
138
141
|
</View>
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, {FC, useContext, useEffect, useRef, useState} from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
|
-
KeyboardType,
|
|
5
4
|
NativeSyntheticEvent,
|
|
6
5
|
TextInput,
|
|
7
6
|
TextInputFocusEventData,
|
|
@@ -69,6 +68,7 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
69
68
|
onFocus,
|
|
70
69
|
onBlur,
|
|
71
70
|
dataType = 'number',
|
|
71
|
+
style,
|
|
72
72
|
...props
|
|
73
73
|
}) => {
|
|
74
74
|
const MAX_LENGTH = 10;
|
|
@@ -76,6 +76,7 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
76
76
|
const [focused, setFocused] = useState(false);
|
|
77
77
|
const inputRef = useRef<TextInput>(null);
|
|
78
78
|
const {theme} = useContext(ApplicationContext);
|
|
79
|
+
const accessibilityLabel = `InputOTP/${floatingValue ?? placeholder}`;
|
|
79
80
|
|
|
80
81
|
const onFocusInput = () => {
|
|
81
82
|
setFocused(true);
|
|
@@ -157,9 +158,6 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
157
158
|
};
|
|
158
159
|
|
|
159
160
|
const renderInputView = () => {
|
|
160
|
-
let placeholderColor = theme.colors.text.hint;
|
|
161
|
-
const keyboardType: KeyboardType =
|
|
162
|
-
dataType === 'number' ? 'number-pad' : 'default';
|
|
163
161
|
return (
|
|
164
162
|
<View
|
|
165
163
|
style={[
|
|
@@ -182,16 +180,16 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
182
180
|
<View style={styles.inputView}>
|
|
183
181
|
<TextInput
|
|
184
182
|
{...props}
|
|
185
|
-
accessibilityLabel={
|
|
183
|
+
accessibilityLabel={accessibilityLabel}
|
|
186
184
|
ref={inputRef}
|
|
187
185
|
value={value}
|
|
188
186
|
onChangeText={_onChangeText}
|
|
189
|
-
keyboardType={
|
|
187
|
+
keyboardType={dataType === 'number' ? 'number-pad' : 'default'}
|
|
190
188
|
onFocus={onFocusInput}
|
|
191
189
|
onBlur={onBlurInput}
|
|
192
190
|
style={{opacity: 0}}
|
|
193
191
|
selectionColor={theme.colors.primary}
|
|
194
|
-
placeholderTextColor={
|
|
192
|
+
placeholderTextColor={theme.colors.text.hint}
|
|
195
193
|
/>
|
|
196
194
|
</View>
|
|
197
195
|
</View>
|
|
@@ -202,8 +200,8 @@ const InputOTP: FC<InputOTPProps> = ({
|
|
|
202
200
|
<TouchableOpacity
|
|
203
201
|
activeOpacity={1}
|
|
204
202
|
onPress={onFocusInput}
|
|
205
|
-
style={styles.otpWrapper}
|
|
206
|
-
accessibilityLabel={
|
|
203
|
+
style={[style, styles.otpWrapper]}
|
|
204
|
+
accessibilityLabel={accessibilityLabel}>
|
|
207
205
|
{renderInputView()}
|
|
208
206
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
209
207
|
</TouchableOpacity>
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -37,7 +37,7 @@ const InputSearch = forwardRef(
|
|
|
37
37
|
const [focused, setFocused] = useState(false);
|
|
38
38
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
39
39
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
40
|
-
|
|
40
|
+
const accessibilityLabel = `InputMoney/${placeholder}`;
|
|
41
41
|
|
|
42
42
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
43
43
|
setFocused(true);
|
|
@@ -60,19 +60,16 @@ const InputSearch = forwardRef(
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
const renderInputView = () => {
|
|
63
|
-
let textColor = theme.colors.text.default;
|
|
64
|
-
let placeholderColor = theme.colors.text.hint;
|
|
65
|
-
|
|
66
63
|
return (
|
|
67
64
|
<TextInput
|
|
68
65
|
{...props}
|
|
69
|
-
accessibilityLabel={
|
|
66
|
+
accessibilityLabel={accessibilityLabel}
|
|
70
67
|
textAlignVertical="top"
|
|
71
68
|
ref={inputRef}
|
|
72
69
|
style={[
|
|
73
70
|
styles.searchInput,
|
|
74
71
|
{
|
|
75
|
-
color:
|
|
72
|
+
color: theme.colors.text.default,
|
|
76
73
|
},
|
|
77
74
|
]}
|
|
78
75
|
value={value}
|
|
@@ -81,7 +78,7 @@ const InputSearch = forwardRef(
|
|
|
81
78
|
onBlur={_onBlur}
|
|
82
79
|
placeholder={placeholder}
|
|
83
80
|
selectionColor={theme.colors.primary}
|
|
84
|
-
placeholderTextColor={
|
|
81
|
+
placeholderTextColor={theme.colors.text.hint}
|
|
85
82
|
/>
|
|
86
83
|
);
|
|
87
84
|
};
|
|
@@ -112,7 +109,7 @@ const InputSearch = forwardRef(
|
|
|
112
109
|
]}
|
|
113
110
|
/>
|
|
114
111
|
<Icon
|
|
115
|
-
color={
|
|
112
|
+
color={iconColor}
|
|
116
113
|
source={icon}
|
|
117
114
|
style={styles.iconSearchInput}
|
|
118
115
|
/>
|
|
@@ -124,7 +121,7 @@ const InputSearch = forwardRef(
|
|
|
124
121
|
return (
|
|
125
122
|
<View
|
|
126
123
|
style={[style, styles.searchInputContainer]}
|
|
127
|
-
accessibilityLabel={
|
|
124
|
+
accessibilityLabel={accessibilityLabel}>
|
|
128
125
|
<View
|
|
129
126
|
style={[
|
|
130
127
|
styles.searchInputWrapper,
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -37,6 +37,7 @@ const InputTextArea = forwardRef(
|
|
|
37
37
|
maxLength,
|
|
38
38
|
required,
|
|
39
39
|
errorSpacing,
|
|
40
|
+
style,
|
|
40
41
|
...props
|
|
41
42
|
}: InputTextAreaProps,
|
|
42
43
|
ref,
|
|
@@ -45,6 +46,7 @@ const InputTextArea = forwardRef(
|
|
|
45
46
|
const [focused, setFocused] = useState(false);
|
|
46
47
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
47
48
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
49
|
+
const accessibilityLabel = `InputTextArea/${floatingValue ?? placeholder}`;
|
|
48
50
|
|
|
49
51
|
const onClearText = () => {
|
|
50
52
|
inputRef?.current?.clear();
|
|
@@ -106,7 +108,7 @@ const InputTextArea = forwardRef(
|
|
|
106
108
|
<View style={styles.textAreaView}>
|
|
107
109
|
<TextInput
|
|
108
110
|
{...props}
|
|
109
|
-
accessibilityLabel={
|
|
111
|
+
accessibilityLabel={accessibilityLabel}
|
|
110
112
|
ref={inputRef}
|
|
111
113
|
editable={!disabled}
|
|
112
114
|
textAlignVertical="top"
|
|
@@ -147,8 +149,8 @@ const InputTextArea = forwardRef(
|
|
|
147
149
|
|
|
148
150
|
return (
|
|
149
151
|
<View
|
|
150
|
-
style={styles.wrapper}
|
|
151
|
-
accessibilityLabel={
|
|
152
|
+
style={[style, styles.wrapper]}
|
|
153
|
+
accessibilityLabel={accessibilityLabel}>
|
|
152
154
|
{renderInputView()}
|
|
153
155
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
154
156
|
</View>
|
package/Input/common.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {View, ViewStyle} from 'react-native';
|
|
2
2
|
import styles from './styles';
|
|
3
|
-
import {Text} from '../Text';
|
|
3
|
+
import {scaleSize, Text} from '../Text';
|
|
4
4
|
import React, {FC, useContext} from 'react';
|
|
5
5
|
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {Icon} from '../Icon';
|
|
@@ -16,7 +16,7 @@ type FloatingViewProps = {
|
|
|
16
16
|
style?: ViewStyle;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const DEFAULT_HEIGHT =
|
|
19
|
+
export const DEFAULT_HEIGHT = scaleSize(104);
|
|
20
20
|
export const MAX_LENGTH = 300;
|
|
21
21
|
|
|
22
22
|
export const getBorderColor = (
|
package/Input/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import InputSearch from './InputSearch';
|
|
|
4
4
|
import InputMoney from './InputMoney';
|
|
5
5
|
import InputOTP from './InputOTP';
|
|
6
6
|
import InputDropDown from './InputDropDown';
|
|
7
|
-
import {TextInputProps} from 'react-native';
|
|
7
|
+
import {TextInputProps, ViewStyle} from 'react-native';
|
|
8
8
|
|
|
9
9
|
export interface InputProps extends TextInputProps {
|
|
10
10
|
/**
|
|
@@ -238,6 +238,8 @@ export interface InputDropDownProps {
|
|
|
238
238
|
* Optional. Represents the color of the leading icon in the InputDropDown component.
|
|
239
239
|
*/
|
|
240
240
|
leadingIconColor?: string;
|
|
241
|
+
|
|
242
|
+
style: ViewStyle | ViewStyle[];
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
export {Input, InputTextArea, InputSearch, InputMoney, InputOTP, InputDropDown};
|
package/Layout/Screen.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Animated,
|
|
3
|
+
Image,
|
|
3
4
|
KeyboardAvoidingView,
|
|
4
5
|
Platform,
|
|
5
6
|
ScrollViewProps,
|
|
@@ -11,7 +12,11 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
|
11
12
|
import React, {ReactNode, useContext, useEffect, useRef} from 'react';
|
|
12
13
|
import {Spacing, Styles} from '../Consts';
|
|
13
14
|
import {Card, Section, validateChildren} from './index';
|
|
14
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
ApplicationContext,
|
|
17
|
+
HeaderBackground,
|
|
18
|
+
HeaderTitle,
|
|
19
|
+
} from '../Application';
|
|
15
20
|
import Navigation from '../Application/Navigation';
|
|
16
21
|
|
|
17
22
|
export interface ScreenProps extends ViewProps {
|
|
@@ -25,31 +30,31 @@ export interface ScreenProps extends ViewProps {
|
|
|
25
30
|
*/
|
|
26
31
|
enableKeyboardAvoidingView?: boolean;
|
|
27
32
|
|
|
28
|
-
/**
|
|
29
|
-
* Optional. Background color of the header.
|
|
30
|
-
*/
|
|
31
|
-
headerBackground?: string;
|
|
32
|
-
|
|
33
33
|
/**
|
|
34
34
|
* Optional. If `true`, the screen content is scrollable.
|
|
35
35
|
*/
|
|
36
36
|
scrollable?: boolean;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Optional. If `true`, use an
|
|
39
|
+
* Optional. If `true`, use an extended header for the screen.
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
useExtendedHeader?: boolean;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Optional.
|
|
44
|
+
* Optional. Props for the animated component or bool used top navigation animated.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
animatedHeader?: boolean | ((props?: any) => React.ReactElement);
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Optional. Props for the underlying ScrollView component when `scrollable` is `true`.
|
|
50
50
|
*/
|
|
51
51
|
scrollViewProps?: ScrollViewProps;
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Optional. ReactNode representing the header component of the screen.
|
|
55
|
+
*/
|
|
56
|
+
headerComponent?: ReactNode;
|
|
57
|
+
|
|
53
58
|
/**
|
|
54
59
|
* Optional. ReactNode representing the footer component of the screen.
|
|
55
60
|
*/
|
|
@@ -72,86 +77,79 @@ const Screen: React.FC<ScreenProps> = ({
|
|
|
72
77
|
scrollable = false,
|
|
73
78
|
navigation,
|
|
74
79
|
marginHeader,
|
|
75
|
-
useAnimatedHeader,
|
|
76
80
|
useExtendedHeader,
|
|
77
|
-
|
|
81
|
+
animatedHeader,
|
|
78
82
|
scrollViewProps,
|
|
83
|
+
headerComponent: Header,
|
|
79
84
|
footerComponent: Footer,
|
|
80
85
|
backgroundColor,
|
|
81
86
|
}) => {
|
|
82
87
|
const animatedValue = useRef<Animated.Value | undefined>(undefined);
|
|
83
88
|
const {theme} = useContext(ApplicationContext);
|
|
84
89
|
const insets = useSafeAreaInsets();
|
|
85
|
-
const headerTransparent = useAnimatedHeader || useExtendedHeader;
|
|
86
90
|
|
|
87
91
|
let handleScroll;
|
|
88
|
-
let
|
|
89
|
-
let opacity;
|
|
92
|
+
let headerBackground: string | undefined = undefined;
|
|
90
93
|
let Component: any = View;
|
|
91
94
|
animatedValue.current = undefined;
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
* automatic margin content if use header transparent
|
|
95
|
-
*/
|
|
96
|
-
if (headerTransparent) {
|
|
97
|
-
animatedValue.current = new Animated.Value(0);
|
|
96
|
+
if (useExtendedHeader || animatedHeader) {
|
|
98
97
|
marginHeader = marginHeader ?? useHeaderHeight();
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (useExtendedHeader) {
|
|
101
|
+
headerBackground = theme.assets?.headerBackground;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
useEffect(() => {
|
|
105
|
-
if (
|
|
106
|
-
let title = {};
|
|
107
|
-
if (useExtendedHeader) {
|
|
108
|
-
title = {headerTitle: HeaderTitle};
|
|
109
|
-
}
|
|
105
|
+
if (useExtendedHeader) {
|
|
110
106
|
navigation?.setOptions({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
...title,
|
|
107
|
+
headerTransparent: true,
|
|
108
|
+
headerBackground: () => null,
|
|
114
109
|
});
|
|
115
110
|
}
|
|
116
|
-
}, [useExtendedHeader
|
|
111
|
+
}, [useExtendedHeader]);
|
|
117
112
|
|
|
118
|
-
/**
|
|
119
|
-
* animated for header stack when used bottom tab
|
|
120
|
-
*/
|
|
121
113
|
useEffect(() => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
114
|
+
if (animatedHeader) {
|
|
115
|
+
navigation?.setOptions({
|
|
116
|
+
headerTransparent: true,
|
|
117
|
+
headerBackground: (props: any) => (
|
|
118
|
+
<HeaderBackground {...props} animatedValue={animatedValue.current} />
|
|
119
|
+
),
|
|
120
|
+
headerTitle: (props: any) => (
|
|
121
|
+
<HeaderTitle {...props} animatedValue={animatedValue.current} />
|
|
122
|
+
),
|
|
129
123
|
});
|
|
124
|
+
const current: any = navigation;
|
|
125
|
+
const parent = current?.getParent?.();
|
|
126
|
+
if (parent) {
|
|
127
|
+
return current?.addListener?.('focus', () => {
|
|
128
|
+
const stackNavigation = new Navigation(parent, theme);
|
|
129
|
+
stackNavigation?.setOptions({
|
|
130
|
+
headerTransparent: true,
|
|
131
|
+
headerBackground: (props: any) => (
|
|
132
|
+
<HeaderBackground
|
|
133
|
+
{...props}
|
|
134
|
+
animatedValue={animatedValue.current}
|
|
135
|
+
/>
|
|
136
|
+
),
|
|
137
|
+
headerTitle: (props: any) => (
|
|
138
|
+
<HeaderTitle {...props} animatedValue={animatedValue.current} />
|
|
139
|
+
),
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
130
143
|
}
|
|
131
|
-
}, [
|
|
144
|
+
}, [animatedHeader]);
|
|
132
145
|
|
|
133
146
|
/**
|
|
134
147
|
* animated when use scroll && animated value
|
|
135
148
|
*/
|
|
136
149
|
if (scrollable) {
|
|
137
150
|
Component = Animated.ScrollView;
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
inputRange: [0, 100],
|
|
141
|
-
outputRange: [1, 0],
|
|
142
|
-
extrapolate: 'clamp',
|
|
143
|
-
});
|
|
144
|
-
imageAnimatedStyle = {
|
|
145
|
-
transform: [
|
|
146
|
-
{
|
|
147
|
-
scale: animatedValue.current?.interpolate?.({
|
|
148
|
-
inputRange: [-300, 0, 1],
|
|
149
|
-
outputRange: [1.75, 1, 1],
|
|
150
|
-
extrapolate: 'clamp',
|
|
151
|
-
}),
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
};
|
|
151
|
+
if (animatedHeader) {
|
|
152
|
+
animatedValue.current = new Animated.Value(0);
|
|
155
153
|
handleScroll = Animated.event(
|
|
156
154
|
[
|
|
157
155
|
{
|
|
@@ -165,6 +163,27 @@ const Screen: React.FC<ScreenProps> = ({
|
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
165
|
|
|
166
|
+
/**
|
|
167
|
+
* render top navigation banner
|
|
168
|
+
*/
|
|
169
|
+
const renderHeader = () => {
|
|
170
|
+
if (headerBackground != undefined) {
|
|
171
|
+
return (
|
|
172
|
+
<Image
|
|
173
|
+
source={{
|
|
174
|
+
uri: headerBackground,
|
|
175
|
+
}}
|
|
176
|
+
style={{
|
|
177
|
+
aspectRatio: 1.75,
|
|
178
|
+
}}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
if (typeof animatedHeader === 'function') {
|
|
183
|
+
return animatedHeader({animatedValue: animatedValue.current});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
168
187
|
/**
|
|
169
188
|
* build content for screen
|
|
170
189
|
*/
|
|
@@ -207,35 +226,24 @@ const Screen: React.FC<ScreenProps> = ({
|
|
|
207
226
|
<View
|
|
208
227
|
style={{
|
|
209
228
|
position: 'absolute',
|
|
210
|
-
maxHeight: 215,
|
|
211
229
|
width: '100%',
|
|
212
|
-
|
|
230
|
+
maxHeight: 215,
|
|
213
231
|
}}>
|
|
214
|
-
{
|
|
215
|
-
<Animated.Image
|
|
216
|
-
source={{
|
|
217
|
-
uri: headerBackground,
|
|
218
|
-
}}
|
|
219
|
-
style={{
|
|
220
|
-
opacity: opacity ?? 1,
|
|
221
|
-
aspectRatio: 1.75,
|
|
222
|
-
...imageAnimatedStyle,
|
|
223
|
-
}}
|
|
224
|
-
/>
|
|
225
|
-
)}
|
|
232
|
+
{renderHeader()}
|
|
226
233
|
</View>
|
|
227
234
|
<KeyboardAvoidingView
|
|
228
|
-
style={Styles.flex}
|
|
235
|
+
style={[Styles.flex, {paddingTop: marginHeader}]}
|
|
229
236
|
enabled={enableKeyboardAvoidingView}
|
|
230
237
|
behavior={Platform.select({
|
|
231
238
|
ios: 'padding',
|
|
232
239
|
android: undefined,
|
|
233
240
|
})}>
|
|
241
|
+
{Header}
|
|
234
242
|
<Component
|
|
235
243
|
{...scrollViewProps}
|
|
236
244
|
showsVerticalScrollIndicator={false}
|
|
237
245
|
onScroll={handleScroll}
|
|
238
|
-
style={
|
|
246
|
+
style={Styles.flex}>
|
|
239
247
|
{renderContent()}
|
|
240
248
|
</Component>
|
|
241
249
|
{Footer && (
|
|
@@ -9,6 +9,7 @@ import {ApplicationContext} from '../Application';
|
|
|
9
9
|
const PaginationDot: FC<ChildPaginationProps> = ({
|
|
10
10
|
dataLength = 2,
|
|
11
11
|
activeIndex = 0,
|
|
12
|
+
style,
|
|
12
13
|
}) => {
|
|
13
14
|
const {theme} = useContext(ApplicationContext);
|
|
14
15
|
const renderDots = () => {
|
|
@@ -27,7 +28,11 @@ const PaginationDot: FC<ChildPaginationProps> = ({
|
|
|
27
28
|
}
|
|
28
29
|
return dots;
|
|
29
30
|
};
|
|
30
|
-
return
|
|
31
|
+
return (
|
|
32
|
+
<View style={[style, styles.row]}>
|
|
33
|
+
<View style={styles.paginationPinkContainer}>{renderDots()}</View>
|
|
34
|
+
</View>
|
|
35
|
+
);
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
export default PaginationDot;
|
|
@@ -8,12 +8,15 @@ import {Colors} from '../Consts';
|
|
|
8
8
|
const PaginationNumber: FC<ChildPaginationProps> = ({
|
|
9
9
|
activeIndex = 0,
|
|
10
10
|
dataLength = 2,
|
|
11
|
+
style,
|
|
11
12
|
}) => {
|
|
12
13
|
return (
|
|
13
|
-
<View style={[styles.
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
<View style={[style, styles.row]}>
|
|
15
|
+
<View style={styles.paginationNumberContainer}>
|
|
16
|
+
<Text color={Colors.black_01} typography={'label_default'}>{`${
|
|
17
|
+
activeIndex + 1
|
|
18
|
+
}/${dataLength}`}</Text>
|
|
19
|
+
</View>
|
|
17
20
|
</View>
|
|
18
21
|
);
|
|
19
22
|
};
|
|
@@ -8,6 +8,7 @@ import {Colors, Spacing} from '../Consts';
|
|
|
8
8
|
const PaginationWhiteDot: FC<ChildPaginationProps> = ({
|
|
9
9
|
dataLength = 2,
|
|
10
10
|
activeIndex = 0,
|
|
11
|
+
style,
|
|
11
12
|
}) => {
|
|
12
13
|
const renderDots = () => {
|
|
13
14
|
const dots: React.ReactElement[] = [];
|
|
@@ -24,7 +25,11 @@ const PaginationWhiteDot: FC<ChildPaginationProps> = ({
|
|
|
24
25
|
}
|
|
25
26
|
return dots;
|
|
26
27
|
};
|
|
27
|
-
return
|
|
28
|
+
return (
|
|
29
|
+
<View style={[style, styles.row]}>
|
|
30
|
+
<View style={styles.paginationWhiteContainer}>{renderDots()}</View>
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
28
33
|
};
|
|
29
34
|
|
|
30
35
|
export default PaginationWhiteDot;
|
package/Pagination/styles.ts
CHANGED
|
@@ -25,6 +25,8 @@ export default StyleSheet.create({
|
|
|
25
25
|
paddingHorizontal: Spacing.S,
|
|
26
26
|
borderRadius: Radius.L,
|
|
27
27
|
backgroundColor: Colors.black_20 + '33',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
28
30
|
},
|
|
29
31
|
scrollContainer: {
|
|
30
32
|
alignItems: 'center',
|
|
@@ -44,4 +46,5 @@ export default StyleSheet.create({
|
|
|
44
46
|
height: 4,
|
|
45
47
|
borderRadius: Radius.XS,
|
|
46
48
|
},
|
|
49
|
+
row: {flexDirection: 'row'},
|
|
47
50
|
});
|
package/Pagination/types.ts
CHANGED
package/Radio/types.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type RadioProps = {
|
|
|
5
5
|
* `value`: Represents the value associated with the Radio component.
|
|
6
6
|
* It is used to determine whether the Radio component is selected or not in comparison with the `groupValue`.
|
|
7
7
|
*/
|
|
8
|
-
value:
|
|
8
|
+
value: any;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* `disabled`: Optional. If `true`, the user won't be able to interact with the Radio component.
|
|
@@ -28,7 +28,7 @@ export type RadioProps = {
|
|
|
28
28
|
* `groupValue`: Represents the value of the selected Radio component within a group of Radio components.
|
|
29
29
|
* The Radio component for which `value` equals `groupValue` will be selected.
|
|
30
30
|
*/
|
|
31
|
-
groupValue:
|
|
31
|
+
groupValue: any;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* `style`: Optional. Used to apply custom styling to the Radio component.
|