import {Linking} from 'react-native'; import {BROWSABLE_SOCIAL_URLS, TOGGLE_BUTTON_TYPE} from '../constants'; export const getToggleButtonText: ( button_type: string, state: boolean, ) => string | null = (button_type, state) => { switch (button_type) { case TOGGLE_BUTTON_TYPE.FOLLOW_UNFOLLOW: return state ? 'Unfollow' : 'Follow'; case TOGGLE_BUTTON_TYPE.BLOCK_UNBLOCK: return state ? 'Unblock' : 'Block'; default: return null; } }; export const handleOpenSocialUrlOnBrowser = ( handle: string | undefined, social: string, ) => { if (handle && social in BROWSABLE_SOCIAL_URLS) { Linking.openURL(BROWSABLE_SOCIAL_URLS[social] + `${handle}/`); } };