无法智能提示代码
解决办法:
#1.全局安装typings
npm install -g typings
#2.进入react-native项目 根目录下 :
typings install dt~react-native --save
函数式组件及其特点
#1.组件不会被实例化,整体渲染性能得到提升
#2.组件不能访问this对象
#3.组件无法访问生命周期的方法
#4.组件只能访问输入的props
尽可能多的使用纯函数式组件 拆分复杂组件
react-native and typescript 的一个style问题:
Type ‘{ flex: number; flexDirection: string; justifyContent: string; backgroundColor: string; }’ is not assignable to type ‘ViewStyle’.
解决办法:用范型声明style的类型并加以使用