Skip to content

Instantly share code, notes, and snippets.

@HakamRaza
Created July 6, 2021 07:28
Show Gist options
  • Save HakamRaza/f498743be56e69e687048254ac9529e4 to your computer and use it in GitHub Desktop.
Save HakamRaza/f498743be56e69e687048254ac9529e4 to your computer and use it in GitHub Desktop.
RN - Open map Option
import { Linking, Platform } from 'react-native';
function _openMapLocationByAddress(){
const url = Platform.select({
ios: `maps:0,0?q=${address_string}`,
android: `geo:0,0?q=${address_string}`,
})
Linking.openURL(url as string)
}
function _openMapLocationByCoordinate(){
const url = Platform.select({
ios: `maps:0,0?q=${name_string}@${latitude_number},${longitude_number}`,
android: `geo:0,0?q=${latitude_number},${longitude_number}(${name_string})`
});
Linking.openURL(url as string)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment