如何在 React Native 中自动打开键盘? [英] How to open keyboard automatically in React Native?

查看:126
本文介绍了如何在 React Native 中自动打开键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 React Native 应用程序中有一个屏幕,其中有几个文本字段.

I have a screen in my React Native application in which I have few text fields.

我想知道是否有任何方法可以在屏幕加载时自动打开我的关键字并专注于我的第一个文本输入字段?

I was wondering if there is any way in which on screen load my keyword opens automatically and focuses on my first text input field?

我在 android 中搜索类似 stateAlwaysVisible 的东西.

I was searching for something like stateAlwaysVisible in android.

推荐答案

获得焦点时,键盘应该自动打开.您可以使用 autoFocus 道具使其在元素挂载时聚焦(链接)

The keyboard should open automatically when a <TextField /> is focused. You can use the autoFocus prop to make it focus when the element mounts (link)

这篇关于如何在 React Native 中自动打开键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆