当我运行npm start或react-native start时,我收到了这个警告:
jest-haste-map: @providesModule naming collision:
Duplicate module name: core-js
Paths: {path_to_project}/node_modules/react-native/node_modules/core-js/package.json collides with {path_to_project}/node_modules/react-native/node_modules/fbjs/node_modules/core-js/package.json
This warning is caused by a @providesModule declaration with the same name across two different files.
jest-haste-map: @providesModule naming collision:
Duplicate module name: base64-js
Paths: {path_to_project}/node_modules/react-native/node_modules/base64-js/package.json collides with {path_to_project}/node_modules/react-native/node_modules/simple-plist/node_modules/base64-js/package.json
This warning is caused by a @providesModule declaration with the same name across two different files.
Run Code Online (Sandbox Code Playgroud)
这是我的package.json文件
{
"name": "ProjectName",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": { …Run Code Online (Sandbox Code Playgroud) 如何从MobX访问组件引用,下面的示例,运行'doSomething'的乐趣是在componentDidMount之后,我得到的不是函数错误,我想弄清楚如何在MobX中访问ref.什么都会欣赏.非常感谢.
@observer
class MyNav extends Component {
testFun() {
}
}
@observer
class MyComponent extends Component {
doSometing() {
this._myNav.testFun();//this._myNav.testFun() is not a function
}
render() {
return (<MyNav ref={(ref) => this._myNav = ref}/>)
}
}
Run Code Online (Sandbox Code Playgroud)