MapMarker has no propTypes for native prop 'AIRMapMarker.testID'

405 Views Asked by At

I am using react-native-maps (v-0.16.4) It works fine with ios but MapView.marker is not working on android

the complete error statement is-

MapMarker has no propTypes for native prop 'AIRMapMarker.testID' of native type string. If you have not changed this prop yourself, this usually means that your version of native code and Javascript code are out of sync. Updating both should make this error go away.

this is image for error description

My map file is-

<MapView
           provider={Platform.OS === 'ios' ? PROVIDER_DEFAULT :  PROVIDER_GOOGLE }
            style={{
              left: 0,
              right: 0,
              top: 0,
              bottom: 0,
              position: 'absolute'
            }}
          region={{
            latitude:128.569184,
            longitude: 73.765760,
            latitudeDelta: 0.00942,
            longitudeDelta: 0.0843
          }}
          ref={map => { this.map = map }}
        >
          <MapView.Marker
          map = {this.map}
            coordinate={{
              latitude: 128.568806,
              longitude: 73.765210
            }}
            image={"http://pokeapi.co/media/sprites/pokemon/1.png"}
            title='ETHEL and Friends'
            >
            </MapView.Marker>
        </MapView>

1

There are 1 best solutions below

9
On BEST ANSWER

I checked the docs for MapView.Marker and find out your image prop has a wrong value. You need to set it as a local ImageSource type.

From the docs:

image (ImageSource)

A custom image to be used as the marker's icon. Only local image resources are allowed to be used.

Example

<MapView ref={map => { this.map = map; }}>
  <MapView.Marker
    map={this.map}
    coordinate={{latitude: 128.568806, longitude: 73.765210}}
    image={require('media/sprites/pokemon/1.png')}
    title='ETHEL and Friends'
  >
  </MapView.Marker>
</MapView>