Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility issue with react-native-elements #9

Closed
tgehrs opened this issue Apr 7, 2017 · 13 comments
Closed

Incompatibility issue with react-native-elements #9

tgehrs opened this issue Apr 7, 2017 · 13 comments

Comments

@tgehrs
Copy link

tgehrs commented Apr 7, 2017

When I attempt to add react-native-elements to my expo project (specifically working with the List component), it gives an error that fontFamily 'Material Icons' is not a system font:

screen shot 2017-04-07 at 3 02 54 pm

It can easily be resolved by switching the imports within react-native-elements to point to this package, for example:

change this
import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
to
import MaterialIcon from '@expo/vector-icons/MaterialIcons'

Is there an official (or better) way to do this? I am new to expo/RN and was unable to find any documentation

@Monte9
Copy link

Monte9 commented Apr 10, 2017

@tgehrs I am the maintainer of React Native Elements.

I think this issue would be more relevant on our repo. This is because in a few of our components, we are defaulting to MaterialIcons at the root and that's the import statement you are seeing above. I think the fix for this would be to just import from 'react-native-vector-icons` and handle the type dynamically like we are doing for our other components.

If you wanna open an issue on our repo, I can make sure we push a fix for it asap.

@binoy14
Copy link

binoy14 commented Apr 10, 2017

@tgehrs I tried using the SearchBar and Button which do what you are saying but I am not seeing any issue can you maybe provide some code snippet to help us debug it?

@anp
Copy link

anp commented Apr 11, 2017

@tgehrs
Copy link
Author

tgehrs commented Apr 11, 2017

Thanks so much for taking the time to look into this. I went ahead and made a new CRNA app and was unable to reproduce this issue, even when matching the same dependencies and sdkVersion in my project that was having this issue it persists.

@dikaiosune yes I did follow those steps

@binoy14 if you want to take a look i've added you as a collaborator on the repo that is giving me issues

app.json

{
  "expo": {
    "sdkVersion": "14.0.0",
    "packagerOpts": {
      "assetExts": [
        "ttf"
      ]
    }
  }
}

package.json dependencies

  "dependencies": {
    "@expo/ex-navigation": "^2.9.2",
    "@expo/vector-icons": "^4.0.0",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "es6-promise": "^4.1.0",
    "expo": "14.0.2",
    "isomorphic-fetch": "^2.2.1",
    "react": "~15.4.0",
    "react-native": "0.41.2",
    "react-native-elements": "^0.9.7",
    "react-native-svg": "^5.1.6",
    "react-navigation": "^1.0.0-beta.7",
    "react-redux": "^5.0.3",
    "redux": "^3.6.0",
    "redux-thunk": "^2.2.0"
  }

@anp
Copy link

anp commented Apr 11, 2017

@tgehrs one thing that jumps out to me is that your package.json includes react-native-svg, when I believe you want to be using the vendored copy that comes with the SDK: https://docs.expo.io/versions/v14.0.0/sdk/svg.html

@tgehrs
Copy link
Author

tgehrs commented Apr 11, 2017

@dikaiosune thanks for pointing that out (i am very much a novice in this space) uninstalling react-native-svg did not affect the error

@anp
Copy link

anp commented Apr 12, 2017

@tgehrs can you paste the contents of your .babelrc file from your project?

@tgehrs
Copy link
Author

tgehrs commented Apr 12, 2017

@dikaiosune here you go, thanks again for taking time to help with this. I manually changed it to match the project without the exception, then re-installed the node modules but the exception still remains. I will give you access to the repo this is happening in as well. Also I understand if this looks to you like a personal problem issue needs to be closed

project with exception:

{
  "presets": ["react-native-stage-0/decorator-support"],
  "env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]
    }
  }
}

project w/o exception:

{
  "presets": ["babel-preset-expo"],
  "env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]
    }
  }
}

@anp
Copy link

anp commented Apr 12, 2017

Yeah, that'll do it! babel-preset-expo is necessary for things like vector-icons and svg support to work in RN UI libraries. Is there a reason you can't include the decorator preset after the Expo one? I admit I'm not as familiar as I should be with the interactions between multiple babel presets.

@brentvatne
Copy link
Member

brentvatne commented Apr 12, 2017

@dikaiosune - react-native-stage-0/decorator-support is used in babel-preset-expo, but you can also use multiple presets, yeah

@tgehrs
Copy link
Author

tgehrs commented Apr 14, 2017

@dikaiosune @brentvatne woohoo!

so is it just the old version of CRNA that I used did not include that?

@brentvatne
Copy link
Member

@tgehrs - that should have been in the old version too!

the source of babel-preset-expo is:

module.exports = {
  presets: ['babel-preset-react-native-stage-0/decorator-support'],
  plugins: [
    [
      'babel-plugin-module-resolver',
      {
        alias: {
          'react-native-vector-icons': '@expo/vector-icons',
          '@expo/vector-icons/lib/create-icon-set': 'react-native-vector-icons/lib/create-icon-set',
          '@expo/vector-icons/lib/icon-button': 'react-native-vector-icons/lib/icon-button',
          '@expo/vector-icons/lib/create-icon-set-from-fontello': 'react-native-vector-icons/lib/create-icon-set-from-fontello',
          '@expo/vector-icons/lib/create-icon-set-from-icomoon': 'react-native-vector-icons/lib/create-icon-set-from-icomoon',
          '@expo/vector-icons/lib/icon-button': 'react-native-vector-icons/lib/icon-button',
          '@expo/vector-icons/glyphmaps': 'react-native-vector-icons/glyphmaps',
        },
      },
    ],
  ],
};

@tgehrs
Copy link
Author

tgehrs commented Apr 18, 2017

@brentvatne Thanks for getting to the bottom of this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants