我无法弄清楚为什么导入AppRegistry时会收到此错误。 ................................................... ................................................... ................................................... ................................................... ................................................... ........................
这是我的代码:
import React, { Component } from 'react';
import {
AppRegistry,
Text,
StatusBar,
View
} from 'react-native';
import { COLOR, ThemeProvider, Toolbar, Drawer, Avatar } from 'react-native-material-ui';
import Container from './Container';
import {createDrawerNavigator, createStackNavigator} from 'react-navigation';
import Header2 from './Header2'
const uiTheme = {
palette: {
primaryColor: COLOR.green500,
accentColor: COLOR.pink500,
},
toolbar: {
container: {
height: 70,
paddingTop: 20,
},
},
avatar: {
container: {
backgroundColor: '#333'
}
}
};
export default class DrawerMenu extends Component {
constructor(props, context) {
super(props, context);
this.state = {
active: 'people',
};
}
_setInfoActive() {
this.setState({ active: 'info' });
}
render() {
return (
<React.Fragment>
<ThemeProvider uiTheme={uiTheme}>
<Container>
<StatusBar backgroundColor="rgba(0, 0, 0, 0.2)" translucent />
<Toolbar
leftElement="arrow-back"
onLeftElementPress={() => this.props.navigation.navigate('DrawerClose')}
centerElement="Menu"
/>
</Container>
</ThemeProvider>
<AppRegistry />
</React.Fragment>
);
}
}
const stackNavigator = createStackNavigator({
Home: { screen: Header2 },
}, {
headerMode: 'none'
});
const easyRNRoute = createDrawerNavigator({
Home: {
screen: Header2,
},
Stack: {
screen: stackNavigator
}
}, {
contentComponent: DrawerMenu,
contentOptions: {
activeTintColor: '#e91e63',
style: {
flex: 1,
paddingTop: 15,
}
}
});
AppRegistry.registerComponent(easyRNRoute, () => easyRNRoute);
答案 0 :(得分:0)
看起来好像是NPM服务器的问题。尝试更新/重新启动NPM服务器。