Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to resolve module react-native/Libraries/Components/View/ViewStylePropTypes

Tags:

react-native

This is my package.json:

{
  "name": "BStore",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "expo": "^32.0.5",
    "native-base": "^2.11.0",
    "prop-types": "^15.7.2",
    "react": "16.6.3",
    "react-native": "0.58.3",
    "react-native-gesture-handler": "^1.0.15",
    "react-native-paper": "^2.11.0",
    "react-navigation": "^3.0.9",
    "react-navigation-material-bottom-tabs": "^1.0.0"
  },
  "devDependencies": {
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "24.1.0",
    "jest": "24.1.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.6.3"
  },
  "jest": {
    "preset": "react-native"
  }    
}

I am getting this error Unable to resolve modulereact-native/Libraries/Components/View/ViewStylePropTypes`

any ideas how can I solve this issue?

like image 974
Rockwell Momo Avatar asked Feb 14 '19 16:02

Rockwell Momo


2 Answers

You have to read the error-message carefully. I've the same issue, mine was:

Unable to resolve module react-native/Libraries/Components/View/ViewStylePropTypes from /APP/node_modules/react-native-render-html/src/HTMLUtils.js: Module react-native/Libraries/Components/View/ViewStylePropTypes does not exist in the Haste module map

So the 3rd Party Library react-native-render-html cause the error, because it try to use ViewStylePropTypes.

In case of @adrian-moisa: For you it's react-native-reanimated. Don't know what the cause was for the ThreadOpener, he didn't post an usable error-message.

Fact is, that ViewStylePropTypes was removed up from react-native 0.58

compare: https://github.com/facebook/react-native/tree/v0.57.8/Libraries/Components/View https://github.com/facebook/react-native/tree/v0.58.0/Libraries/Components/View

So the solution is to figure out, which 3rd-Party Component cause the error, and look if there is an upgrade from the maintainer, or yourself have to patch it (e.g. with patch-package)

like image 173
suther Avatar answered Jan 05 '23 03:01

suther


Had same issue.

As I find out expo 32.0.5 and react-native 0.58.3 are not compatible. So expo react-native fork should be used.

To install it you can use command

npm install --save react-native@https://github.com/expo/react-native/archive/sdk-32.0.1.tar.gz

like image 38
Sasha Kos Avatar answered Jan 05 '23 03:01

Sasha Kos