Taylon Assis
Taylon Assis

Reputation: 343

npm install packages succesful, but don't import any component from those packages

I'm in the middle of a react-native project. I've installed, linked and used many packages along time. But now installing packages by npm is being succesful, it is added at package.json, but when I import some feature from package to my project files, app crashes showing messages like:

"undefined is not a object (evaluating '_react.PropTypes.array') 

 "undefined is not a object (evaluating '_react.PropTypes.bool') 

 "undefined is not a object (evaluating '_react.PropTypes.object') 

Example, when I install react-native-modal-picker:

> C:\Users\Taylon\reactive-native-projects\gps7plus>npm install
> react-native-modal
> -picker --save npm WARN [email protected] requires a peer of eslint@^3.17.0 || ^
> 4.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
> [email protected] (node_modules\fse vents): npm WARN notsup SKIPPING
> OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
> 1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"} )
> 
> + [email protected] added 1 package in 19.823s

Could these WARN messages mess something?

Linking (any messages):

C:\Users\Taylon\reactive-native-projects\gps7plus>react-native link react-native
-modal-picker
Scanning folders for symlinks in C:\Users\Taylon\reactive-native-projects\gps7pl
us\node_modules (31ms)

C:\Users\Taylon\reactive-native-projects\gps7plus>

Importing...

import ModalPicker from 'react-native-modal-picker';

I've not even instance this yet. And so red screen:

"undefined is not a object (evaluating '_react.PropTypes.array')

Is there any method that allow to check npm errors? Or some to verify if packages are really installed?

Upvotes: 1

Views: 270

Answers (1)

Pritish Vaidya
Pritish Vaidya

Reputation: 22209

The module react-native-modal-picker has not been updated since long, and PropTypes have been moved to a separate package since version React v15.5 as mentioned here

You can find the proof in their index.js file

import React,{
    PropTypes
} from 'react';

Therefore you need to find an alternative to it. I would recommend you to use this package react-native-actionsheet, since it is cross platform, and provides the same function.

Upvotes: 2

Related Questions