@@ -10,30 +10,34 @@ import {
1010 ACTIVE_INDICATOR_SIZE ,
1111 INACTIVE_INDICATOR_SIZE ,
1212 INPUT_FONT_SIZE ,
13- MULTILINE_PADDING_TOP ,
1413 isWeb ,
14+ MULTILINE_PADDING_TOP ,
1515} from '../constants' ;
16+ import {
17+ $disabledStyle ,
18+ $helperStyle ,
19+ $inputStyle ,
20+ $leadingAccessoryStyle ,
21+ $trailingAccessoryStyle ,
22+ } from '../styles' ;
1623import type { TextFieldProps , TextFieldSharedApi } from '../TextField' ;
17- import { getLabelColor } from '../utils' ;
24+ import {
25+ getFieldBackgroundColor ,
26+ getHelperColor ,
27+ getLabelColor ,
28+ } from '../utils' ;
1829import {
1930 LABEL_LEFT_OFFSET_WITH_ACCESSORY ,
2031 LABEL_LEFT_OFFSET_WITHOUT_ACCESSORY ,
2132} from './constants' ;
2233import {
23- $fieldStyle ,
2434 $containerStyle ,
25- $labelWrapperStyle ,
35+ $fieldStyle ,
2636 $labelTextStyle ,
37+ $labelWrapperStyle ,
2738 $outlineStyle ,
2839} from './styles' ;
2940import { getOutlineColor } from './utils' ;
30- import {
31- $disabledStyle ,
32- $helperStyle ,
33- $inputStyle ,
34- $leadingAccessoryStyle ,
35- $trailingAccessoryStyle ,
36- } from '../styles' ;
3741
3842export const getFilledTextFieldData = (
3943 api : TextFieldSharedApi ,
@@ -70,27 +74,27 @@ export const getFilledTextFieldData = (
7074 // =======================
7175
7276 const {
73- colors : {
74- error : errorColor ,
75- onSurface,
76- onSurfaceVariant,
77- surfaceVariant,
78- surfaceContainerHighest,
79- } ,
77+ colors : { onSurface } ,
8078 } = theme ;
8179
8280 const labelColor = getLabelColor ( {
8381 theme,
8482 status : props . status ,
8583 isFocused,
84+ disabled,
8685 } ) ;
8786
8887 const outlineColor = getOutlineColor ( {
8988 theme,
9089 status : props . status ,
9190 isFocused,
91+ disabled,
9292 } ) ;
9393
94+ const fieldBackgroundColor = getFieldBackgroundColor ( { theme, disabled } ) ;
95+
96+ const helperColor = getHelperColor ( { theme, status : props . status , disabled } ) ;
97+
9498 // =======================
9599 // STYLES
96100 // =======================
@@ -115,15 +119,15 @@ export const getFilledTextFieldData = (
115119 color : labelColor ,
116120 } ,
117121 $animatedLabelTextStyle ,
122+ disabled && $disabledStyle ,
118123 labelProps ?. style ,
119124 ] ;
120125
121126 const $fieldStyles = [
122127 $fieldStyle ,
123128 {
124- backgroundColor : disabled ? surfaceContainerHighest : surfaceVariant ,
129+ backgroundColor : fieldBackgroundColor ,
125130 } ,
126- disabled && $disabledStyle ,
127131 $fieldStyleOverride ,
128132 ] ;
129133
@@ -140,7 +144,7 @@ export const getFilledTextFieldData = (
140144 const $helperStyles : StyleProp < TextStyle > = [
141145 $helperStyle ,
142146 {
143- color : hasError ? errorColor : onSurfaceVariant ,
147+ color : helperColor ,
144148 writingDirection : isRTL ? 'rtl' : 'ltr' ,
145149 } ,
146150 disabled && $disabledStyle ,
@@ -162,9 +166,20 @@ export const getFilledTextFieldData = (
162166 isWeb && {
163167 outlineStyle : 'none' as TextStyle [ 'outlineStyle' ] ,
164168 } ,
169+ disabled && $disabledStyle ,
165170 $inputStyleOverride ,
166171 ] ;
167172
173+ const $leadingAccessoryStyles = [
174+ $leadingAccessoryStyle ,
175+ disabled && $disabledStyle ,
176+ ] ;
177+
178+ const $trailingAccessoryStyles = [
179+ $trailingAccessoryStyle ,
180+ disabled && $disabledStyle ,
181+ ] ;
182+
168183 return {
169184 input,
170185 disabled,
@@ -176,7 +191,7 @@ export const getFilledTextFieldData = (
176191 $containerStyles,
177192 $helperStyles,
178193 $inputStyles,
179- $leadingAccessoryStyles : $leadingAccessoryStyle ,
180- $trailingAccessoryStyles : $trailingAccessoryStyle ,
194+ $leadingAccessoryStyles,
195+ $trailingAccessoryStyles,
181196 } ;
182197} ;
0 commit comments