Skip to content

Commit

Permalink
fixes android issue
Browse files Browse the repository at this point in the history
  • Loading branch information
CrisTofani committed Dec 5, 2023
1 parent 54b9a32 commit 440757f
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/components/otpInput/OTPInput.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import * as React from "react";
import { useEffect, useState } from "react";
import {
AccessibilityInfo,
Pressable,
TextInput,
findNodeHandle
} from "react-native";
import { Pressable, TextInput } from "react-native";
import Animated from "react-native-reanimated";
import { IOStyles } from "../../core/IOStyles";
import { LabelSmall } from "../typography";
Expand Down Expand Up @@ -88,10 +83,6 @@ export const OTPInput = ({
<Pressable
onPress={() => {
inputRef.current?.focus();
const reactElem = findNodeHandle(inputRef.current);
if (reactElem) {
AccessibilityInfo.setAccessibilityFocus(reactElem);
}
setHasFocus(true);
}}
style={[IOStyles.row, { justifyContent: "space-around" }]}
Expand All @@ -102,10 +93,15 @@ export const OTPInput = ({
<TextInput
value={inputValue}
onChangeText={handleChange}
style={{ display: "none" }}
style={{ position: "absolute", opacity: 0 }}
maxLength={length}
ref={inputRef}
keyboardType="number-pad"
autoComplete={autocomplete ? "sms-otp" : "off"}
onBlur={() => setHasFocus(false)}
keyboardType="numeric"
inputMode="numeric"
returnKeyType="done"
textContentType="oneTimeCode"
autoComplete={autocomplete ? "sms-otp" : undefined}
accessible={true}
/>
{[...Array(length)].map((_, i) => (
Expand Down

0 comments on commit 440757f

Please sign in to comment.