React-native-paper: Is it possible to not add React Native Vector Icon to this package?

Created on 21 Mar 2019  路  6Comments  路  Source: callstack/react-native-paper

I just removed React Native Vector Icons because I don't want to use it.
It causes me some bug on react-native link... So I unlink it and remove it from my project.

But now after 2 hours I found why my projects fails with this error :
https://github.com/facebook/react-native/issues/24094

It seems your package use React Native Vector Icons but when I delete it, so it causes bug on your package :

error: bundling failed: Error: Unable to resolve module react-native-vector-icons/MaterialIcons from /front/node_modules/react-native-paper/src/components/Icon.js: Module react-native-vector-icons/MaterialIcons does not exist in the Haste module map

Now I'm stuck, what can I do?

question

Most helpful comment

@satya164 Add the plugin as in install it or add it to babelConfig.js? I'm also having issues opting out of this...

EDIT: Never mind got it working!

For the people interested:

babel.config.js needs to look like this:

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  env: {
    production: {
      plugins: ['react-native-paper/babel'],
    },
  },
  plugins: ['optional-require'],
};

All 6 comments

Hello @satya164

So I see I have to install Babel-plugin-option-required.

But what do I have to add in blacklist and whitelist?

Do you have a config to opt out react Native vector icons?

@Steffi3rd you just need to add the plugin and run react-native start --reset-cache to start the packager. No additional config is needed.

@satya164 Add the plugin as in install it or add it to babelConfig.js? I'm also having issues opting out of this...

EDIT: Never mind got it working!

For the people interested:

babel.config.js needs to look like this:

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  env: {
    production: {
      plugins: ['react-native-paper/babel'],
    },
  },
  plugins: ['optional-require'],
};

@x5engine Author of vector-icons put a lot of effort in making this library and you're blaming it because it doesn't work for you... that's rude

@Trancever I apologize :) the author indeed did a very good job but those errors seem frustrating sometimes after spending days trying to fix that building and rebuilding your app.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timothystewart6 picture timothystewart6  路  4Comments

yaronlevi picture yaronlevi  路  3Comments

kpervin picture kpervin  路  3Comments

sritharanpalani picture sritharanpalani  路  4Comments

alikazemkhanloo picture alikazemkhanloo  路  4Comments