Skip to content

Commit c36dc25

Browse files
authored
Fix Incubator TextField placeholder's disabled color (#2003)
* Fix Incubator TextField placeholder's disabled color * Use existing prop - placeholderTextColor * Fix typo
1 parent f10df1b commit c36dc25

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/incubator/TextField/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import React, {useMemo} from 'react';
99
import {isEmpty, trim, omit} from 'lodash';
1010
import {asBaseComponent, forwardRef} from '../../commons/new';
1111
import View from '../../components/view';
12-
import {Colors} from '../../style';
1312
import {useMeasure} from '../../hooks';
1413
import {TextFieldProps, InternalTextFieldProps, ValidationMessagePosition, FieldContextType, TextFieldMethods} from './types';
1514
import {shouldHidePlaceholder} from './Presenter';
@@ -44,6 +43,7 @@ const TextField = (props: InternalTextFieldProps) => {
4443
floatingPlaceholderColor,
4544
floatingPlaceholderStyle,
4645
floatOnFocus,
46+
placeholderTextColor,
4747
hint,
4848
// Label
4949
label,
@@ -128,7 +128,7 @@ const TextField = (props: InternalTextFieldProps) => {
128128
)}
129129
{children || (
130130
<Input
131-
placeholderTextColor={hidePlaceholder ? 'transparent' : Colors.$textNeutral}
131+
placeholderTextColor={hidePlaceholder ? 'transparent' : placeholderTextColor}
132132
{...others}
133133
style={[typographyStyle, colorStyle, others.style]}
134134
onFocus={onFocus}

src/incubator/TextField/presets/default.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ const colorByState = {
77
disabled: Colors.$textDisabled
88
};
99

10+
const placeholderTextColorByState = {
11+
default: Colors.$textNeutral,
12+
error: Colors.$textNeutral,
13+
focus: Colors.$textNeutral,
14+
disabled: Colors.$textDisabled
15+
};
16+
1017
const styles = StyleSheet.create({
1118
field: {
1219
borderBottomWidth: 1,
@@ -25,6 +32,7 @@ export default {
2532
enableErrors: true,
2633
validateOnBlur: true,
2734
floatingPlaceholderColor: colorByState,
35+
placeholderTextColor: placeholderTextColorByState,
2836
labelColor: colorByState,
2937
fieldStyle: styles.field,
3038
style: styles.input,

0 commit comments

Comments
 (0)