react-native 0.55.4版本,发现TextInput 在iOS平台上无法输入中文的问题。

1. github上相关资料

import React, {Component} from 'react';
import {Platform, TextInput} from 'react-native'; class MyTextInput extends Component {
shouldComponentUpdate(nextProps){
return Platform.OS !== 'ios' || this.props.value === nextProps.value;
}
render() {
return <TextInput {...this.props} />;
}
};
export default MyTextInput;

代码加入到项目中后,试运行了下发现果然是可以的,以为至此不能输入中文的bug,应该是破掉了。

2.需要满足defultValue和value属性

项目中由于很多都地方使用了defultValue和value属性,所以在详细的测试中发现,以上封装只能满足于value属性的情况下没问题的,那么还需要满足defultValue属性了。

以下为封装后的代码:

import React, {Component} from 'react';
import {Platform, TextInput} from 'react-native'; class MyTextInput extends Component {
shouldComponentUpdate(nextProps) {
const { value, defaultValue } = this.props;
return Platform.OS !== 'ios'
|| (value === nextProps.value && !nextProps.defaultValue)
|| (defaultValue === nextProps.defaultValue && !nextProps.value);
} render() {
return <TextInput {...this.props} />;
}
}; export default MyTextInput;

另: native-base中Input,Textarea等组件在ios平台下不能输入中文

最新文章

  1. 《LoadRunner12七天速成宝典》签售会2016-12-17北京
  2. 【翻译svg教程 】svg 的坐标系统
  3. ACM/ICPC 之 最短路-Floyd+SPFA(BFS)+DP(ZOJ1232)
  4. EBS R12.2 创建应用层的启动和关闭脚本
  5. input两种默认显示文字方式
  6. 商务通简单弹窗样式 V1.0
  7. 转: Firefox 浏览器对 TABLE 中绝对定位元素包含块的判定有错误
  8. Node.js 博客实例(五)编辑与删除功能
  9. 重点+超详细:ajax和json及案例
  10. [数据挖掘] - 聚类算法:K-means算法理解及SparkCore实现
  11. Tomcat+Eclipse乱码问题解决方法
  12. npm 常用命令详解
  13. [Java第一课]环境变量的配置以及eclipse一些常用快捷键
  14. 一、Java 23 种设计模式简介
  15. 团队项目-课程MS需求分析心得
  16. React文档(二十二)context
  17. double 四舍五入保留一定的位数
  18. HTML5结构标签
  19. NOI-1.3-11-计算浮点数相除的余数
  20. git 修改已提交的注释

热门文章

  1. linux shell中使用sed命令
  2. cnblogs侧边栏访客统计 小插件
  3. PHP程序员-常用工具
  4. nyoj 73-比大小 (Java, 高精度)
  5. ubuntu18+uwsgi+nginx部署django项目
  6. supervisor服务
  7. MySQL 1364 错误提示:#1364 - Field &quot;details&quot; doesn&#39;t have a default value
  8. Redis的内存淘汰策略
  9. vim编辑中断后,重新编辑的警告删除
  10. nginx配置路径问题