2

Nothing related to PropTypes as I have seen dozens of problems related to that, my error refers directly to 'react_1.default.Component', undefined is not an object.

Has anyone hit this error? What files should I upload here?

import React from 'react';

import { StackNavigator } from 'react-navigation';
import SideMenu from 'react-native-side-menu';

import Home from './app/screens/Home/Home';
import Menu from './app/components/Menu/Menu';

const Nav = StackNavigator({
  Home: {
    screen: Home,
    navigationOptions: {
      title: 'Map',
      headerStyle: {
        backgroundColor: '#000000',
      },
      headerTintColor: '#ffffff'
    }
  }
});

export default class App extends React.Component {
  render() {

    return (
        <Nav />
    );
  }
}

Package.json :

{
  "name": "Licenta2018",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "android": "react-native run-android"
  },
  "dependencies": {
    "@types/react-native": "^0.55.4",
    "react": "16.3.1",
    "react-native": "0.55.3",
    "react-native-maps": "^0.21.0",
    "react-native-side-menu": "^1.1.3",
    "react-navigation": "^1.5.11"
  },
  "devDependencies": {
    "babel-jest": "22.4.3",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.3",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
5
  • 2
    if you change your import for: import * as React from 'react';? Commented Apr 20, 2018 at 15:10
  • Can you also add the code for Home and Menu screens?, the given code is correct Commented Apr 20, 2018 at 16:37
  • 1
    Thanks, @rm4, I've tried many similar workarounds but not this one. It seems to work now. Commented Apr 23, 2018 at 6:35
  • 1
    @PritishVaidya those are working too, they were pretty much empty components with the same imports as App.js. Thanks for your answer! Commented Apr 23, 2018 at 6:36
  • 1
    Great, you can add an answer below and mark it as correct. Commented Apr 23, 2018 at 6:37

1 Answer 1

2
import * as React from 'react';

for everyone wandering for an answer, this worked for me. Worth a try!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Keywords for others Googling: (react_1.default.Component)); & Cannot read properties of undefined (reading 'Component')

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.