0

When I try to run navigation I receive an error:

Exception: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of Navigator.

My code:

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

import App from './app/App'

export default class MyApp extends Component {

  renderScene (route, navigator) {
      if (route.name === 'App') {
        return <App navigator={navigator} {...route.passProps} />
      }
  }

  configureScene (route) {
    return Navigator.SceneConfigs.FloatFromBottom
  }

  render () {
    return (
      <Navigator
        configureScene={ this.configureScene.bind(this) }
        style={{ flex: 1, backgroundColor: 'white' }}
        initialRoute={{ name: 'App' }}
        renderScene={ this.renderScene.bind(this) }
      />
    )
  }

}

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

Could you help me, please?

2
  • The renderScene method needs to always return a valid view. In your case, you only return a view for the "App" route. Commented Feb 7, 2017 at 13:29
  • 1
    Sorry @jevakallio, I don't understand you. Commented Feb 8, 2017 at 16:27

1 Answer 1

1

You should import your App component like this:

import { App } from './app/App'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.