Skip to content

Commit

Permalink
fix: fix padding in flat text input on web (#2410)
Browse files Browse the repository at this point in the history
  • Loading branch information
unikvozm committed Dec 14, 2020
1 parent 6891d42 commit ae83848
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/components/TextInput/Adornment/TextInputAdornment.tsx
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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)}`;

Expand Down
3 changes: 2 additions & 1 deletion src/components/TextInput/TextInputFlat.tsx
Expand Up @@ -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;

Expand Down Expand Up @@ -132,6 +132,7 @@ class TextInputFlat extends React.Component<ChildTextInputProps> {
leftAffixWidth,
paddingHorizontal,
inputOffset: FLAT_INPUT_OFFSET,
mode: InputMode.Flat,
}
);

Expand Down

0 comments on commit ae83848

Please sign in to comment.