我正在做一个简单的聊天React Native(0.59)应用程序以用于练习。但是App.js
不断抛出Null is not an object
错误。然后我注释掉了所有组件,只剩下一个createStackNavigator和createAppContainer。这是App.js
:
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import codePush from "react-native-code-push";
import Chat from './src/components/Chat';
import Event from './src/components/Event';
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({
//Event: { screen: Event },
//Chat: { screen: Chat },
});
//export it as the root component
export default createAppContainer(navigator);
仍然存在
错误Requiring module "App.js", which threw an exception: TypeError: Properties can only be defined on Objects`
这里缺少什么?
这里是index.js
/**
* @format
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);