Cannot read property 'map' of undefined
See original GitHub issueWhen 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:
- Created 4 years ago
- Reactions:1
- Comments:15 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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
it works for me now ! Thanks