Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

undefined is not an object ( evaluating 'react2.propTypes.oneOfTypes') #1005

Closed
devSeb opened this issue Nov 25, 2017 · 9 comments
Closed

undefined is not an object ( evaluating 'react2.propTypes.oneOfTypes') #1005

devSeb opened this issue Nov 25, 2017 · 9 comments

Comments

@devSeb
Copy link

devSeb commented Nov 25, 2017

Hello everybody,
I would like to implement react-native-camera in my project.
If I run the example in my project for android, I have an error
" undefined is not an object ( evaluating 'react2.propTypes.oneOfTypes') "
.../node_modules/react-native-camera/index.js:75:22

my package.json

"dependencies": { "react": "^15.4.0", "react-dom": "^15.4.0", "react-native": "0.50.4", "react-native-camera": "^0.6.0" }, "devDependencies": { "babel-jest": "21.2.0", "babel-preset-react-native": "4.0.0", "jest": "21.2.1", "react-test-renderer": "16.0.0" }, "jest": { "preset": "react-native" }

My app.js is the same example of the readme

@pengyongqi
Copy link

pengyongqi commented Nov 28, 2017

我也遇到了这个问题,我是这样解决的,希望能帮到你:

1.使用 rnpm link,如果rnpm没有安装,先 yarn add rnpm 或者 npm install rnpm --save

2.在MainApplication.java中加入

//摄像头
import com.lwansbrough.RCTCamera.RCTCameraPackage;

getPackages()中加入

new RCTCameraPackage()

试试看行不行。

my English is poor,I hope it's work for you!

@devSeb
Copy link
Author

devSeb commented Nov 28, 2017

hello, thanks for you message.
I do this in my project.
rnpm link react-native-camera, and it's ok

I don't understand why i have a problem with a props in the index.js in the library with the example in the README . I forgot something ?

@hawkup
Copy link
Contributor

hawkup commented Nov 29, 2017

If you use react-native-camera version 0.6.0, PropTypes import from React package

// react-native-camera/index.js
import React, { Component, PropTypes } from 'react';

And if you use React version 15.5.0 or higher, PropTypes move to own package (reference: https://reactjs.org/blog/2017/04/07/react-v15.5.0.html), have to change import follow this

// react-native-camera/index.js
import React, { Component } from 'react';
import PropTypes from 'prop-types';

Update to the latest version (It's fixed on version 0.10.0)

@devSeb
Copy link
Author

devSeb commented Dec 5, 2017

Thanks @hawkup .
It's worked.
This fix must be in the source code I think.

Is there a pull request for this fix ?

@devSeb devSeb closed this as completed Dec 5, 2017
@devSeb devSeb reopened this Dec 5, 2017
@sibelius
Copy link
Collaborator

fixed on master

@youngjuning
Copy link

proptype

@SatishMavani
Copy link

import PropTypes from 'prop-types'; did not worked for me, is there any other solution?

@jsastriques
Copy link

i`m getting the same error, i´ve tried you suggestions and i don´t get result, here is my error:

undefined is not an object (evaluating '_react.PropTypes.oneOfType')
Unhandled JS Exception: undefined is not an object (evaluating '_react.PropTypes.oneOfType')

1 similar comment
@jsastriques
Copy link

i`m getting the same error, i´ve tried you suggestions and i don´t get result, here is my error:

undefined is not an object (evaluating '_react.PropTypes.oneOfType')
Unhandled JS Exception: undefined is not an object (evaluating '_react.PropTypes.oneOfType')

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants