Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined #4332
-
SummaryElement type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined Reproducible sample codeimport MapView, {PROVIDER_GOOGLE} from 'react-native-maps'; Steps to reproduceopen screen in whic using app got app crash with error Expected resultmap load successfully Actual resultError: 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. React Native Maps Version1.0.0 What platforms are you seeing the problem on?Android, iOS (Google Maps) React Native Version0.68.2 What version of Expo are you using?Not using Expo Device(s)iphone 12,android 11 Additional informationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
Hi @ravin-amplework 👋. You will have to provide more than your import statements as Reproducible sample code for anyone to be able to track this down :) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
New renderer is also enable on main App.js fileimport { enableLatestRenderer } from 'react-native-maps'; enableLatestRenderer(); |
Beta Was this translation helpful? Give feedback.
-
Can you provide a repo or snack that experiences this? |
Beta Was this translation helpful? Give feedback.
-
Hi @ravin-amplework. I think I might have figured out the issue. Marker is no longer a member of MapView, so you can't use import React from 'react';
import MapView, {Marker, PROVIDER_GOOGLE} from 'react-native-maps';
const App = () => {
return (
<MapView
provider={PROVIDER_GOOGLE}
region={{
latitude: 26.891026,
longitude: 75.793822,
latitudeDelta: 0.015,
longitudeDelta: 0.0121,
}}>
<Marker
coordinate={{
latitude: 26.891026,
longitude: 75.793822,
}}
title={'test'}
/>
</MapView>
);
};
export default App; This was part of the breaking changes made in |
Beta Was this translation helpful? Give feedback.
Hi @ravin-amplework. I think I might have figured out the issue. Marker is no longer a member of MapView, so you can't use
<MapView.Marker>
. Instead, import the Marker component and use it like so: