React Native Invariant Violation: View config

19 浏览
0 Comments

React Native Invariant Violation: View config

我正在尝试在React Native项目中使用不同的屏幕进行练习。这是我的App.js文件的代码。

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';
import { StackNavigator } from 'react-navigation';
class HomeScreen extends React.Component {
    static navigationOptions = {
        title: "welcome",
    };
    render() {
        return Hello, Navigation!;
    }
}
const navigation = StackNavigator({
    Home: { screen: HomeScreen },
});
export default class App extends Component<{}> {
  render() {
    return ;
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#fff',
  },
});

当我运行react-native run-android时,我收到一个不变的违规警告,告诉我“找不到视图配置或名称导航”。然后是所有发生此违规的地方。

请帮忙,谢谢。

0