Skip to content

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined #4332

Answered by monholm
ravin-amplework asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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 A…

Replies: 5 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ravin-amplework
Comment options

@ravin-amplework
Comment options

Comment options

You must be logged in to vote
1 reply
@netsmertia
Comment options

Answer selected by monholm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #4319 on July 15, 2022 21:33.