博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[React Native] Prevent the On-screen Keyboard from Covering up Text Inputs
阅读量:7124 次
发布时间:2019-06-28

本文共 1320 字,大约阅读时间需要 4 分钟。

When you bring up the on screen keyboard in a mobile app, it will cover any text input or buttons on the bottom half of the screen, which can be frustrating for users. There are a few common ways to deal with this in React Native - and this video shows the following solutions:

First, you can use the built in KeyboardAvoidingView to move components around when the keyboard comes on screen. It has the advantage to being built in to React Native already - but it can be overly complicated to get this approach to work consistently across both iOS and Android.

There is also a third party library called KeyboardAwareScrollView, which will allow your entire view to scroll, and will keep the currently selected text inputs up and out of the way of the keyboard.

 

Install:

npm i -D react-native-keyboard-aware-scroll-view

 

Use:

import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'export default class App extends Component {  render() {    return (      
App Name
Username
Password
Login
); }}

 

转载地址:http://tfael.baihongyu.com/

你可能感兴趣的文章
从“被动挖光缆”到“主动剪网线”,蚂蚁金服异地多活的微服务体系
查看>>
PhpStorm2016.3激活
查看>>
Docker4Dev #7 新瓶装老酒 – 使用 Windows Container运行ASP.NET MVC 2 + SQLExpress 应用
查看>>
使用vue.js构建一个知乎日报
查看>>
Microsoft Flow发布GA版本
查看>>
Python 赋值的一般含义是引用
查看>>
magento2 在香港用paypal
查看>>
Yii系列(1)打造虚拟开发环境及Yii的安装配置
查看>>
img/background/iconfont---谁最适合你?
查看>>
我的iOS程序生涯的起点
查看>>
程序员的工匠精神
查看>>
【underscore.js 源码解读】for ... in 存在的浏览器兼容问题你造吗
查看>>
Sass 与 Compass 实战经验总结
查看>>
微信公众号开发小记——3.接入三方登录
查看>>
个推获7亿元C轮募资,SDK接入超80亿
查看>>
如何10分钟让APP实现实时互动?
查看>>
Consul入门01 - 安装Consul
查看>>
Swift 编程思想,第一部分(补遗):牺牲小马
查看>>
css 不规整元素的宽高等比例
查看>>
let vs const
查看>>