dhre-ui-kit 0.0.324 → 0.0.326
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/lib/index.d.ts +2 -1
- package/lib/index.js +19 -16
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +19 -16
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React$1, { ReactElement, ReactNode, JSXElementConstructor } from 'react';
|
|
2
2
|
import { TextStyle, TextProps, StyleProp, ViewStyle, TextInputProps, ImageStyle, GestureResponderEvent } from 'react-native';
|
|
3
3
|
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
import { TooltipProps } from 'react-native-walkthrough-tooltip';
|
|
4
5
|
import { PdfProps } from 'react-native-pdf';
|
|
5
6
|
import { CalendarProps } from 'react-native-calendars';
|
|
6
7
|
import { CountryCode } from 'react-native-country-picker-modal';
|
|
@@ -155,7 +156,7 @@ interface CustomTextInputProps extends TextInputProps {
|
|
|
155
156
|
|
|
156
157
|
declare const CustomTextInput: React$1.FC<CustomTextInputProps>;
|
|
157
158
|
|
|
158
|
-
interface CustomTooltipProps {
|
|
159
|
+
interface CustomTooltipProps extends TooltipProps {
|
|
159
160
|
isVisible: boolean;
|
|
160
161
|
onClose: () => void;
|
|
161
162
|
content: ReactElement<string | JSXElementConstructor<string>>;
|
package/lib/index.js
CHANGED
|
@@ -4183,22 +4183,25 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4183
4183
|
}
|
|
4184
4184
|
}));
|
|
4185
4185
|
const handleChange = (index, value) => {
|
|
4186
|
-
const
|
|
4187
|
-
if (value
|
|
4188
|
-
const
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4186
|
+
const specialCharacterRegex = /[^a-zA-Z0-9 ]/;
|
|
4187
|
+
if (value === "" || value?.length > 1 || !specialCharacterRegex.test(value)) {
|
|
4188
|
+
const regex = /^\d+$/;
|
|
4189
|
+
if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
|
|
4190
|
+
const newOTP = `${otp}${value}`;
|
|
4191
|
+
setOTP(newOTP);
|
|
4192
|
+
refs.current[index + 1]?.focus();
|
|
4193
|
+
} else if (value.length === 0 && index > 0) {
|
|
4194
|
+
const newOTP = otp.slice(0, -1);
|
|
4195
|
+
setOTP(newOTP);
|
|
4196
|
+
refs.current[index - 1]?.focus();
|
|
4197
|
+
} else if (value?.length === length) {
|
|
4198
|
+
setOTP(value);
|
|
4199
|
+
refs.current[length - 1]?.focus();
|
|
4200
|
+
} else {
|
|
4201
|
+
const newOTP = otp.slice(0, -1);
|
|
4202
|
+
setOTP(newOTP);
|
|
4203
|
+
refs.current[index]?.focus();
|
|
4204
|
+
}
|
|
4202
4205
|
}
|
|
4203
4206
|
};
|
|
4204
4207
|
const handleKeyPress = (e, index) => {
|