react-native-emoticons icon indicating copy to clipboard operation
react-native-emoticons copied to clipboard

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

Open renatosistemasvc opened this issue 6 years ago • 10 comments

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"

renatosistemasvc avatar Mar 17 '18 14:03 renatosistemasvc

this may be helpful for you https://reactjs.org/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes

xiewang avatar Mar 17 '18 15:03 xiewang

@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.

renatosistemasvc avatar Mar 18 '18 05:03 renatosistemasvc

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

xiewang avatar Mar 18 '18 12:03 xiewang

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

ghost avatar Mar 24 '18 07:03 ghost

@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.

renatosistemasvc avatar Mar 24 '18 15:03 renatosistemasvc

You are correct. problem fix it. Thank you

ghost avatar Mar 24 '18 16:03 ghost

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

thisarascit avatar May 02 '18 12:05 thisarascit

still getting this error myself. anyone find a solution?

aaronshier avatar Jun 11 '18 03:06 aaronshier

我用的0.55.4的版本,也出现这个错误。 安装时出现这个错误 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.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"} 应该是版本太低导致的

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

但是不知道怎么解决

hjb510 avatar Jun 15 '18 05:06 hjb510

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...

gabrieljoelc avatar Mar 03 '21 15:03 gabrieljoelc