Flama
Flama

Reputation: 868

'Invariant Violation: View Config not found for name path' when using Material Icon

I'm trying to add a material UI icon to my iOS app. I simply added the line that says

   <SettingsIcon/> 

and that makes my app crash with the message 'Invariant Violation: View config not found for name path.'.

What am I doing wrong?

import React from 'react';
import { FlatList, ScrollView, TouchableOpacity, StyleSheet, Text, View, Button, Alert, TextInput, TouchableHighlight, Modal, App, Image} from 'react-native';
import SwitchSelector from 'react-native-switch-selector';
import SettingsIcon from '@material-ui/icons/Settings';

export default class ProfileScreen extends React.Component {

  render() {

    return (
      <ScrollView contentContainerStyle={styles.container}>
        <SettingsIcon/>
         <View style={{marginTop: 45, alignItems: "center"}}>
            <View style={styles.avatarContainer}>
                <Image style={styles.avatar}
                source={require('../../../assets/logo.png')}/>
            </View>
            <Text style={styles.name}> Juan Gómez </Text>
         </View>   
         <View style={styles.statsContainer}>
            <View style={styles.stat}> 
              <Text style={styles.statAmount}> 21 </Text>
              <Text style={styles.statTitle}> Entregas en curso </Text> 
            </View>
            <View style={styles.stat}> 
              <Text style={styles.statAmount}> 88 </Text>
              <Text style={styles.statTitle}> Donaciones en curso </Text> 
            </View>
         </View>
         <SwitchSelector 
         buttonColor="#013773"
         fontSize={16}
         hasPadding
         style={{ transform: [{ scaleX: .95 }, { scaleY: .95 }] }}
         options={options} 
         initial={0} 
         onPress={value => console.log(`Call onPress with value: ${value}`)} />
      </ScrollView>
    );
  }
}

Upvotes: 0

Views: 74

Answers (1)

sbqq
sbqq

Reputation: 1111

MaterialUI package is not going to work in react-native as it is build to run in a browser.

For Material icons in React Native please take a look at react-native-vector-icons package.

Upvotes: 1

Related Questions