@momo-kits/foundation 0.115.2-beta.11 → 0.115.2-beta.13

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/index.tsx CHANGED
@@ -1,37 +1,21 @@
1
1
  import React, {useContext} from 'react';
2
- import {View, ViewStyle} from 'react-native';
2
+ import {View} from 'react-native';
3
3
  import {ApplicationContext} from '../Application';
4
4
  import {Spacing} from '../Consts';
5
- import {DashDivider} from './DashDivider';
6
5
 
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}) => {
6
+ const Divider = () => {
20
7
  const {theme} = useContext(ApplicationContext);
21
8
 
22
9
  return (
23
10
  <View
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
- ]}
11
+ style={{
12
+ height: 1,
13
+ width: '100%',
14
+ backgroundColor: theme.colors.border.default,
15
+ marginVertical: Spacing.XS,
16
+ }}
33
17
  />
34
18
  );
35
19
  };
36
20
 
37
- export {Divider, DashDivider};
21
+ export {Divider};
@@ -12,6 +12,7 @@ import {
12
12
  NativeSyntheticEvent,
13
13
  TextInput,
14
14
  TextInputFocusEventData,
15
+ TouchableOpacity,
15
16
  View,
16
17
  } from 'react-native';
17
18
  import {
@@ -24,6 +25,7 @@ import {scaleSize, Text} from '../Text';
24
25
  import {ErrorView, getBorderColor} from './common';
25
26
  import {CaretProps, InputOTPProps} from './index';
26
27
  import styles from './styles';
28
+ import {Icon} from "../Icon";
27
29
 
28
30
  const OTPCaret: FC<CaretProps> = ({index, length}) => {
29
31
  const DURATION = 300;
@@ -132,6 +134,10 @@ const InputOTP = forwardRef(
132
134
  onChangeText?.(text);
133
135
  };
134
136
 
137
+ const onClearText = () => {
138
+ _onChangeText('');
139
+ };
140
+
135
141
  const renderInputs = (inputLength: number) => {
136
142
  const TextInputs: React.ReactNode[] = [];
137
143
  for (let i = 0; i < inputLength; i++) {
@@ -215,6 +221,11 @@ const InputOTP = forwardRef(
215
221
  </Text>
216
222
  </View>
217
223
  )}
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
+ )}
218
229
  <View style={styles.otpInputsView}>
219
230
  {length ? renderInputs(length) : renderUnidentifiedInputs()}
220
231
  </View>
package/Input/styles.ts CHANGED
@@ -150,8 +150,14 @@ export default StyleSheet.create({
150
150
  otpInput: {
151
151
  height: 56,
152
152
  borderRadius: Radius.S,
153
+ justifyContent: 'center',
153
154
  borderWidth: 1,
154
155
  },
156
+ clearIcon: {
157
+ position: 'absolute',
158
+ right: Spacing.M,
159
+ zIndex: 4,
160
+ },
155
161
  otpFloatingView: {
156
162
  position: 'absolute',
157
163
  top: -Spacing.M + 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.115.2-beta.11",
3
+ "version": "0.115.2-beta.13",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -1,45 +0,0 @@
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};