Skip to content

Commit

Permalink
Merge pull request #1398 from flaviomoceri/bug-linksProfile
Browse files Browse the repository at this point in the history
fix(profile): #1397 fix links not opening in app
  • Loading branch information
flaviomoceri authored Dec 5, 2023
2 parents 8e67e5d + bd29a03 commit a9b0db7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/ProfileLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
StyleProp,
StyleSheet,
ViewStyle,
Linking,
} from 'react-native';
import { useTranslation } from 'react-i18next';

import { Caption13Up, Text02M, Text02S } from '../styles/text';
import { TrashIcon } from '../styles/icons';
import { LocalLink } from '../store/types/slashtags';
import { openURL } from '../utils/helpers';
import { editLink, removeLink } from '../store/actions/slashtags';
import LabeledInput from './LabeledInput';
import Divider from './Divider';
Expand All @@ -33,6 +33,14 @@ const trimLink = (link: LocalLink): string => {
return trimmedUrl.replace('https://', '').replace('www.', '');
};

const openURL = async (url: string): Promise<void> => {
try {
await Linking.openURL(url);
} catch (err) {
console.log('Cannot open url: ', url);
}
};

const ProfileLinks = ({
links,
editable = false,
Expand Down

0 comments on commit a9b0db7

Please sign in to comment.