无法找到变量:AppRegistry - 以防它被导入

问题描述 投票:0回答:1

在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);
react-native react-navigation
1个回答
0
投票

在某个地方,它看起来像NPM服务器的问题。尝试更新/重新启动NPM服务器。

© www.soinside.com 2019 - 2024. All rights reserved.