React-Activate Invariant Violation:_default(...)

Asked

Viewed 126 times

0

I’m a beginner in React-On, and for the first project I decided to redo an old class job. However this error is occurring, I was just making a screen of Oggin and trying to register there in App.js

inserir a descrição da imagem aqui

login code

import React, {Component} from 'react';
import {
  TextInput, 
  View,
  
} from 'react-native';

export default class Login extends Component{

    render () {
        return (
            <View>
                <TextInput placeholder ="Usuário"
                    onChangeText ={ text => this.setState({ user: text})}/>

                <TextInput placeholder ="Senha"
                    onChangeText ={ text => this.setState({ password: text})}/>

                
            </View>
        );
    }
};

codex App.js

import { AppRegistry } from 'react-native';

import Login from '../BancaDeAvaliacao/src/screens/Login';


export default () => {
  AppRegistry.registerComponent('BancaDeAvaliacao', () => Login);
}

Would anyone know what’s going on ? if I just use export default Login; in the App.js file, it loads the login page.

React-Native version: 0.60.4 React-Native-cli version: 2.0.1

1 answer

1

Hello !

I could take a print or inform me the structure of folders using, I believe your problem is related to this post

Exactly in this answer: The problem is that the registered application name did not match the root folder. So if your root folder is /Chatapp, register your app as follows:

AppRegistry.registerComponent('ChatApp', ()  => App);

I believe your import may be incorrect :

import Login from '../BancaDeAvaliacao/src/screens/Login';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.