Created
July 6, 2021 07:28
-
-
Save HakamRaza/f498743be56e69e687048254ac9529e4 to your computer and use it in GitHub Desktop.
RN - Open map Option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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