Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ANDROID] - Error while updating property 'autoComplete' #39

Closed
CarmineRumma opened this issue Mar 11, 2024 · 2 comments 路 Fixed by #40
Closed

[ANDROID] - Error while updating property 'autoComplete' #39

CarmineRumma opened this issue Mar 11, 2024 · 2 comments 路 Fixed by #40

Comments

@CarmineRumma
Copy link
Contributor

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch react-native-otp-entry@1.4.1 for the project I'm working on.

Environment: ANDROID
Error message: Error while updating property 'autoComplete'

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-otp-entry/dist/src/OtpInput/OtpInput.js b/node_modules/react-native-otp-entry/dist/src/OtpInput/OtpInput.js
index 4c8bc37..4933e4f 100644
--- a/node_modules/react-native-otp-entry/dist/src/OtpInput/OtpInput.js
+++ b/node_modules/react-native-otp-entry/dist/src/OtpInput/OtpInput.js
@@ -35,6 +35,8 @@ exports.OtpInput = (0, react_1.forwardRef)((props, ref) => {
               </react_native_1.Pressable>);
         })}
       </react_native_1.View>
-      <react_native_1.TextInput value={text} onChangeText={handleTextChange} maxLength={numberOfDigits} inputMode="numeric" textContentType="oneTimeCode" ref={inputRef} autoFocus={autoFocus} style={OtpInput_styles_1.styles.hiddenInput} secureTextEntry={secureTextEntry} autoComplete="one-time-code" testID="otp-input-hidden"/>
+      <react_native_1.TextInput value={text} onChangeText={handleTextChange} maxLength={numberOfDigits} inputMode="numeric" textContentType="oneTimeCode" ref={inputRef} autoFocus={autoFocus} style={OtpInput_styles_1.styles.hiddenInput} secureTextEntry={secureTextEntry} 
+    // @ts-ignore
+    autoComplete={react_native_1.Platform.OS === 'ios' ? "one-time-code" : "sms-otp"} testID="otp-input-hidden"/>
     </react_native_1.View>);
 });
diff --git a/node_modules/react-native-otp-entry/src/OtpInput/OtpInput.tsx b/node_modules/react-native-otp-entry/src/OtpInput/OtpInput.tsx
index 0a07e92..7d3ea19 100644
--- a/node_modules/react-native-otp-entry/src/OtpInput/OtpInput.tsx
+++ b/node_modules/react-native-otp-entry/src/OtpInput/OtpInput.tsx
@@ -1,5 +1,5 @@
 import { forwardRef, useImperativeHandle } from "react";
-import { Pressable, Text, TextInput, View } from "react-native";
+import { Platform, Pressable, Text, TextInput, View } from "react-native";
 import { styles } from "./OtpInput.styles";
 import { OtpInputProps, OtpInputRef } from "./OtpInput.types";
 import { VerticalStick } from "./VerticalStick";
@@ -83,7 +83,8 @@ export const OtpInput = forwardRef<OtpInputRef, OtpInputProps>((props, ref) => {
         autoFocus={autoFocus}
         style={styles.hiddenInput}
         secureTextEntry={secureTextEntry}
-        autoComplete="one-time-code"
+        // @ts-ignore
+        autoComplete={Platform.OS === 'ios' ? "one-time-code" : "sms-otp"}
         testID="otp-input-hidden"
       />
     </View>
@iyyanarCommuniti
Copy link

iyyanarCommuniti commented Mar 12, 2024

In the ios how can I auto fill the code using this npm? @anday013

@anday013
Copy link
Owner

@iyyanarCommuniti it gets it out of the box

IMG_4204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants