【问题标题】:How to show Next button in Android keyboard in React Native如何在 React Native 中的 Android 键盘中显示 Next 按钮
【发布时间】:2019-01-02 11:59:47
【问题描述】:

当有多个 TextInput 字段时,我需要在 React Native 应用程序的键盘中显示 Next 按钮。 任何人都可以建议,我已经尝试使用 returnKeyType = {"next"} 、 blurOnSubmit 和 onSubmitEditing 道具,但没有用。

请问有人可以提供解决方案吗?

提前致谢。

【问题讨论】:

  • returnKeyType 是执行此操作的正确方法,在 Android 上,您可以使用 returnKeyLabel,如上所述(此处)[facebook.github.io/react-native/docs/textinput#returnkeytype] 如果它现在显示下一个按钮,即使您正在使用正确的道具,您需要分享您的代码示例,以便我查看问题。

标签: react-native react-native-android react-native-ios


【解决方案1】:

尝试不使用 {}。 returnKeyType = "next"。这对我有用。

【讨论】:

    【解决方案2】:

    您可以按照文档中的说明尝试onSubmitEditing。当您在键盘上单击完成时,将调用此方法。在listner 中,使用focus 方法聚焦所需的textInput。

    render(){
      return(
        
        ...
        
        <TextInput
          ref={(input) => this._username = input}
          onSubmitEditing={() => this._email.focus()}
          value={this.state.text}
          blurOnSubmit={false}   // prevent keyboard flickering
        />
        
        <TextInput
          ref={(input) => this._email = input}
          onSubmitEditing={() => this._password.focus()} // or submit the form or focus next input and goes on
          value={this.state.text}
          blurOnSubmit={false}
        />   
        
        
      )
    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-14
      • 2019-06-10
      • 2020-02-05
      • 2023-04-04
      • 2020-10-23
      • 2019-10-06
      • 2019-09-08
      • 2019-06-18
      相关资源
      最近更新 更多