question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'map' of undefined

See original GitHub issue

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>
  );
}

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
ArbazYousufcommented, Mar 14, 2020

@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

1reaction
jdbaculardcommented, Mar 15, 2020
"react-native-maps": "0.26.1",
"react-native-maps-directions": "^1.7.0",

it works for me now ! Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error : Cannot read property 'map' of undefined - Stack Overflow
The error Cannot read property 'map' of undefined' is thrown when the map function in the CommentList component is executed.
Read more >
How to Prevent the TypeError: Cannot Read Property Map of ...
As a result, the TypeError Cannot read property 'map' of undefined is very common and one of the first errors that developers will...
Read more >
Fix the "Cannot read property 'map' of undefined" Error in React
The variable you are trying to map over is undefined . It will probably eventually be an array, but due to the asynchronous...
Read more >
Cannot read properties of undefined (reading 'map') in React
The "TypeError: Cannot read properties of undefined (reading 'map')" occurs when we call the map() method on an undefined value, most often when...
Read more >
React - Cannot read property 'map' of undefined - debuggr.io
#2 Conditional rendering​​ Another possible solution is to conditionally render the items , meaning if we have the items then render them, else ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found