question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempted import error: 'ViewPropTypes'

See original GitHub issue
C:/Projects/ReactNative/pwaExpo/node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js
Attempted import error: 'ViewPropTypes' is not exported from 'react-native-web/dist/index'.
  • “expo”: “~39.0.2”

  • “react-native”: “https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz”,

  • “react-native-web”: “~0.14.0”,

    "@babel/core": "~7.11.6",
    "@babel/plugin-transform-react-jsx-source": "^7.10.5",
    "@expo/webpack-config": "^0.12.38",
    "babel-plugin-import": "^1.13.1",
    "babel-plugin-root-import": "^6.5.0"  },```

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

7reactions
ipakhomovcommented, Nov 7, 2020

For those who want to automate this fix until this issue is resolved - here is a combined version of this and this workarounds in one .sh-script:

# Fix react-native-web compile issue. See:
# https://github.com/necolas/react-native-web/issues/1537
# https://github.com/archriss/react-native-snap-carousel/issues/770

echo 'Fixing PropTypes issues'

if test -f node_modules/react-native-web/dist/exports/ViewPropTypes/index.js; then
   echo "ViewPropTypes problem fixed already!"
else
    mkdir node_modules/react-native-web/dist/exports/ViewPropTypes
    touch node_modules/react-native-web/dist/exports/ViewPropTypes/index.js
    echo 'var ViewPropTypes = { style: null }; export default ViewPropTypes;'>> node_modules/react-native-web/dist/exports/ViewPropTypes/index.js
    echo "export { default as ViewPropTypes } from './exports/ViewPropTypes';">> node_modules/react-native-web/dist/index.js
fi

Put this into .sh-file somewhere in your project and then add the following command to postinstall in package.json:

"postinstall": "chmod 777 web-postinstall-fix.sh && ./web-postinstall-fix.sh"

Then the necessary fix will be applied after each dependencies install.

Regards, Ilya

2reactions
mbpicturescommented, Oct 30, 2020

I managed to get it working with this work around

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attempted import error: 'ViewPropTypes' is not exported from ...
I tried to access the app using Expo Web and got one error in terminal and one in the browser. It seemed to...
Read more >
How I solved the >>'ViewPropTypes' is ... - DEV Community ‍ ‍
Introduction. I couldn't find the fix for this error anywhere in the react-native-snap-carousel package, and it was really frustrating.
Read more >
How I solved the >>'ViewPropTypes' is not exported from ...
Import react-style-proptype , as prescribed by the documentation, in each file mentioned above. 4. Replace all instances of ViewPropTypes ? ViewPropTypes.style ...
Read more >
ViewPropTypes has been removed from React Native. Migrate ...
import { findNodeHandle, Platform, NativeModules, ViewPropTypes, requireNativeComponent, ... I had the same error using react-native-camera.
Read more >
viewproptypes has been removed from react native. migrate to ...
find ViewPropTypes import in the node modules in which library this gives error ... tried to update react-native version 0.69.1 getting this error...
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