react-native-maps-directions: Cannot read property 'map' of undefined

When I take out the origin property of the Directions component, it runs with no errors but doesn’t show the direction. When I put it, for obvious reasons, I get this error.

return (
    <View style={{flex: 1}}>
      <MapView
        style={{flex: 1}}
        region={region}
        showsUserLocation
        loadingEnabled>
        <MapView.Marker coordinate={region} />
        <MapView.Marker
          coordinate={{latitude: -9.645601, longitude: -35.734108}}
        />
        <MapViewDirections
          origin={{latitude: -9.64561693, longitude: -35.73592044}}
          destination={{latitude: -9.645601, longitude: -35.734108}}
          apikey={'AIzaSyBVFhY3cURPTbAoOnkyAeijkAt2kqRJ2iY'}
          strokeWidth={3}
          strokeColor="#333"
        />
      </MapView>
    </View>
  );
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (3 by maintainers)

Commits related to this issue

Most upvoted comments

@carlossuds @jdbaculard you have used version 1.7.3 or less but this package update recently just simply do one thing go to package.json and change “react-native-maps-directions”: “^1.7.3”, to “react-native-maps-directions”: “1.7.3”, after this run npm install or yarn install just stick on the version your already use do not change if it is not necessary

"react-native-maps": "0.26.1",
"react-native-maps-directions": "^1.7.0",

it works for me now ! Thanks