Skip to content

Commit da4df37

Browse files
committed
fix prop name, icon alignment, and comment.
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
1 parent 69989a3 commit da4df37

7 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/components/MoneyRequestAmountInput.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ type MoneyRequestAmountInputProps = {
9696

9797
/** The testID of the input. Used to locate this view in end-to-end tests. */
9898
testID?: string;
99-
} & Pick<TextInputWithCurrencySymbolProps, 'autoGrowExtraSpace' | 'submitBehavior' | 'shouldPrefixUseDefaultLineHeight'>;
99+
} & Pick<TextInputWithCurrencySymbolProps, 'autoGrowExtraSpace' | 'submitBehavior' | 'shouldUseDefaultLineHeightForPrefix'>;
100100

101101
type Selection = {
102102
start: number;
@@ -136,7 +136,7 @@ function MoneyRequestAmountInput(
136136
testID,
137137
submitBehavior,
138138
shouldApplyPaddingToContainer = false,
139-
shouldPrefixUseDefaultLineHeight = true,
139+
shouldUseDefaultLineHeightForPrefix = true,
140140
...props
141141
}: MoneyRequestAmountInputProps,
142142
forwardedRef: ForwardedRef<BaseTextInputRef>,
@@ -349,7 +349,7 @@ function MoneyRequestAmountInput(
349349
testID={testID}
350350
submitBehavior={submitBehavior}
351351
shouldApplyPaddingToContainer={shouldApplyPaddingToContainer}
352-
shouldPrefixUseDefaultLineHeight={shouldPrefixUseDefaultLineHeight}
352+
shouldUseDefaultLineHeightForPrefix={shouldUseDefaultLineHeightForPrefix}
353353
/>
354354
);
355355
}

src/components/TextInput/BaseTextInput/implementation/index.native.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function BaseTextInput(
7878
placeholderTextColor,
7979
onClearInput,
8080
iconContainerStyle,
81-
shouldPrefixUseDefaultLineHeight = true,
81+
shouldUseDefaultLineHeightForPrefix = true,
8282
...props
8383
}: BaseTextInputProps,
8484
ref: ForwardedRef<BaseTextInputRef>,
@@ -359,7 +359,7 @@ function BaseTextInput(
359359
tabIndex={-1}
360360
style={[styles.textInputPrefix, !hasLabel && styles.pv0, styles.pointerEventsNone, prefixStyle]}
361361
dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}}
362-
shouldUseDefaultLineHeight={!!shouldPrefixUseDefaultLineHeight && !shouldApplyHeight}
362+
shouldUseDefaultLineHeight={!!shouldUseDefaultLineHeightForPrefix && !shouldApplyHeight}
363363
>
364364
{prefixCharacter}
365365
</Text>

src/components/TextInput/BaseTextInput/implementation/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function BaseTextInput(
8080
placeholderTextColor,
8181
onClearInput,
8282
iconContainerStyle,
83-
shouldPrefixUseDefaultLineHeight = true,
83+
shouldUseDefaultLineHeightForPrefix = true,
8484
...inputProps
8585
}: BaseTextInputProps,
8686
ref: ForwardedRef<BaseTextInputRef>,
@@ -369,7 +369,7 @@ function BaseTextInput(
369369
tabIndex={-1}
370370
style={[styles.textInputPrefix, !hasLabel && styles.pv0, styles.pointerEventsNone, prefixStyle]}
371371
dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}}
372-
shouldUseDefaultLineHeight={shouldPrefixUseDefaultLineHeight}
372+
shouldUseDefaultLineHeight={shouldUseDefaultLineHeightForPrefix}
373373
>
374374
{prefixCharacter}
375375
</Text>

src/components/TextInput/BaseTextInput/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ type CustomBaseTextInputProps = {
187187
/** Whether the input should be enforced to take full height of container. Default is `false` */
188188
shouldUseFullInputHeight?: boolean;
189189

190-
/** Whether the input prefix should use the default text line height */
191-
shouldPrefixUseDefaultLineHeight?: boolean;
190+
/** Whether the input prefix should use the default `Text` line height fallback. Disable this if you intentionally want the prefix to have `lineHeight: undefined` */
191+
shouldUseDefaultLineHeightForPrefix?: boolean;
192192
};
193193

194194
type BaseTextInputRef = HTMLFormElement | AnimatedTextInputRef;

src/components/TextInputWithCurrencySymbol/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ type BaseTextInputWithCurrencySymbolProps = {
8383

8484
/** The test ID of TextInput. Used to locate the view in end-to-end tests. */
8585
testID?: string;
86-
} & Pick<BaseTextInputProps, 'autoFocus' | 'autoGrow' | 'autoGrowExtraSpace' | 'contentWidth' | 'onPress' | 'submitBehavior' | 'shouldPrefixUseDefaultLineHeight'>;
86+
} & Pick<BaseTextInputProps, 'autoFocus' | 'autoGrow' | 'autoGrowExtraSpace' | 'contentWidth' | 'onPress' | 'submitBehavior' | 'shouldUseDefaultLineHeightForPrefix'>;
8787

8888
type TextInputWithCurrencySymbolProps = Omit<BaseTextInputWithCurrencySymbolProps, 'onSelectionChange'> & {
8989
onSelectionChange?: (start: number, end: number) => void;

src/styles/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
13851385
const paddingStyle = includePadding ? {paddingHorizontal: 11} : {};
13861386
return {
13871387
...paddingStyle,
1388-
marginTop: hasLabel ? 8 : 16,
1388+
marginTop: hasLabel ? variables.inputIconMarginTopSmall : variables.inputIconMarginTopLarge,
13891389
};
13901390
},
13911391

src/styles/variables.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ export default {
124124
inputPaddingTop: getValueUsingPixelRatio(15, 21),
125125
inputPaddingBottom: getValueUsingPixelRatio(8, 11),
126126
inputHeightSmall: 28,
127+
inputIconMarginTopSmall: getValueUsingPixelRatio(8, 11),
128+
inputIconMarginTopLarge: getValueUsingPixelRatio(16, 21),
127129
formErrorLineHeight: getValueUsingPixelRatio(18, 23),
128130
communicationsLinkHeight: getValueUsingPixelRatio(20, 30),
129131
alternateTextHeight: getValueUsingPixelRatio(20, 24),

0 commit comments

Comments
 (0)