Templarian / MaterialDesign-React

Dist for Material Design Icons React Component for JS/TypeScript
https://materialdesignicons.com
MIT License
142 stars 20 forks source link

Invariant Violation #35

Closed ftKnox closed 4 years ago

ftKnox commented 4 years ago

Hi, I am getting this error. I am not sure what I am missing. This was tested in the default react native template.

versions used: react-native@0.61.5 @mdi/react@1.2.1 @mdi/js@4.8.95

Screen Shot 2020-02-03 at 12 11 52 PM
import React from 'react';
import {SafeAreaView, StyleSheet, StatusBar} from 'react-native';

import {Colors} from 'react-native/Libraries/NewAppScreen';

import Icon from '@mdi/react';
import {mdiAccount} from '@mdi/js';

const App: () => React$Node = () => {
  return (
    <>
      <StatusBar barStyle="dark-content" />
      <SafeAreaView>
        <Icon
          path={mdiAccount}
          size={1}
          horizontal
          vertical
          rotate={90}
          color="red"
        />
      </SafeAreaView>
    </>
  );
};
Templarian commented 4 years ago

Not really sure as I've never used react native myself (but I'm assuming others have used this in React Native). All of the component names are capital, so error doesn't quite make sense.

Unfortunately I don't have an answer. Try googling around and seeing if it's something configured wrong maybe?

ftKnox commented 4 years ago

Yeah I am messing with the casing right now. I will update if it yields anything.

ftKnox commented 4 years ago

Sorry, I for some reason thought this as a react native module. Your Icon.js exports html, thats why this doesn't work in react native.

Templarian commented 4 years ago

Perfect. Yeah, there is probably a react native version of this component floating around by now. Probably should look into making a first party adaption eventually. Just not something I've worked with yet.

Do let me know what solution you go with.

ftKnox commented 4 years ago

Looks like this is the goto for react native: https://github.com/oblador/react-native-vector-icons

Templarian commented 4 years ago

@ftKnox Oh yeah, I think they use the font. Which isn't really a good idea as our font is large and growing every day. Hopefully there is a nice vector solution out there somewhere that uses @mdi/js.

Templarian commented 4 years ago

It actually looks like it would be fairly easy to convert this to a @mdi/react-native package if I used:

https://www.npmjs.com/package/react-native-svg

I'll create an issue in the main repo to track this.

Templarian commented 4 years ago

https://github.com/Templarian/MaterialDesign/issues/4837