Android TV: Keyboard automatically open when pressing numeric key in specific conditions
See original GitHub issueDescription
Keyboard automatically open when pressing numeric key (KEYCODE_1, … ) after removing an InputText from the View on AndroidTV (not tested on ios, but not sure it makes sens as there is no key number on apple TV)
React Native version:
0.66.3-3
Steps To Reproduce
Run following sample. This is just a dummy InputText which is removed from main View onSubmit. Once you end typing text, the view disappear. At that point, if you press numerical key on remote control, the keyboard is automatically opened.
As a complementary test, if you initialize show state to false and input numerical Keycode, the issue is not reproduced.
Reproduced on multiple Androidtv devices and on emulator. Keycode can be simulate with following adb command: ‘adb shell input keyevent KEYCODE_1’
Expected Results
The keyboard should not show at that point.
code example:
Sample project : https://github.com/freeboub/React-Native-tvos-demo/tree/sample_keyboard_issue
code sample code:
` import React, {useRef} from ‘react’; import {View, TextInput, LogBox} from ‘react-native’;
const TVEventHandlerView = () => { const [show, setShow] = React.useState(true);
const firstRef = useRef();
return ( <> {show && ( <> <TextInput ref={firstRef} defaultValue={‘hello’} showSoftInputOnFocus={true} autoFocus={true} editable={true} onChangeText={() => { console.log(‘onTextChange’); }} onSubmitEditing={() => { console.log(‘onSubmitEditing’); setShow(false); }} placeholder={‘Search…’} /> </> )} </> ); };
export default function App() { return ( <View style={{flex: 1}}> <TVEventHandlerView /> </View> ); } ` Additionnal interesting informations:
- If I add a TouchableWithoutFeedback after the InputText the issue is not reproduce (I think focus correctly moves to the TouchableWithoutFeedback)
- If I launch google voice assistant the incorrect behavior disappear.
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top GitHub Comments
Thanks for the detailed information and repro, and for creating the new issue for the core repo. I’ll see what the RN core Android developers think about what the issue really is, before picking this up.
Here are some addtionnal informations: