1import React from 'react'; 2import {StyleSheet, TextProps} from 'react-native'; 3import {fontSizeConst, fontWeightConst} from '@/constants/uiConst'; 4import {TouchableOpacity} from 'react-native-gesture-handler'; 5import openUrl from '@/utils/openUrl'; 6import ThemeText from './themeText'; 7 8type ILinkTextProps = TextProps & { 9 fontSize?: keyof typeof fontSizeConst; 10 fontWeight?: keyof typeof fontWeightConst; 11 linkTo?: string; 12}; 13 14export default function LinkText(props: ILinkTextProps) { 15 return ( 16 <TouchableOpacity 17 onPress={() => { 18 props?.linkTo && openUrl(props.linkTo); 19 }}> 20 <ThemeText {...props} style={style.linkText}> 21 {props.children} 22 </ThemeText> 23 </TouchableOpacity> 24 ); 25} 26 27const style = StyleSheet.create({ 28 linkText: { 29 color: '#66ccff', 30 textDecorationLine: 'underline', 31 }, 32}); 33