Skip to content

Commit a83407b

Browse files
Inbal-Tishethanshar
authored andcommitted
TextField - Fix placeholder top space (#598)
* Fix for space between placeholder and title in TextField and expandable TextField * changing condition
1 parent a342740 commit a83407b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/inputs/TextField.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,13 @@ export default class TextField extends BaseInput {
473473
color,
474474
...others
475475
} = this.getThemeProps();
476+
476477
const typography = this.getTypography();
477478
const {lineHeight, ...typographyStyle} = typography;
478479
const textColor = this.getStateColor(color || this.extractColorValue());
479480
const hasRightElement = this.shouldDisplayRightButton() || rightIconSource;
481+
const shouldUseMultiline = multiline || expandable;
482+
480483
const inputStyle = [
481484
hasRightElement && this.styles.rightElement,
482485
this.styles.input,
@@ -485,12 +488,13 @@ export default class TextField extends BaseInput {
485488
Constants.isAndroid && {lineHeight},
486489
expandable && {maxHeight: lineHeight * (Constants.isAndroid ? 3 : 3.3)},
487490
Constants.isRTL && {minHeight: lineHeight + 3},
491+
Constants.isIOS && shouldUseMultiline && {paddingTop: 0}, // fix for iOS topPadding in multiline TextInput
488492
{color: textColor},
489493
style
490494
];
495+
491496
const placeholderText = this.getPlaceholderText();
492497
const placeholderColor = this.getStateColor(placeholderTextColor || DEFAULT_COLOR_BY_STATE.default);
493-
const shouldUseMultiline = multiline ? multiline : expandable;
494498
const isEditable = !this.isDisabled() && !expandable;
495499

496500
return (

0 commit comments

Comments
 (0)