流-来自本机/库的错误

时间:2019-06-18 16:14:18

标签: javascript reactjs react-native flowtype

迁移到Flow 0.101.0之后,我得到了来自<StepInput value="{/step}" valueState="{= ${/step} === 0 ? 'Error' : 'None' undefined}" />的这些新错误:

react-native/Libraries

本机信息输出:

> npm run flow

> mobile-viewer@2.0.0-rn-059 flow /Users/dude/workspace/mobile-viewer/mobile-viewer
> flow src

Launching Flow server for /Users/dude/workspace/mobile-viewer/mobile-viewer
Spawned flow server (pid=32736)
Logs will go to /private/tmp/flow/zSUserszSdudezSworkspacezSmobile-viewerzSmobile-viewer.log
Monitor logs will go to /private/tmp/flow/zSUserszSdudezSworkspacezSmobile-viewerzSmobile-viewer.monitor_log
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js:659:7

Cannot call this._scrollAnimatedValue.setOffset with this.props.contentInset ? this.props.contentInset.top : 0 bound to
offset because:
 • null or undefined [1] is incompatible with number [2].
 • undefined [1] is incompatible with number [2].

     node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js
     656│       this.props.contentOffset ? this.props.contentOffset.y : 0,
     657│     );
     658│     this._scrollAnimatedValue.setOffset(
     659│       this.props.contentInset ? this.props.contentInset.top : 0,
     660│     );
     661│     this._stickyHeaderRefs = new Map();
     662│     this._headerLayoutYs = new Map();

     node_modules/react-native/Libraries/Animated/src/nodes/AnimatedValue.js
 [2] 120│   setOffset(offset: number): void {

     node_modules/react-native/Libraries/StyleSheet/EdgeInsetsPropType.js
 [1]  14│   top?: ?number,


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/react-native/Libraries/Lists/SectionList.js:337:28

Cannot assign ref to this._wrapperListRef because SectionBase [1] is incompatible with SectionT [1] in type argument
SectionT [2].

     node_modules/react-native/Libraries/Lists/SectionList.js
 [1]  73│     section: SectionT,
        :
     334│
     335│   _wrapperListRef: ?React.ElementRef<typeof VirtualizedSectionList>;
     336│   _captureRef = ref => {
     337│     this._wrapperListRef = ref;
     338│   };
     339│ }
     340│

     node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js
 [2] 134│ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<



Found 3 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mobile-viewer@2.0.0-rn-059 flow: `flow src`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the mobile-viewer@2.0.0-rn-059 flow script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dude/.npm/_logs/2019-06-18T16_00_13_029Z-debug.log

解决这些错误的最佳方法是什么?

1 个答案:

答案 0 :(得分:1)

您应该使用在Teamplate配置中声明的with的相同版本。

例如,我们使用react-native@0.59,对于此版本,建议使用流程0.92.0

https://github.com/facebook/react-native/blob/c20070f10458d48d6ac1eaac49e681e932bfb9fd/template/_flowconfig#L68-L69

这是典型的反应性头痛!感谢核心团队的帮助