react-native-otp-entry icon indicating copy to clipboard operation
react-native-otp-entry copied to clipboard

Focus indicator always shows last available input when in reality I can focus first input and remove/add digits there

Open makowskimichal opened this issue 7 months ago • 1 comments

Describe the bug When I unfocus from otp or turn off keyboard, and then I press first input box, the focus indicator is on the last digit, but when I press backspace it deletes digits from the start of the text. When this happens, it only allows me to delete like 2 digits, and I can't delete any more. I have to click around and press backspace in between the clicks to remove the whole input

Just now as writing the ticket, user even when already focused can press the first input, and whatever he will type will appear after the first digit.

To Reproduce Steps to reproduce the behavior:

  1. Have an OTP input with e.g. 6 digits with autofocus
  2. input e.g. 4 digits
  3. press system back button to hide keyboard and unfocus
  4. click first input box (keyboard will reappear and the focus indicator will be on the last empty input)
  5. press backspace on the keyboard to remove digits (digits from the start of the strings will be deleted, but only e.g. 2 of them)
  6. try to input some digits after doing this, they will appear in the starting inputs

Expected behavior On any input box click focus to the last empty/last in general input box

Environment (please complete the following information):

  • OS: Android
  • Library version: 1.8.4
  • React Native version: 0.75.2

makowskimichal avatar Apr 11 '25 09:04 makowskimichal

Hi @makowskimichal . I was not able to replicate the issue. Can you please attach a demo?

anday013 avatar Apr 27 '25 09:04 anday013

Seems like similar issue, I filled the otps but when i press on first otp input it starts showing green indicator

Image

mantu-bit avatar May 20 '25 08:05 mantu-bit

I see. Have you searched for ways to disable the "pointer" of TextInput?

anday013 avatar May 27 '25 10:05 anday013

I have applied this and it fixed the issue

textInputProps={{ caretHidden: true, contextMenuHidden: true }} //Remove that single green caret symbol

mantu-bit avatar Jun 17 '25 06:06 mantu-bit

@mantu-bit nice catch! But I assume caretHidden: true should be enough to resolve the problem of green caret, right?

anday013 avatar Jun 17 '25 12:06 anday013

Note: when disabling caret, you also lose the capability of contextMenu. It does not show up when the carretHidden: true on Android

anday013 avatar Jun 20 '25 19:06 anday013