-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuberLink.js
26 lines (25 loc) · 1.04 KB
/
uberLink.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import AppLink from 'react-native-app-link';
export default class uberLink {
constructor(marker) {
this.marker = marker;
this.appName = "Uber";
this.appStoreId = '368677368';
this.appStoreLocale = 'us';
this.playStoreId = 'com.ubercab';
}
openUber() {
console.log(this.marker);
let appName = this.appName;
let appStoreId = this.appStoreId;
let appStoreLocale = this.appStoreLocale;
let playStoreId = this.playStoreId;
let address = this.marker.location.address;
let latitude = this.marker.coordinate.latitude;
let longitude = this.marker.coordinate.longitude;
AppLink.maybeOpenURL(
"uber://?action=setPickup&client_id=Ph99lrMcQyQiLj6rnjQjOYfX28KyKMy6&pickup=my_location&dropoff[formatted_address]="+ address +"&dropoff[latitude]=" + latitude + "&dropoff[longitude]="+ longitude
, { appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
console.log("redirected");
})
}
}