mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 09:54:55 -06:00
place detail open in maps linking to geo app
This commit is contained in:
parent
5e0b6ccb5e
commit
03158e3c44
1 changed files with 17 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// @flow
|
||||
import React, { Component } from 'react';
|
||||
import { View, Image, ScrollView } from 'react-native';
|
||||
import { View, Image, ScrollView, Linking } from 'react-native';
|
||||
import theme from '../ui-theme';
|
||||
import { compose, pure } from 'recompose';
|
||||
import typeof PlaceRecord from '../records/PlaceRecord';
|
||||
|
|
@ -51,8 +51,22 @@ export class PlaceDetail extends Component {
|
|||
isFavorite: !prevState.isFavorite,
|
||||
}));
|
||||
|
||||
// todo - build a map view and open it here
|
||||
viewOnMap = () => {};
|
||||
viewOnMap = () => {
|
||||
const { place } = this.props;
|
||||
if (!place) {
|
||||
return;
|
||||
}
|
||||
const { latitude, longitude } = place;
|
||||
const url = `geo:${latitude}, ${longitude}`;
|
||||
|
||||
Linking.canOpenURL(url)
|
||||
.then(supported => {
|
||||
if (supported) {
|
||||
return Linking.openURL(url);
|
||||
}
|
||||
})
|
||||
.catch(err => console.error('Failed to open geo URL', err)); // eslint-disable-line
|
||||
};
|
||||
|
||||
// todo: need to get the item from the stream by this id
|
||||
render() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue