diff options
Diffstat (limited to 'src/utils/common.ts')
-rw-r--r-- | src/utils/common.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts index 9e74ca33..ae83ad9c 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -1,4 +1,5 @@ -import {TOGGLE_BUTTON_TYPE} from '../constants'; +import {Linking} from 'react-native'; +import {BROWSABLE_SOCIAL_URLS, TOGGLE_BUTTON_TYPE} from '../constants'; export const getToggleButtonText: ( button_type: string, @@ -13,3 +14,12 @@ export const getToggleButtonText: ( return null; } }; + +export const handleOpenSocialUrlOnBrowser = ( + handle: string | undefined, + social: string, +) => { + if (handle && social in BROWSABLE_SOCIAL_URLS) { + Linking.openURL(BROWSABLE_SOCIAL_URLS[social] + `${handle}/`); + } +}; |