我跑很簡單的代碼中使用反應 - 本機的tableview錯誤建築DependencyGraph:錯誤:命名碰撞檢測
'use strict';
var React = require('react-native');
var { AppRegistry } = React;
var TableView = require('react-native-tableview');
var Section = TableView.Section;
var Item = TableView.Item;
class AwesomeProject extends React.Component {
render(){
return (
<TableView style={{flex:1}}
allowsToggle={true}
allowsMultipleSelection={true}
tableViewStyle={TableView.Consts.Style.Grouped}
tableViewCellStyle={TableView.Consts.CellStyle.Subtitle}
onPress={(event) => console.log(event)}>
<Section label="Section 1" arrow={true}>
<Item value="1" detail="Detail1" >Item 1</Item>
<Item value="2">Item 2</Item>
</Section>
<Section label="Section 2" arrow={false}>
<Item selected={true}>Item 1</Item>
<Item>Item 2</Item>
<Item>Item 3</Item>
</Section>
</TableView>
);
}
}
AppRegistry.registerComponent('AwesomeProject',() => AwesomeProject);
依賴關係:
"dependencies": {
"react-native": "^0.17.0",
"react-native-navbar": "^1.1.6",
"react-native-router": "^0.2.1",
"react-native-tableview": "^1.4.6"
}
而我得到的錯誤:
Error building DependencyGraph:
Error: Naming collision detected: /Users/sandbox/native/test/AwesomeProject/node_modules/react-native-router/node_modules/react-native/packager/react-packager/src/DependencyResolver/haste/polyfills/String.prototype.es6.js collides with /Users/sandbox/native/test/AwesomeProject/node_modules/react-native/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js
at HasteMap._updateHasteMap (HasteMap.js:123:13)
at HasteMap.js:94:28
at tryCallOne (/Users/sandbox/native/test/AwesomeProject/node_modules/promise/lib/core.js:37:12)
at /Users/sandbox/native/test/AwesomeProject/node_modules/promise/lib/core.js:123:15
at flush (/Users/sandbox/native/test/AwesomeProject/node_modules/asap/raw.js:50:29)
at doNTCallback0 (node.js:417:9)
at process._tickCallback (node.js:346:13)
我注意到很多人遇到這個問題,但仍然沒有明確的解決方案,哪個庫是有罪的y以及如何避免它。
謝謝你的回答。我也在GitHub上看到過,並且是'react-native-router'使用舊版本的react-native,現在它已經修復https://github.com/t4t5/react-native-router/commit/8ee6c940b025bfe69e1033bf15af14f55faae4e6但尚未發佈 –