react native check render method navigator

2.2k views Asked by At

Trying to make a new app, I get error below from the code. the component seesm to world https://www.youtube.com/watch?v=QJ_iRLfehSU&index=3&list=PL7D-0n1z1EbgAoLu1n5wjcMLDDAQqXOMw

Error

        /**
         * Sample React Native App
         * https://github.com/facebook/react-native
         * @flow
         */

        import React, { Component } from 'react';
        import {
            AppRegistry,
            StyleSheet,
            Text,
            View,
            Navigator
        } from 'react-native';

        var Login = require("./app/components/Login");

        class PioneerSales extends Component {
            render() {
                return (
                    <Navigator
                        initialRoute = {{
                            id: "Login"
                        }}
                        renderScene = {
                            this.navigatorRenderScene
                        }
                    />
                );
            }

            navigatorRenderScene(route, navigator){
                _navigator = navigator;
                if (route.id == "Login") {
                    return (<Login _navigator={_navigator} title="Login" />)
                }
            }
        }

        AppRegistry.registerComponent('PioneerSales', () => PioneerSales);

Any help would be appreciated.

1

There are 1 answers

0
appbanana On

It may be due to your Login component has not exposed out.It should be like this. Check your component. Then import this component like this

import Test from './app/xxx/Login'
export default class Test extends Component {

    render() {

        return (
            <View style={stytles.mainStytle}>

            </View>
        )

    }

}