0

For my react-native application, I am getting

Element type is invalid: expected a string (for built-in components) or a class/function(for composite components) but got: object

app/index.js:

import React, { Component } from 'react';
import EStyleSheet from 'react-native-extended-stylesheet';
import { Provider } from 'react-redux';

import Navigator from './config/routes';
import { AlertProvider } from './redux/components/Alert';
import store from './config/stores';


EStyleSheet.build({
    $primaryBlue: '#4F6D7A',
    $primaryOrange: '#D57A66',
    $primaryGreen: '#00BD9D',
    $primaryPurple: '#9E768F',

    $white: '#FFFFFF',
    $lightGray: '#F0F0F0',
    $border: '#E2E2E2',
    $inputText: '#797979',
    $darkText: '#343434',
});

export default () => (
    <Provider store={store}>
        <AlertProvider>
            <Navigator onNavigationStateChange={null} />
        </AlertProvider>
    </Provider>
);

index.android.js and the index.ios.js:

import App from './app/index';
import React, { Component } from 'react';
import { AppRegistry } from 'react-native';

AppRegistry.registerComponent("TestApp", App);

I tried to remove the Provider, AlertProvider, and Navigator tags and add a View tag just to see if I would still get an error, but I am getting the same error.

What am I doing wrong?

2
  • 1
    You’ll need to post more of your code. The problem is that in the render method of one of your components you’re trying to render a JavaScript object. In react you can only render another component or a “string” Commented Nov 27, 2017 at 19:56
  • As @JoshuaUnderwood said, its not from the code you provided. My guess would be from Navigator. Commented Nov 27, 2017 at 20:09

1 Answer 1

1

Try to register your root component with

AppRegistry.registerComponent("TestApp", () => 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.