dhre-ui-kit 0.0.203 → 0.0.204
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.js +21 -0
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +20 -0
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { TextInput as TextInput$1 } from 'react-native-paper';
|
|
|
12
12
|
import { Dropdown } from 'react-native-element-dropdown';
|
|
13
13
|
import DocumentPicker from 'react-native-document-picker';
|
|
14
14
|
import RNFS from 'react-native-fs';
|
|
15
|
+
import OTPVerify, { removeListener, startOtpListener } from 'react-native-otp-verify';
|
|
15
16
|
import Clipboard from '@react-native-clipboard/clipboard';
|
|
16
17
|
|
|
17
18
|
var ShapeType = /* @__PURE__ */ ((ShapeType2) => {
|
|
@@ -3899,6 +3900,25 @@ const OTPInput = React.forwardRef(
|
|
|
3899
3900
|
setIsResendOtpEnable(true);
|
|
3900
3901
|
}, 5e3);
|
|
3901
3902
|
};
|
|
3903
|
+
useEffect(() => {
|
|
3904
|
+
if (Platform.OS === "android") {
|
|
3905
|
+
onStartListeningOtp();
|
|
3906
|
+
}
|
|
3907
|
+
return () => {
|
|
3908
|
+
if (Platform.OS === "android") {
|
|
3909
|
+
OTPVerify.removeListener();
|
|
3910
|
+
removeListener();
|
|
3911
|
+
}
|
|
3912
|
+
};
|
|
3913
|
+
}, []);
|
|
3914
|
+
const onStartListeningOtp = async () => {
|
|
3915
|
+
await OTPVerify.getOtp();
|
|
3916
|
+
startOtpListener((message) => {
|
|
3917
|
+
const otpRegex = new RegExp(`(\\d{${length}})`, "g");
|
|
3918
|
+
const otp2 = otpRegex.exec(message)?.[1];
|
|
3919
|
+
setOTP(otp2 ?? "");
|
|
3920
|
+
});
|
|
3921
|
+
};
|
|
3902
3922
|
React.useImperativeHandle(ref, () => ({
|
|
3903
3923
|
reset() {
|
|
3904
3924
|
setOTP("");
|