React Native 键盘遮挡TextInput问题的问题,在安卓上,FB已经处理,但是iOS上,仍未解决;
之前开发纯iOS代码的时候,用了一个解决textfiled被键盘遮挡的第三方,IQKeyboardManager,
于是乎把它引进了项目中,瞧一瞧效果,结果完美解决键盘遮挡的问题;
估计以后FB解决iOS键盘遮挡问题,也会是和IQKeyboardManager原理一样;
IQKeyboardManager地址:https://github.com/hackiftekhar/IQKeyboardManager
ps:建议cocoaPods安装,这样更快捷,安装好之后,啥都不用设置,就生效了;
不会安装cocoaPods的童鞋可以参考这篇文章:http://blog.csdn.net/syg90178aw/article/details/47613859
栗子如图:(其中的红色的TextInput是写在ScrollView外面的)
ps:新的React Native项目安装cocoaPods,会有警告,栗子:
The `XGKeyboard [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation;
解决方法:打开你项目的 Target -> Build Settings -> Other linker flags ->双击添加 $(inherited)