React native 键盘不是';文本输入自动对焦[反应本机]时显示t

React native 键盘不是';文本输入自动对焦[反应本机]时显示t,react-native,keyboard,textinput,autofocus,React Native,Keyboard,Textinput,Autofocus,我的应用程序中有一个回复按钮,当用户按下它时,它会将文本输入自动对焦更改为真。我将自动对焦值设置为默认值false,并将其保持在一种状态。我看到状态将变为true,但它不会打开键盘 这是我的文本输入: <TextInput autoFocus={this.state.textInputFocus} selectTextOnFocus={true} ref={ref => this.textInputRef = ref} multiline = {tru

我的应用程序中有一个回复按钮,当用户按下它时,它会将
文本输入自动对焦
更改为。我将自动对焦值设置为默认值false,并将其保持在一种状态。我看到状态将变为true,但它不会打开键盘

这是我的文本输入:

<TextInput
    autoFocus={this.state.textInputFocus}
    selectTextOnFocus={true}
    ref={ref => this.textInputRef = ref}
    multiline = {true}
    placeholder="Write a comment ..."
    onChangeText={(postComment) => this.setState({postComment})}
    value={this.state.postComment} />
根据文件:

:如果为true,则将输入集中在componentDidMount上。默认值为false

可以使用参照来实现相同的功能

 <TextInput
        ref={"textRef"}
        ...
      />
请参考此链接
 <TextInput
        ref={"textRef"}
        ...
      />
_openReplyBox(comment_id, commenter){
    this.refs.textRef.focus();
    this.setState({ postComment: commenter})
}