代码之家  ›  专栏  ›  技术社区  ›  user938363

如何在App.js中导出navigator容器和类

  •  0
  • user938363  · 技术社区  · 6 年前

    我正在努力使一个简单的聊天应用程序与工作 React Native App.js :

    //import the screens
    import Chat from './components/Chat';
    //import react navigation
    import { createStackNavigator, createAppContainer } from 'react-navigation';
    
    import React, {Component} from 'react';
    import {Platform, StyleSheet, Text, View} from 'react-native';
    
    //create the navigator
    const navigator = createStackNavigator({
      Chat: { screen: Chat },
    });
    
    //export it as the root component
    export default createAppContainer(navigator);
    

    null is not the object :

    enter image description here

    Loading dependency graph, done.
     DELTA  [android, dev] ..\..\../index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (740/740), done.
    
    ::ffff:127.0.0.1 - - [01/Mar/2019:05:35:34 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 200 - "-" "okhttp/3.12.1"
    ::ffff:127.0.0.1 - - [01/Mar/2019:05:35:37 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "okhttp/3.12.1"
    ::ffff:127.0.0.1 - - [01/Mar/2019:05:35:39 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "okhttp/3.12.1"
    

    null 被传递到路由交换机。是什么导致了错误?

    0 回复  |  直到 6 年前
        1
  •  1
  •   Navneet kumar    6 年前

    只能有一个 export default 但是可以有多个 export

    import { export1, export2 } from "./componentName"