@@ -63,9 +63,13 @@ class Button extends PureComponent<Props, ButtonState> {
6363 return Boolean ( outline || outlineColor ) ;
6464 }
6565
66+ get isLink ( ) {
67+ const { link, hyperlink} = this . props ;
68+ return link || hyperlink ;
69+ }
70+
6671 get isFilled ( ) {
67- const { link} = this . props ;
68- return ! this . isOutline && ! link ;
72+ return ! this . isOutline && ! this . isLink ;
6973 }
7074
7175 get isIconButton ( ) {
@@ -75,10 +79,10 @@ class Button extends PureComponent<Props, ButtonState> {
7579
7680 getBackgroundColor ( ) {
7781 const { backgroundColor : themeBackgroundColor , modifiers} = this . props ;
78- const { disabled, outline, link , disabledBackgroundColor, backgroundColor : propsBackgroundColor } = this . props ;
82+ const { disabled, outline, disabledBackgroundColor, backgroundColor : propsBackgroundColor } = this . props ;
7983 const { backgroundColor : stateBackgroundColor } = modifiers ;
8084
81- if ( ! outline && ! link ) {
85+ if ( ! outline && ! this . isLink ) {
8286 if ( disabled ) {
8387 return disabledBackgroundColor || DISABLED_COLOR ;
8488 }
@@ -97,18 +101,19 @@ class Button extends PureComponent<Props, ButtonState> {
97101 }
98102
99103 getLabelColor ( ) {
100- const { link, linkColor, outline, outlineColor, disabled, color : propsColor } = this . props ;
104+ const { linkColor, outline, outlineColor, disabled, color : propsColor } = this . props ;
105+ const isLink = this . isLink ;
101106
102107 let color : string | undefined = Colors . white ;
103- if ( link ) {
108+ if ( isLink ) {
104109 color = linkColor || Colors . primary ;
105110 } else if ( outline ) {
106111 color = outlineColor || Colors . primary ;
107112 } else if ( this . isIconButton ) {
108113 color = undefined ; // Colors.grey10;
109114 }
110115
111- if ( disabled && ( link || outline ) ) {
116+ if ( disabled && ( isLink || outline ) ) {
112117 return DISABLED_COLOR ;
113118 }
114119
@@ -130,7 +135,7 @@ class Button extends PureComponent<Props, ButtonState> {
130135 }
131136
132137 getContainerSizeStyle ( ) {
133- const { outline, link , avoidMinWidth, avoidInnerPadding, round} = this . props ;
138+ const { outline, avoidMinWidth, avoidInnerPadding, round} = this . props ;
134139 const size = this . props . size || DEFAULT_SIZE ;
135140 const outlineWidth = this . props . outlineWidth || 1 ;
136141
@@ -177,7 +182,7 @@ class Button extends PureComponent<Props, ButtonState> {
177182
178183 const containerSizeStyle = CONTAINER_STYLE_BY_SIZE [ size ] ;
179184
180- if ( link || ( this . isIconButton && ! round ) ) {
185+ if ( this . isLink || ( this . isIconButton && ! round ) ) {
181186 containerSizeStyle . paddingVertical = undefined ;
182187 containerSizeStyle . paddingHorizontal = undefined ;
183188 containerSizeStyle . minWidth = undefined ;
@@ -196,10 +201,10 @@ class Button extends PureComponent<Props, ButtonState> {
196201 }
197202
198203 getOutlineStyle ( ) {
199- const { outline, outlineColor, outlineWidth, link , disabled} = this . props ;
204+ const { outline, outlineColor, outlineWidth, disabled} = this . props ;
200205
201206 let outlineStyle ;
202- if ( ( outline || outlineColor ) && ! link ) {
207+ if ( ( outline || outlineColor ) && ! this . isLink ) {
203208 outlineStyle = {
204209 borderWidth : outlineWidth || 1 ,
205210 borderColor : outlineColor || Colors . primary
@@ -213,9 +218,9 @@ class Button extends PureComponent<Props, ButtonState> {
213218 }
214219
215220 getBorderRadiusStyle ( ) {
216- const { link , fullWidth, borderRadius : borderRadiusFromProps , modifiers} = this . props ;
221+ const { fullWidth, borderRadius : borderRadiusFromProps , modifiers} = this . props ;
217222
218- if ( link || fullWidth || borderRadiusFromProps === 0 ) {
223+ if ( this . isLink || fullWidth || borderRadiusFromProps === 0 ) {
219224 return { borderRadius : 0 } ;
220225 }
221226
@@ -290,7 +295,7 @@ class Button extends PureComponent<Props, ButtonState> {
290295 }
291296
292297 renderLabel ( ) {
293- const { label, labelStyle, labelProps} = this . props ;
298+ const { label, labelStyle, labelProps, hyperlink } = this . props ;
294299 const typography = extractTypographyValue ( this . props ) ;
295300 const color = this . getLabelColor ( ) ;
296301 const labelSizeStyle = this . getLabelSizeStyle ( ) ;
@@ -299,6 +304,7 @@ class Button extends PureComponent<Props, ButtonState> {
299304 return (
300305 < Text
301306 style = { [ this . styles . text , ! ! color && { color} , labelSizeStyle , { ...typography } , labelStyle ] }
307+ underline = { hyperlink }
302308 numberOfLines = { 1 }
303309 { ...labelProps }
304310 >
@@ -310,7 +316,7 @@ class Button extends PureComponent<Props, ButtonState> {
310316 }
311317
312318 render ( ) {
313- const { onPress, disabled, link , style, testID, animateLayout, modifiers, forwardedRef, ...others } = this . props ;
319+ const { onPress, disabled, style, testID, animateLayout, modifiers, forwardedRef, ...others } = this . props ;
314320 const shadowStyle = this . getShadowStyle ( ) ;
315321 const { margins} = modifiers ;
316322 const backgroundColor = this . getBackgroundColor ( ) ;
@@ -326,7 +332,7 @@ class Button extends PureComponent<Props, ButtonState> {
326332 this . styles . container ,
327333 animateLayout && this . getAnimationDirectionStyle ( ) ,
328334 containerSizeStyle ,
329- link && this . styles . innerContainerLink ,
335+ this . isLink && this . styles . innerContainerLink ,
330336 shadowStyle ,
331337 margins ,
332338 backgroundColor && { backgroundColor} ,
0 commit comments