使用Flow获取React Native错误

时间:2017-05-12 22:47:39

标签: javascript react-native flowtype

我设置Flow和React Native创建了默认的.flowcongif文件。但是“npm run flow”会返回大量关于本机库反应的错误:

node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS.ios.js:38
 38: const DatePickerIOS = React.createClass({
                           ^ call of method `createClass`. Expected a React PropType instead of
371:     hitSlop: EdgeInsetsPropType,
                  ^^^^^^^^^^^^^^^^^^ object type. See: node_modules/react-native/Libraries/Components/View/View.js:371

node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS.ios.js:105
105:     this.props.onChange && this.props.onChange(event);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `onChange`. Function cannot be called on
105:     this.props.onChange && this.props.onChange(event);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^ property `onChange` of unknown type

1 个答案:

答案 0 :(得分:0)

您使用的是正确的Flow版本吗?

检查.flowconfig文件底部的版本,确保是您安装的版本。

现在就是:

  

npm --save-dev install flow-bin@0.42.0