Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined is not an object (React.PropTypes.func) #21

Open
renatosistemasvc opened this issue Mar 17, 2018 · 10 comments
Open

Undefined is not an object (React.PropTypes.func) #21

renatosistemasvc opened this issue Mar 17, 2018 · 10 comments

Comments

@renatosistemasvc
Copy link

I'm having the same problem:

#15

I do not feel like changing the version of react native. There is another solution?

my version:

"react-native": "0.52.0"

@xiewang
Copy link
Owner

xiewang commented Mar 17, 2018

@renatosistemasvc
Copy link
Author

renatosistemasvc commented Mar 18, 2018

@xiewang
I was able to solve the problems. The library is already working fine with the latest version of react native (not the latest. and the 0.52).

I suggest changing the library so people do not have to reduce the version of react native.

The modified files were:

react-native-emoctions/package.json
react-native-emoctions/tab.js

The modifications were:

In file react-native-emoctions/package.json
BEFORE
"react-native-scrollable-tab-view": "^0.6.7",

AFTER

 "react-native-scrollable-tab-view": "^0.8.0",
"create-react-class": "^15.6.3", //new

In file react-native-emoctions/tab.js
BEFORE

class TabBar extends React.Component {
...
static propTypes = {
        goToPage: React.PropTypes.func,
        activeTab: React.PropTypes.number,
        tabs: React.PropTypes.array,
    };
...
}
export default TabBar;

//AFTER

import PropTypes from 'prop-types';

class TabBar extends React.Component {
.....
}

TabBar.propTypes = {
    goToPage: PropTypes.func,
    activeTab: PropTypes.number,
    tabs: PropTypes.array,
};
export default TabBar;

By changing the tab.js file to the new structure of PropTypes (external library) and updating and inserting the dependencies of the package.json file, the library works without errors.

@xiewang
Copy link
Owner

xiewang commented Mar 18, 2018

You are correct. I just miss it. I'll fix it later. Thanks a lot.

@ghost
Copy link

ghost commented Mar 24, 2018

@renatosistemasvc .Thank you.
I apply the modification but I have the error ;Cannot read property 'type' of undefined

@renatosistemasvc
Copy link
Author

@WapiMukki Show me an error image. Or a console.log..

I'm using it without any problem. Show more details to find out what's happening.

@ghost
Copy link

ghost commented Mar 24, 2018

You are correct. problem fix it.
Thank you

@thisarascit
Copy link

even though react-native-scrollable-tab-view to latest problem still remaining.any guidance? thanks guys

@aaronshier
Copy link

still getting this error myself. anyone find a solution?

@hjb510
Copy link

hjb510 commented Jun 15, 2018

我用的0.55.4的版本,也出现这个错误。
安装时出现这个错误
npm WARN eslint-plugin-react-native@3.2.1 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: fsevents@1.2.4 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
应该是版本太低导致的

使用时出现这个错误!
Undefined is not an object (React.PropTypes.func)

但是不知道怎么解决

@gabrieljoelc
Copy link

I stumbled on this GH issue looking for a fix to this same error for a non-native ReactJS project. For what its's worth, I just "fixed" it by downgrading from "react": "^17.0.1" to "react": "^15.4.1". I'm thinking it might be deeper than the react-native package...

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

No branches or pull requests

6 participants