question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The keyboard does not pop up when the Android Textinput autoFocus is true

See original GitHub issue

Environment

Platforms

only happen android

Versions

  • Android:
  • iOS:
  • react-native-modal:11.5.3
  • react-native:0.63.3
  • react:

Description

Reproducible Demo

Here is our modal code <Modal isVisible={edit} style={styles.modalStyle} backdropTransitionOutTiming={0} onBackdropPress={() => this.resetState()} animationIn=“fadeInUp” animationOut=“fadeOutDown” avoidKeyboard={true} > <View style={{ backgroundColor: ‘white’, width: deviceWidth, paddingVertical: 10, borderTopLeftRadius: 10, borderTopRightRadius: 10, }} > <TextInput value={content} multiline={true} autoFocus={true} placeholder={‘回复本帖:’} maxLength={140} ref={(ref) => (this.contentInput = ref)} onBlur={this.contentInputBlur} onFocus={this.contentInputFocus} underlineColorAndroid=“transparent” onChangeText={(v) => this.setState({ content: v })} style={{ height: 100, width: deviceWidth - 30, backgroundColor: ‘#F7F7FB’, textAlignVertical: ‘top’, borderRadius: 8, alignSelf: ‘center’, padding: 15, }} /> </View> </Modal>

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:14
  • Comments:14

github_iconTop GitHub Comments

16reactions
David-Nguyen17commented, May 22, 2021

It’s a solution <Modal isVisible={true} onModalShow={() => { this.inputRef.blur(); this.inputRef.focus(); } > <TextInput ref={ref => inputRef = ref} /> </Modal>

10reactions
bekazandukelicommented, Jan 28, 2021

It will work:

export default function YourComponent() {
  const inputRef = React.useRef(null);
  return (
    <Modal isVisible={true} onModalShow={() => input.current.focus()} >
      <TextInput ref={inputRef} />
    </Modal>
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

react native keyboard does not pop up when ... - Stack Overflow
useRef(); // Focuses on keyboard once screen starts React.useEffect(()=>{ // Use the textInput focus function textInputRef.current.focus(); ...
Read more >
react native keyboard does not pop up when the Android ...
Coding example for the question react native keyboard does not pop up when the Android Textinput autoFocus is true-React Native.
Read more >
TextInput - ReactXP
WARNING: autoFocus=true means that this TextInput's requestFocus() method will be // called, however calling requestFocus() might have no effect (for ...
Read more >
TextInput - React Native Archive
If true, the keyboard disables the return key when there is no text and automatically enables it when there is text. The default...
Read more >
SetFocus function in Power Apps - Microsoft Learn
Attempting to set the focus to a control that has its DisplayMode property set to Disabled has no effect. Focus will remain where...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found