Last Updated on October 23, 2019.
While I was working on a react native project, I suddenly came across this particular react native error. Here’s the full error:
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it’s defined in, or you might have mixed up default and named imports.
Here’s the ‘red’ error screen I got.
As mentioned in the error description, this error is related to some faulty imports or exports on your screen. There are some solutions for this react native error in this github issue. In my case, it was a typo, a spelling mistake. I imported FlatList component from react native as Flatlist instead of FlatList. Correcting the spelling mistake fixed this issue for me.
So, when you face this kind of react native, make sure there’s no errors in imports and exports.