From ae8384870ed30cd12564685d18d6851a1f37d3e6 Mon Sep 17 00:00:00 2001 From: Natalia Volkova Date: Mon, 14 Dec 2020 12:30:35 +0300 Subject: [PATCH] fix: fix padding in flat text input on web (#2410) --- src/components/TextInput/Adornment/TextInputAdornment.tsx | 6 +----- src/components/TextInput/TextInputFlat.tsx | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/TextInput/Adornment/TextInputAdornment.tsx b/src/components/TextInput/Adornment/TextInputAdornment.tsx index 512d39ade2..cc2b833028 100644 --- a/src/components/TextInput/Adornment/TextInputAdornment.tsx +++ b/src/components/TextInput/Adornment/TextInputAdornment.tsx @@ -2,12 +2,11 @@ import React from 'react'; import TextInputIcon, { IconAdornment } from './TextInputIcon'; import TextInputAffix, { AffixAdornment } from './TextInputAffix'; import { ADORNMENT_OFFSET, OUTLINED_INPUT_OFFSET } from '../constants'; -import { +import type { LayoutChangeEvent, TextStyle, StyleProp, Animated, - Platform, } from 'react-native'; import type { AdornmentConfig, @@ -64,7 +63,6 @@ export function getAdornmentStyleAdjustmentForNativeInput({ if (adornmentConfig.length) { const adornmentStyleAdjustmentForNativeInput = adornmentConfig.map( ({ type, side }: AdornmentConfig) => { - const isWeb = Platform.OS !== 'ios' && Platform.OS !== 'android'; const isLeftSide = side === AdornmentSide.Left; const inputModeAdornemntOffset = mode === InputMode.Outlined @@ -78,8 +76,6 @@ export function getAdornmentStyleAdjustmentForNativeInput({ : inputModeAdornemntOffset; const offset = affixWidth + padding; - if (isWeb) return { [paddingKey]: offset }; - const isAffix = type === AdornmentType.Affix; const marginKey = `margin${captalize(side)}`; diff --git a/src/components/TextInput/TextInputFlat.tsx b/src/components/TextInput/TextInputFlat.tsx index 638539dfb0..60db3eb25f 100644 --- a/src/components/TextInput/TextInputFlat.tsx +++ b/src/components/TextInput/TextInputFlat.tsx @@ -37,7 +37,7 @@ import { getAdornmentConfig, getAdornmentStyleAdjustmentForNativeInput, } from './Adornment/TextInputAdornment'; -import { AdornmentSide, AdornmentType } from './Adornment/enums'; +import { AdornmentSide, AdornmentType, InputMode } from './Adornment/enums'; const MINIMIZED_LABEL_Y_OFFSET = -18; @@ -132,6 +132,7 @@ class TextInputFlat extends React.Component { leftAffixWidth, paddingHorizontal, inputOffset: FLAT_INPUT_OFFSET, + mode: InputMode.Flat, } );