1

I am developing a mobile application using React Native for a smartphone with a bar-code scanner. While scanning the bar-code, the data gets to the active input, showing the keyboard. Is there a way of reading the active input into the application directly without showing the keyboard?

Keyboard.Dismiss () - does not work as it should, if the hidden keyboard, then the input will become inactive, and also when the component is drawn, it first appears and disappears immediately, which is not what I need.

My Component : <TextInput autoFocus={true} onChangeText={v => this.scan(v)} />

Vall
  • 11
  • 3
  • con you share some of your code? at least the View that input text is in it. – DNA.h Oct 03 '18 at 08:48
  • Why don't you change the field to be a simple `Text` ? – parohy Oct 03 '18 at 08:52
  • the bar-code scanner work and set the value only in input, so i need not to use the Text component. – Vall Oct 03 '18 at 14:53
  • There's possible answer to this at : https://stackoverflow.com/questions/8997225/how-to-hide-android-soft-keyboard-on-edittext – raddevus Oct 03 '18 at 14:57
  • thy for answer, but I don’t know how to add this code correctly because they decided to write such an application, but nobody knows how to install the native way, I tried to add something on my own, but nothing happened, can it be done only with the help of java and xml? – Vall Oct 03 '18 at 15:05

1 Answers1

0

Can you try with

<TextInput
    ....
    autoFocus={false}
    editable={false}
/>

to prevent the keyboard from opening.

Tuan Nguyen
  • 2,542
  • 19
  • 29
  • not working, field should change its value when scanning code, here my input this.scan(v)} />, I need just hide the keyboard while the input is active – Vall Oct 03 '18 at 14:48
  • 1
    How do you fill value to TextInput while the keyboard doesn't show – Tuan Nguyen Oct 03 '18 at 14:52
  • No way, the problem is that I can write the scanner's result only in the active field, such is its functionality, respectively, I need to focus on the field (to record significant values), but not to show the keyboard. – Vall Oct 03 '18 at 14:58
  • Can you give a video link? – Tuan Nguyen Oct 03 '18 at 15:05
  • Of course, where shall I throw it to you? I just do not know the services that would provide the ability to upload videos to the cloud and use the link to view it. – Vall Oct 03 '18 at 15:12
  • Google Drive is an idea – Tuan Nguyen Oct 03 '18 at 16:35
  • here : https://drive.google.com/drive/folders/1sRzs6i5AiDcJkAUo8jF0mEDkcfIoGPGp?usp=sharing – Vall Oct 04 '18 at 09:08