React-native-vector-icons: Incompatibility with `react-native-web` 0.11.x

Created on 23 Mar 2019  路  5Comments  路  Source: oblador/react-native-vector-icons

Environment

macOS 10.13.6, targeting web, RN Vector Icons version 6.4.2, RN Web version 0.11.2

Description

When trying to bump my RN Web version up to the 0.11.X series, I get the following error:

Uncaught TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Object../node_modules/fos-common/node_modules/react-native-vector-icons/dist/lib/react-native.js (bundle.js:63485)
    at __webpack_require__ (bundle.js:724)
    at fn (bundle.js:101)
    at Object../node_modules/fos-common/node_modules/react-native-vector-icons/dist/lib/create-icon-set.js (bundle.js:63096)
    at __webpack_require__ (bundle.js:724)
    at fn (bundle.js:101)
    at Object../node_modules/fos-common/node_modules/react-native-vector-icons/dist/MaterialIcons.js (bundle.js:63025)
    at __webpack_require__ (bundle.js:724)
    at fn (bundle.js:101)

Digging into this, I realized that this is because RNW no longer offers up a default export, meaning the MO used in this file is no longer valid.

Reproducible Demo

Try setting up a fresh project with RN Vector Icons and RN Web (using Webpack). Watch as above error occurs.

Potentially super naive question - is there a specific reason why there is a lib/react-native.js file that just re-exports all RN? I'd imagine it is for the platform-specific .osx.js variant.

Most helpful comment

For some more context, the react-native-web commit that removes the default export is this one:

https://github.com/necolas/react-native-web/commit/69bd0f631dc0a1640e1f4449611e03d0339e8e81

All 5 comments

For some more context, the react-native-web commit that removes the default export is this one:

https://github.com/necolas/react-native-web/commit/69bd0f631dc0a1640e1f4449611e03d0339e8e81

Having this issues as well. I can't even choose to not use/remove vector-icons as other modules have dependency on them. Literally can't run the web app.

Opened a pull request to add a web specific export from react-native-web. Works locally on my project. 991

Closing this since #991 was merged, please use the master branch until the next version is released on npm 馃檪

@hampustagerud any chance of a next version being released soon, or is the plan to wait a bit more? Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alihesari picture alihesari  路  3Comments

obykoo picture obykoo  路  3Comments

lossen picture lossen  路  4Comments

tharrington picture tharrington  路  4Comments

AbhayVarshney picture AbhayVarshney  路  3Comments