博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
通过 react-native-keyboard-aware-scroll-view 解决键盘遮盖输入框的问题
阅读量:7211 次
发布时间:2019-06-29

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

1.安装

yarn add react-native-keyboard-aware-scroll-view

2.引入

import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'

3.调用

4.常用方法

(1)跳到自定输入框

_scrollToInput (reactNode: any) {  // Add a 'scroll' ref to your ScrollView  this.scroll.scrollToFocusedInput(reactNode)}
{this.scroll = ref}}>
{ // `bind` the function if you're using ES6 classes this._scrollToInput(ReactNative.findNodeHandle(event.target)) }} />

(2)监听 键盘显示或隐藏 onKeyboardWillShow 和 onKeyboardWillHide:

{ console.log('Keyboard event', frames) }}>

5.效果图

 

转载于:https://www.cnblogs.com/crazycode2/p/9582390.html

你可能感兴趣的文章
TextView跑马灯效果
查看>>
LeetCode 58 Spiral Matrix II
查看>>
iTunes 安装ipa文件到iPhone上
查看>>
PLSQL:[1]plsql中文乱码,显示问号
查看>>
解决 QtCreator 3.5(4.0)无法输入中文的问题
查看>>
iOS Dev (60) 怎样实现 UITextView 中的 placeHolder
查看>>
How to set Selenium Python WebDriver default timeout?
查看>>
mysql 关键词相关度排序方法详细示例分析
查看>>
ListView的CheckBox实现全部选中/不选中
查看>>
PHP5与MySQL数据库操作
查看>>
关于数据库的水平切分和垂直切分的一些概念(转)
查看>>
[Entity Framework]获取部分字段的查询
查看>>
iOS 怎么设置 UITabBarController 的第n个item为第一响应者?
查看>>
MySQL的索引创建、删除
查看>>
李洪强iOS开发Swift篇—02_变量和常量
查看>>
兼容iOS 10 资料整理笔记
查看>>
spring 标注 详解
查看>>
python 爬虫 scrapy1_官网教程
查看>>
Leetcode: Counting Bits
查看>>
解决“HTTP/1.1 405 Method not allowed”问题
查看>>