ViewPropTypes from react-native undefined, causing TypeError on the 'style' prop

See original GitHub issue

Issue summary

react-native-multi-select.js is failing to compile with TypeError: Cannot read property ‘style’ of undefined. The error appears to be for any reference made to ViewPropTypes. I have run ‘yarn outdated’ to check my node module versions and dependencies; nothing wrong stood out for me.

My app is built/run using “react-app-rewired start” with a few customize-cra rules in the config-overrides.js.

Any help/idea would be appreciated.

Library versions

react: ^17.0.1 react-native: 0.63.3 react-native-multiple-select: ^0.5.6

Steps to Reproduce

This error shows up for “import MultiSelect from ‘react-native-multiple-select’” line in my code when “react-app-rewired start” is run.

Expected Behavior

I expected ViewPropTypes.style from react-native to not cause any problems, and the multiple select list would show up in my app.

Actual Behavior

image

Commenting out all the lines that reference ViewPropTypes.style bypasses the compilation issue, but obviously that’s not desirable. For example, these lines:

In react-native-multi-select.js    
   styleDropdownMenu: ViewPropTypes.style,
    styleDropdownMenuSubsection: ViewPropTypes.style,
    styleInputGroup: ViewPropTypes.style,
    styleItemsContainer: ViewPropTypes.style,

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
28harishkumarcommented, Mar 11, 2021

I see what the problem is. Trying just to wrap the component around a View

Any progress on this? Is there any temporary solution other than commenting propTypes?

2reactions
sajidrockscommented, Feb 16, 2021

Following your suggestions, I removed the node_modules folder and ran yarn, first with a View wrapping the component and then without the View but I am afraid to say, in both of these cases, it made no difference for me. Same error. Thanks so much for continuing to look into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inexplicable Error When Starting React Native Project ...
TypeError: undefined is not an object (evaluating '_MaterialIcons.default.propTypes.style') ERROR Invariant Violation: Module AppRegistry is not ...
Read more >
typeerror: undefined is not an object (evaluating '_reactnative ...
propTypes.resizeMode') ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error ...
Read more >
TypeError: undefined is not an object (evaluating '_reactNative ...
TypeError : undefined is not an object (evaluating '_reactNative.View. ... Should now be ViewPropTypes.style - one of the packages you are using is...
Read more >
deprecated-react-native-prop-types - npm
Deprecated prop-types from React Native.. Latest version: 4.0.0, last published: 14 days ago. Start using deprecated-react-native-prop-types ...
Read more >
undefined is not an object-React Native - appsloveworld.com
Component { btnPress = () => { console.log("Fn Button pressed"); } render() { return ( <View style={styles.container}> <Button title="this is a test" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found