React Native Invariant Violation: View config

后端 未结 2 820
渐次进展
渐次进展 2020-12-08 04:27

I\'m trying to practice with different screens on a React Native project. Here\'s my code from App.js file.

import React, { Component } from \'react\';
impor         


        
相关标签:
2条回答
  • 2020-12-08 04:48

    The name of any component must be capitalized. In your name, the component "navigation" is not capitalized. It should be "Navigation".

    0 讨论(0)
  • 2020-12-08 05:09

    In react native the component's name should begin with capital letter, so it will be:

    const Navigation = StackNavigator({
        Home: { screen: HomeScreen },
    
    });
    

    and call it with capital:

    export default class App extends Component<{}> {
      render() {
        return <Navigation/>;
      }
    }
    
    0 讨论(0)
提交回复
热议问题