Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Element type is invalid: expect a string

I’m trying to use an AppBar from React Native Material. The icon i use in the IconButton is from react-native-vector-icon. I have no idea why I’m getting error saying Element type is invalid: expect a string. Check the render method for IconButton as I literally copied the exact code from the React Native Material official doc.

import {AppBar, IconButton} from '@react-native-material/core';
import {Icon} from 'react-native-vector-icons/Entypo';

      <AppBar
        title="Title"
        leading={props => (
          <IconButton
            icon={props => <Icon name="menu" {...props} />}
            {...props}
          />
        )}
      />

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

==> Try My Code it works.

import {AppBar, IconButton} from '@react-native-material/core';
import Icon from 'react-native-vector-icons/Entypo';

      <AppBar
        title="Title"
        leading={props => (
          <IconButton
            icon={props => <Icon name="menu" {...props} />}
            {...props}
          />
        )}
      />
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading