diff --git a/packages/react/components/link/Link.native.tsx b/packages/react/components/link/Link.native.tsx index c777744c..6037e308 100644 --- a/packages/react/components/link/Link.native.tsx +++ b/packages/react/components/link/Link.native.tsx @@ -10,6 +10,7 @@ import { ComponentName } from "../enumsComponentsName" /** * Link Component + * @param plain {boolean} Link without underline * @param to {string} Url to open * @param title {string} Title attribute * @param typo {TypographyAlign} Typos align link @@ -33,10 +34,9 @@ const Link = ({ level, iconName, inverted, + style, ...others }: LinkProps): JSX.Element => { - const [underlineWidth, setUnderlineWidth] = React.useState(0); - const linkLevels = (level: TextLevels) => { return ( (level && level == "ONE" && 16) || @@ -110,7 +110,9 @@ const Link = ({ (inverted && getColorStyle(TrilogyColor.BACKGROUND)) || getColorStyle(TrilogyColor.MAIN), fontSize: inline && level ? linkLevels(level) : 14, - lineHeight: inline && level ? linkLevels(level) * 1.5 : 14 + lineHeight: inline && level ? linkLevels(level) * 1.5 : 14, + textDecorationStyle: "solid", + textDecorationLine: "underline", }, androidLink: { color: @@ -118,7 +120,9 @@ const Link = ({ getColorStyle(TrilogyColor.MAIN), fontSize: inline && level ? linkLevels(level) : 14, lineHeight: inline && level ? linkLevels(level) * 1.5 : 14, - height: inline && level ? getHeightLinkAndroid(level) : "auto" + height: inline && level ? getHeightLinkAndroid(level) : "auto", + textDecorationStyle: "solid", + textDecorationLine: "underline", }, iconView: { flexDirection: "row", @@ -143,90 +147,72 @@ const Link = ({ : "NotSpecified" return ( - - - {children && typeof children.valueOf() === "string" ? ( - { - if (to) { - Linking.openURL(to || "") - } - if (onClick) { - onClick(e) - } - }} - > - {iconName ? ( - - { - const { width } = event.nativeEvent.layout; - setUnderlineWidth(width); - }} - accessibilityLabel={title || ""} - style={styles.link} - {...others} - > - {children} - - - - - ) : ( + + {children && typeof children.valueOf() === "string" ? ( + { + if (to) { + Linking.openURL(to || "") + } + if (onClick) { + onClick(e) + } + }} + > + {iconName ? ( + { - const { width } = event.nativeEvent.layout; - setUnderlineWidth(width); - }} accessibilityLabel={title || ""} - style={ - Platform.OS === "android" ? styles.androidLink : styles.link - } + style={[styles.link, style]} {...others} > {children} - )} - - ) : ( - { - if (to) { - Linking.openURL(to || "") - } - if (onClick) { - onClick(e) + + + + ) : ( + - {children} - - )} - - + {...others} + > + {children} + + )} + + ) : ( + { + if (to) { + Linking.openURL(to || "") + } + if (onClick) { + onClick(e) + } + }} + > + {children} + + )} ) } diff --git a/packages/react/components/link/LinkProps.ts b/packages/react/components/link/LinkProps.ts index 402e680e..5049a623 100644 --- a/packages/react/components/link/LinkProps.ts +++ b/packages/react/components/link/LinkProps.ts @@ -2,6 +2,7 @@ import { Accessibility, Clickable } from '../../objects/facets' import { TypographyAlign, TypographyAlignValues } from '../../objects/Typography/TypographyAlign' import { IconName, IconNameValues } from '../icon' import { TextLevels } from '../text' +import { Styles } from "../../types"; /** * Link Interface @@ -21,4 +22,5 @@ export interface LinkProps extends Accessibility, Clickable { inverted?: boolean plain?: boolean blank?: boolean + style?: Styles } diff --git a/packages/react/components/price/PriceProps.ts b/packages/react/components/price/PriceProps.ts index 7d1c6368..6d48e96b 100644 --- a/packages/react/components/price/PriceProps.ts +++ b/packages/react/components/price/PriceProps.ts @@ -1,9 +1,7 @@ import { PriceLevel, PriceLevelValues } from "./PriceEnum" import { Invertable } from "../../objects/facets/Invertable" import { Accessibility, AlertProps, AlignableProps } from "../../objects" - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -type Styles = { [key: string]: any } +import { Styles } from "../../types"; /** * Price Interface diff --git a/packages/react/types/index.ts b/packages/react/types/index.ts new file mode 100644 index 00000000..b0dc704f --- /dev/null +++ b/packages/react/types/index.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type Styles = { [key: string]: any }