@momo-kits/foundation 0.115.2-beta.13 → 0.115.3-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Divider/DashDivider.tsx +45 -0
- package/Divider/index.tsx +25 -9
- package/Input/InputOTP.tsx +0 -11
- package/Input/styles.ts +0 -6
- package/package.json +3 -2
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import {View, ViewStyle} from 'react-native';
|
|
3
|
+
import {ApplicationContext} from '../Application';
|
|
4
|
+
import {Spacing} from '../Consts';
|
|
5
|
+
import Svg, {Line} from 'react-native-svg';
|
|
6
|
+
|
|
7
|
+
export interface DashDividerProps {
|
|
8
|
+
/**
|
|
9
|
+
* Custom styles for dash divider
|
|
10
|
+
*/
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const DashDivider: React.FC<DashDividerProps> = ({style}) => {
|
|
15
|
+
const {theme} = useContext(ApplicationContext);
|
|
16
|
+
const borderColor = theme.colors.border.default;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
style={[
|
|
21
|
+
{
|
|
22
|
+
width: '100%',
|
|
23
|
+
height: 1,
|
|
24
|
+
marginVertical: Spacing.XS,
|
|
25
|
+
},
|
|
26
|
+
style,
|
|
27
|
+
]}>
|
|
28
|
+
<Svg height="1" width="100%">
|
|
29
|
+
<Line
|
|
30
|
+
x1="0"
|
|
31
|
+
y1="0"
|
|
32
|
+
x2="100%"
|
|
33
|
+
y2="0"
|
|
34
|
+
stroke={borderColor}
|
|
35
|
+
strokeWidth="1"
|
|
36
|
+
strokeDasharray={`4, 4`}
|
|
37
|
+
strokeLinecap={'round'}
|
|
38
|
+
strokeLinejoin={'miter'}
|
|
39
|
+
/>
|
|
40
|
+
</Svg>
|
|
41
|
+
</View>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export {DashDivider};
|
package/Divider/index.tsx
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
2
|
+
import {View, ViewStyle} from 'react-native';
|
|
3
3
|
import {ApplicationContext} from '../Application';
|
|
4
4
|
import {Spacing} from '../Consts';
|
|
5
|
+
import {DashDivider} from './DashDivider';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
export interface DividerProps {
|
|
8
|
+
/**
|
|
9
|
+
* Custom styles for divider
|
|
10
|
+
*/
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Enable margin vertical 4px
|
|
15
|
+
*/
|
|
16
|
+
useMargin?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Divider: React.FC<DividerProps> = ({style, useMargin = true}) => {
|
|
7
20
|
const {theme} = useContext(ApplicationContext);
|
|
8
21
|
|
|
9
22
|
return (
|
|
10
23
|
<View
|
|
11
|
-
style={
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
style={[
|
|
25
|
+
style,
|
|
26
|
+
{
|
|
27
|
+
height: 1,
|
|
28
|
+
width: '100%',
|
|
29
|
+
backgroundColor: theme.colors.border.default,
|
|
30
|
+
marginVertical: useMargin ? Spacing.XS : 0,
|
|
31
|
+
},
|
|
32
|
+
]}
|
|
17
33
|
/>
|
|
18
34
|
);
|
|
19
35
|
};
|
|
20
36
|
|
|
21
|
-
export {Divider};
|
|
37
|
+
export {Divider, DashDivider};
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
NativeSyntheticEvent,
|
|
13
13
|
TextInput,
|
|
14
14
|
TextInputFocusEventData,
|
|
15
|
-
TouchableOpacity,
|
|
16
15
|
View,
|
|
17
16
|
} from 'react-native';
|
|
18
17
|
import {
|
|
@@ -25,7 +24,6 @@ import {scaleSize, Text} from '../Text';
|
|
|
25
24
|
import {ErrorView, getBorderColor} from './common';
|
|
26
25
|
import {CaretProps, InputOTPProps} from './index';
|
|
27
26
|
import styles from './styles';
|
|
28
|
-
import {Icon} from "../Icon";
|
|
29
27
|
|
|
30
28
|
const OTPCaret: FC<CaretProps> = ({index, length}) => {
|
|
31
29
|
const DURATION = 300;
|
|
@@ -134,10 +132,6 @@ const InputOTP = forwardRef(
|
|
|
134
132
|
onChangeText?.(text);
|
|
135
133
|
};
|
|
136
134
|
|
|
137
|
-
const onClearText = () => {
|
|
138
|
-
_onChangeText('');
|
|
139
|
-
};
|
|
140
|
-
|
|
141
135
|
const renderInputs = (inputLength: number) => {
|
|
142
136
|
const TextInputs: React.ReactNode[] = [];
|
|
143
137
|
for (let i = 0; i < inputLength; i++) {
|
|
@@ -221,11 +215,6 @@ const InputOTP = forwardRef(
|
|
|
221
215
|
</Text>
|
|
222
216
|
</View>
|
|
223
217
|
)}
|
|
224
|
-
{value.length > 0 && focused && (
|
|
225
|
-
<TouchableOpacity onPress={onClearText} style={styles.clearIcon}>
|
|
226
|
-
<Icon source={'24_navigation_close_circle_full'} size={12} />
|
|
227
|
-
</TouchableOpacity>
|
|
228
|
-
)}
|
|
229
218
|
<View style={styles.otpInputsView}>
|
|
230
219
|
{length ? renderInputs(length) : renderUnidentifiedInputs()}
|
|
231
220
|
</View>
|
package/Input/styles.ts
CHANGED
|
@@ -150,14 +150,8 @@ export default StyleSheet.create({
|
|
|
150
150
|
otpInput: {
|
|
151
151
|
height: 56,
|
|
152
152
|
borderRadius: Radius.S,
|
|
153
|
-
justifyContent: 'center',
|
|
154
153
|
borderWidth: 1,
|
|
155
154
|
},
|
|
156
|
-
clearIcon: {
|
|
157
|
-
position: 'absolute',
|
|
158
|
-
right: Spacing.M,
|
|
159
|
-
zIndex: 4,
|
|
160
|
-
},
|
|
161
155
|
otpFloatingView: {
|
|
162
156
|
position: 'absolute',
|
|
163
157
|
top: -Spacing.M + 2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.115.
|
|
3
|
+
"version": "0.115.3-beta.2",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"@react-navigation/routers": "5.7.4",
|
|
21
21
|
"react-native-reanimated": "git+https://gitlab.mservice.com.vn/momo-platform/react-native-reanimated.git#v1.13.4_gradle_7",
|
|
22
22
|
"lottie-react-native": "git+https://gitlab.mservice.com.vn/momo-platform/momo-lottie-react-native.git",
|
|
23
|
-
"@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
|
|
23
|
+
"@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git",
|
|
24
|
+
"react-native-svg": "git+https://gitlab.mservice.com.vn/momo-platform/react-native-svg.git#v12.1.0.public_fix_not_found_bounds_ios"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"react-native": "*"
|