问题
I am using native base for making app in react-native. I am new to both things. When I run the app It gives me this error:
Here is my code:
export default class Point extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='menu' />
</Button>
</Left>
<Body>
<Title>Header</Title>
</Body>
<Right />
</Header>
</Container>
);
}
}
Here is the screenshot of my versions
and nativebase version is "native-base": "^2.1.2"
回答1:
Just kill all node process and start npm server and run application:
Step1: run command killall -9 node
For windows users, run:
taskkill /im node.exeRun
taskkill /f /im node.exeif the process still persists.
Step2: run command npm start --reset-cache
Step3: run command react-native run-ios OR react-native run-android
回答2:
Closing the current Metro Bundler and restarting by resetting the cache worked for me
npm start -- --reset-cache
回答3:
You should have this at the bottom of the index.ios.js file
AppRegistry.registerComponent('Point', () => Point);
and also import AppRegistry from react-native
回答4:
I had this issue - it was odd because I reset my repo to a time when the app was working. The issue was with my simulator (iOS).
For me the solution was to
- kill the simulator program (quit)
- then - close the terminal window that is opened when simulator is ran (Metro Bundler) Image of my terminal window
回答5:
I was using native base for my app here is link native base
and you can see there is no app registry like this
AppRegistry.registerComponent('Point', () => Point)
but i have to do this to run my app
回答6:
Need to replace
.setJSMainModulePath("index") with .setJSMainModulePath("index.android")
回答7:
For me, restarting my computer appears to be enough to clear this issue.
It's often required after I've switched between branches, or merged branches using git.
回答8:
I am using Expo
In my case, I resolved the issue by adding the following code in app.json file
"expo":{
...
"android": {
"package": "com.mycompanyname.myappname
}
}
回答9:
import { AppRegistry } from 'react-native';
AppRegistry.registerComponent('your app name', () => point);
回答10:
I have solved it, just closing the current Metro Bundler and restarting by type comment below.
npm start -- --reset-cache
来源:https://stackoverflow.com/questions/43604603/module-appregistry-is-not-registered-callable-module-calling-runapplication