tiaanduplessis / react-native-google-maps-directions Goto Github PK
View Code? Open in Web Editor NEW๐ Get direction using Google Maps in React Native ๐
License: MIT License
๐ Get direction using Google Maps in React Native ๐
License: MIT License
I have the latest google maps app installed on iOS (10.3.1)
When using this it still opens the maps link in safari
How i identify in my app that user is reached his destination ? Any callback?
I have a requirement that on loading the google map application, have to automatically start the navigation.
Current scenario - It shows the route but user has to click on start
to start navigation
I couldn't find any flag associated for the same?
Any idea how could we approach the problem?
In case Google Maps is not installed, it should open Apple Maps
Hi,
Firstly thank you for this great package.
Is it possible for you to add support for multiple waypoints and optimize option?
Would it be feasible to allow for empty source so Google Maps opens with the destination pre-filled and let the user specify the source directly in Google Maps?
RN version: 0.60
Package version: 2.1.1
This is the data I supplay to getDirections method:
const data = { source: { latitude: Number(checkpoints[0].address.lat), longitude: Number(checkpoints[0].address.lng), }, destination: { latitude: Number(checkpoints[numOfCheckpoints - 1].address.lat), longitude: Number(checkpoints[numOfCheckpoints - 1].address.lng), }, params: [ { key: 'travelmode', value: 'driving', // may be "walking", "bicycling" or "transit" as well }, { key: 'dir_action', value: 'navigate', // this instantly initializes navigation using the given travel mode }, ], waypoints: [ { latitude: 39.810355, longitude: -86.135126 }, { latitude: 40.810355, longitude: -86.135126 }, ], }
I'm getting error inside maps: Google maps can't open this link.
When I use only one waypoint it works fine though.
I have my url in log:
'https://www.google.com/maps/dir/?api=1&travelmode=driving&dir_action=navigate&destination=39.881652%2C-83.057822&origin=41.925685%2C-88.122813&waypoints=39.810355,-86.135126|40.810355,-86.135126'
Nice package!
Is there plans to add a @types package for this to stop TS complaining when it's used?
I have installed react-native-google-map-directions version 2.1.1.
I added the following lines in the AndroidManifest.xml file
my code is:
const openMap=(item)=>{
let data={
destination:{
latitude:item.latitude,
longitude:item.longitude
},
params:[{
key:"travelmode",
value:"driving"
}],
waypoints:[]
}
getDirections(data)
}
let renderRandomMarkers=locations.map((item,key)=>(
<Marker key={key} image={require('../assets/image/pin.png')} coordinate={{longitude:item.longitude,latitude:item.latitude}}>
<Callout onPress={()=>openMap(item)}>
<View style={{flexDirection:'row'}}>
<Text>Location :</Text>
<Text>{item.latitude + ',' + item.longitude}</Text>
</View>
</Callout>
</Marker>
))
when click the callout maps is opened, but it showing like this
Pls help me
Hi @tiaanduplessis is see there's a duplicate code in the index file (see attachment). I needed to know what its use is, and if it's an oversight, I am able to do a PR to fix it.
everything was work on expo but in react native I get an possible Unhandled Promise Rejection (id: 0):
Error: Could not open the url: https://www.google.com/maps/dir/?api=1&travelmode=driving&dir_action=navigate&destination=*%2C2*
what should ฤฑ do?
I'm trying to set latitude and longitude destination from a value that I had. But it return blank when open up in google maps.
handleGetDirections = (latitude, longitude) => {
const data = {
source: {
latitude: -8.627666,
longitude: 115.239225
},
destination: {
latitude: latitude,
longitude: longitude
},
params: [
{
key: "dirflg",
value: "c"
}
]
};
getDirections(data);
}
So how I can set a custom latitude and longitude value ?
Thank you.
handleGetDirections = () => {
const data = {
source: {
latitude: 19.295296,
longitude: -81.382111
},
destination: {
latitude:this.props.customer.latitude,
longitude: this.props.customer.longitude
},
params: [
{
key: "dirflg",
value: "w"
}
]
}
getDirections(data)
}
it is showing the error of Possible Unhandled Promise Rejection (id: 0):
Error: Invalid arguments provided
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.