3

Note: My application compiles and runs smoothly with "react-native-web": "^0.11.*" in my ../common/package.json dependencies.

--

CHANGES

updating ../common/package.json -> "react-native-web": "^0.11.*" to "react-native-web": "^0.17.*"

After restarting process (clean, install, build) the application now shows this error on start:

ERRORS

TypeError: Cannot read property 'style' of undefined

../common/node_modules/react-native-router-flux/src/Router.js

244 | ...
245 | sceneStyle: _reactNative.ViewPropTypes.style, 
246 | ...

...implicating ViewPropTypes is now undefined due to the react-native-web update.

--

Question: What is the approach to fixing these issues when a react-native-web (or other dependencies) dependency update causes an error in another dependency?

2 Answers2

0

Answer from @necolas (react-native-web creator) on GitHub: "Read the release notes for each of the 6 minor version updates since 0.11 and take action accordingly: https://github.com/necolas/react-native-web/releases

Vasyl Nahuliak
  • 1,912
  • 2
  • 14
  • 32
0

Possible solution / Quick fix

The above error can be solve by removing any ViewPropTypes usage from the library, or by mocking ViewPropTypes functionality whenever ViewPropTypes is undefined.

For example, the following fix has been solved the above error in Router.js (line 135) for my case: sceneStyle: ViewPropTypes ? ViewPropTypes.style : PropTypes.object

This fix at Router.js seems to make react-native-router-flux function well with react-native-web v0.12+, but I don't sure if there are any more ViewPropTypes usage in the library.

However, mocking any ViewPropTypes usage with relevant PropTypes type will probably solve any issue like this

Source: https://github.com/aksonov/react-native-router-flux/issues/3707

Vasyl Nahuliak
  • 1,912
  • 2
  • 14
  • 32