Viro: Please remove unused imports. Problems with upgrade to RN 0.57.0

Created on 13 Sep 2018  路  11Comments  路  Source: viromedia/viro

Environment

Please provide the following information about your environment:

  1. Development OS: Mac
  2. Device OS & Version: iOS 12.0
  3. Version: ViroReact 2.10.0 and React Native 0.57.0
  4. Device(s): iPhone SE

Description

import normalizeColor from "react-native/Libraries/StyleSheet/normalizeColor"
causes fail to build
I needed to comment out those lines.

Also I've seen few unused imports. Please remove them.
Or maybe you have open source repo for Viro so I can create a PR?

Most helpful comment

Looking forward to RN 0.57.0 support. I'm relying on the latest RN release since it fixes a critical bug in my app.

You can add this

"fixReactViro": "find ./node_modules/react-viro/components -type f -exec sed -i '' 's#^import normalizeColor from \"react-native/Libraries/StyleSheet/normalizeColor\"#// import normalizeColor from \"react-native/Libraries/StyleSheet/normalizeColor\"#g' {} \\;",
"postinstall": "yarn run fixReactViro",

in your package.json for now

All 11 comments

Thanks for the heads up. The latest ViroReact release is compatible with RN 0.55.1 but this information will help others who are on 0.57

Looking forward to RN 0.57.0 support. I'm relying on the latest RN release since it fixes a critical bug in my app.

Looking forward to RN 0.57.0 support. I'm relying on the latest RN release since it fixes a critical bug in my app.

You can add this

"fixReactViro": "find ./node_modules/react-viro/components -type f -exec sed -i '' 's#^import normalizeColor from \"react-native/Libraries/StyleSheet/normalizeColor\"#// import normalizeColor from \"react-native/Libraries/StyleSheet/normalizeColor\"#g' {} \\;",
"postinstall": "yarn run fixReactViro",

in your package.json for now

@kesha-antonov would you mind explaining what that line does? or point me to some docs about how you came up with that?

@Jnguy142 it's a simple bash command that uses the find command to access all the Viro components and uses the sed command to replace the old import with the new one. You'll want to add this to your package.json under the scripts: key/section.

@kesha-antonov How did you solve the issue of resolving vrx files? I tried this but now I'm getting an error from babel ("Unexpected character").

@kesha-antonov How did you solve the issue of resolving vrx files? I tried this but now I'm getting an error from babel ("Unexpected character").

I've had no errors with vrx files. It just works

Hi,

i had to upgrade to react-native 0.57 too. Here is a list of all components with the unused normalizeColor import:

  • ViroDirectionalLight.js
  • ViroSkyBox.js
  • ViroAmbientLight.js
  • ViroOmniLight.js
  • ViroSpotLight.js

A fix for the next release would be great.

Hi,

We've removed references to unused normalizeColor internally. That should reflect in our next release. In the meantime please use the bash command put together by @kesha-antonov here. Will update here once the next release is out.

It's fixed in latest release

Looking forward to RN 0.57.0 support. I'm relying on the latest RN release since it fixes a critical bug in my app.

You can add this

"fixReactViro": "find ./node_modules/react-viro/components -type f -exec sed -i '' 's#^import normalizeColor from \"react-native/Libraries/StyleSheet/normalizeColor\"#// import normalizeColor from \"react-native/Libraries/StyleSheet/normalizeColor\"#g' {} \\;",
"postinstall": "yarn run fixReactViro",

in your package.json for now

How to fix it on Android?

Was this page helpful?
0 / 5 - 0 ratings