Nativebase: undefined is not an object (evaluating '_react2.PropTypes.element')

Created on 20 Jul 2017  路  27Comments  路  Source: GeekyAnts/NativeBase

  • native-base version: 2.3.0
  • react version: 16.0.0-alpha.13
  • react-native version: 0.46.4

Most helpful comment

Appears to solve it!

How do you guys normally deal with supporting React & React-Native versions? Because I'm pretty sure a lot of other users will come across this error

All 27 comments

Having the same issue here

@Neglexis @coleawabdy Try 16.0.0-alpha.12

Appears to solve it!

How do you guys normally deal with supporting React & React-Native versions? Because I'm pretty sure a lot of other users will come across this error

For react version: 16.0.0-alpha.13 and
react-native version: 0.46.4, use NativeBase v2.3.1

isn't it because React.Proptypes is deprecated? proptypes are now on it's own module

@jaycee425 is right, use prop-types npm module instead
https://www.npmjs.com/package/prop-types

same issue :(
I have
"native-base": "^2.3.0",
"react": "16.0.0-beta.5",
"react-native": "0.49.3",
"react-native-loading-spinner-overlay": "^0.5.2",
"react-native-popup-menu": "^0.9.0",
"react-native-responsive-dimensions": "^1.0.2",
"react-native-router-flux": "^4.0.0-beta.22",
"react-native-star-rating": "^1.0.8",
"react-native-tabs": "^1.0.9",
"react-native-vector-icons": "^4.4.2",
"realm": "^2.0.0"

@hayait599 try upgrading native-base to version 2.3.3.

@akhil-geekyants unable to install native-base 2.3.3
every time the cmd suddenly exits
unable to install any version more than 2.3.0 in any react native project

problem solved I had to update my npm to the latest version.

@hayait599 glad to know that you got it working

"native-base": "v2.3.3",
    "react": "16.0.0-beta.5",
    "react-native": "0.49.5",

These work for me

"native-base": "2.3.0",
"react": "^16.0.0-alpha.12",
"react-native": "0.48.0"

same error

@ShaileshPrajapati-BTC Try with latest of NativeBase
2.3.3

@ShaileshPrajapati-BTC to install the 2.3.3 v your npm v must => 5

Same Error:
"react-native-scripts": "1.8.1",
"native-base": "^2.2.1",
"react": "16.0.0",
"react-native": "0.50.3"

npm: 4.6.1
node: 9.2.0

@zedunaid React-native works just fine with npm 5 it's create-react-native-app that is not supported, if you build the project with native code, it should work just fine
I work on
react-native-cli: 2.0.1
react-native: 0.48.4
npm: 5.3.0
node: v8.2.1

@jaycee425 Thanks.. Ya.. right.. CRNA is not supported for npm 5 ! Can you please check why I am facing above error? I have listed my specification in above post.

you have to upgrade your npm install native Base then downgraded and run your application
Worked fine with me

I solved this issue by adding prop-types libarary as @torihuang and @jaycee425 said..
https://www.npmjs.com/package/prop-types

Am having the same problem.
Below is the error log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/9.3.0_1/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'update' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Cannot find module 'minimatch'
4 verbose stack at Function.Module._resolveFilename (module.js:555:15)
4 verbose stack at Function.Module._load (module.js:482:25)
4 verbose stack at Module.require (module.js:604:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object. (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/glob/glob.js:44:17)
4 verbose stack at Module._compile (module.js:660:30)
4 verbose stack at Object.Module._extensions..js (module.js:671:10)
4 verbose stack at Module.load (module.js:573:32)
4 verbose stack at tryModuleLoad (module.js:513:12)
4 verbose stack at Function.Module._load (module.js:505:3)
4 verbose stack at Module.require (module.js:604:17)
4 verbose stack at require (internal/module.js:11:18)
4 verbose stack at Object. (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:10:12)
4 verbose stack at Module._compile (module.js:660:30)
4 verbose stack at Object.Module._extensions..js (module.js:671:10)
4 verbose stack at Module.load (module.js:573:32)
5 verbose cwd /Users/apple/Documents/Melch/X-Po/project-1
6 verbose Darwin 17.3.0
7 verbose argv "/usr/local/Cellar/node/9.3.0_1/bin/node" "/usr/local/bin/npm" "update"
8 verbose node v9.3.0
9 verbose npm v5.6.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'minimatch'
12 verbose exit [ 1, true ]

i'm having the same error :/

I am using react-native-slideshow but I get this error:
Cannot read property 'arrayOf' of undefined.

I did as some answer suggested:
// install prop-types module
// then import it in the codebase
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Slideshow from 'react-native-slideshow';

export default class App extends Component {

render() {
return (
dataSource={[
{ url:'http://placeimg.com/640/480/any' },
{ url:'http://placeimg.com/640/480/any' },
{ url:'http://placeimg.com/640/480/any' }
]}/>
);
}
}

But I am still getting the same error:
Help me please

I solved the issue

@Muedgar can you tell me what was wrong. I am getting the same error.

did you get error immediately after init?
or after editing the source code?

I did init with RN 0.55.2 and added NativeBase 2.4.4, here is my package.json

{
  "name": "RNInit",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "native-base": "^2.4.4",
    "react": "16.3.1",
    "react-native": "0.55.2"
  },
  "devDependencies": {
    "babel-jest": "23.2.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "23.2.0",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

worked fine

i did not edit the source code here

@Muedgar hello, what did you do to solve it?
I've same error with PropTypes.element

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aloifolia picture aloifolia  路  3Comments

mcpracht picture mcpracht  路  3Comments

bsiddiqui picture bsiddiqui  路  3Comments

muthuraman007 picture muthuraman007  路  3Comments

inv2004 picture inv2004  路  3Comments