我开始一个反应原生的项目。但即使遵循最佳社区工作代码,我也会在设备仿真上遇到错误。你能帮忙吗?
import React, { Component } from 'react';
import { Appregistry, Text,View ,StyleSheet} from 'react-native';
import Compo from './app/app/Compo';
export default class test extends Component {
render(){
return(
<View>
<Compo />
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('test',()=&gt; test);
我的被叫app是
import React, { Component } from 'react';
import { Appregistry,Text,View,StyleSheet } from 'react-native';
export default class Compo extends Component {
render(){
return(
<View>
<Text>Hi Bineesh</Text>
</View>
)
} }
AppRegistry.registerComponent('Compo',()=&gt; Compo);
为什么这会抛出AppRegistry错误?
答案 0 :(得分:0)
Javascript是caseSensitive,而Appregistry这个词就是AppRegistry。