11import { TextStyle , ViewStyle } from 'react-native' ;
22
33import { ButtonColor , ControlSize , Theme } from '../../theme/Theme' ;
4- import { darken } from './changeColor' ;
54
65export interface ButtonColorProps {
76 backgroundColor : string ;
@@ -102,24 +101,24 @@ export const getButtonAppearances = (theme: Theme): ButtonAppearances => {
102101 } ;
103102} ;
104103
105- export interface ButtonStyles {
106- buttonStyle : ViewStyle ;
107- textStyle : TextStyle ;
108- focusColor : string ;
109- innerButtonWrapperStyle : ViewStyle ;
110- buttonContentWrapperStyle : ViewStyle ;
111- }
112-
113104export interface ButtonStylesProps {
114105 appearance : ButtonAppearance ;
115106 color : ButtonColor ;
116107 size : ControlSize ;
117108 isDisabled : boolean ;
118109 isLoading : boolean ;
119110 isInline : boolean ;
120- iconBefore ?: any ;
121- iconAfter ?: any ;
111+ hasIconAfter ?: boolean ;
112+ hasIconBefore ?: boolean ;
122113}
114+
115+ export interface ButtonStyles {
116+ buttonStyle : ViewStyle ;
117+ textStyle : TextStyle ;
118+ innerButtonWrapperStyle : ViewStyle ;
119+ buttonContentWrapperStyle : ViewStyle ;
120+ }
121+
123122export type GetButtonStyles = (
124123 buttonStylesProps : ButtonStylesProps ,
125124 theme : Theme ,
@@ -133,8 +132,8 @@ export const getButtonStyles: GetButtonStyles = (buttonStyleProps, theme) => {
133132 isDisabled,
134133 isLoading,
135134 isInline,
136- iconBefore ,
137- iconAfter ,
135+ hasIconAfter ,
136+ hasIconBefore ,
138137 } = buttonStyleProps ;
139138
140139 const buttonAppearances = getButtonAppearances ( theme ) ;
@@ -167,10 +166,6 @@ export const getButtonStyles: GetButtonStyles = (buttonStyleProps, theme) => {
167166 }
168167 : { } ) ,
169168 } ,
170- focusColor :
171- appearance === 'minimal' || appearance === 'outline'
172- ? theme . colors . button . default
173- : darken ( buttonStyle . backgroundColor , 0.05 ) ,
174169 textStyle : {
175170 alignItems : 'center' ,
176171 color : isDisabled ? theme . colors . text . muted : textColor ,
@@ -188,8 +183,8 @@ export const getButtonStyles: GetButtonStyles = (buttonStyleProps, theme) => {
188183 } ,
189184
190185 buttonContentWrapperStyle : {
191- paddingLeft : iconBefore ? 8 : 0 ,
192- paddingRight : iconAfter ? 8 : 0 ,
186+ paddingLeft : hasIconBefore ? 8 : 0 ,
187+ paddingRight : hasIconAfter ? 8 : 0 ,
193188 } ,
194189 } ;
195190} ;
0 commit comments