Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3aec5ca
fix: Update visual style of our text inputs for better consistency.
Krishna2323 May 29, 2025
fa40355
minor fixes.
Krishna2323 May 29, 2025
b037e9e
fix: regressions.
Krishna2323 May 29, 2025
6035816
Merge branch 'Expensify:main' into krishna2323/issue/59518_3
Krishna2323 May 29, 2025
63578d8
fix: reports page search input focused state styles.
Krishna2323 May 30, 2025
ead7872
fix search header input.
Krishna2323 May 30, 2025
175313f
Merge branch 'main' into krishna2323/issue/59518_3
Krishna2323 May 30, 2025
bee3cbe
fix: emoji picker, reports page input & eslint.
Krishna2323 May 30, 2025
f4a8353
fix eslint Namespace imports.
Krishna2323 May 30, 2025
359679b
minor update.
Krishna2323 May 31, 2025
9d4dc45
Merge branch 'Expensify:main' into krishna2323/issue/59518_3
Krishna2323 Jun 4, 2025
2e7e8eb
Merge branch 'Expensify:main' into krishna2323/issue/59518_3
Krishna2323 Jun 5, 2025
f1b901d
Merge branch 'Expensify:main' into krishna2323/issue/59518_3
Krishna2323 Jun 8, 2025
b4757c4
fix split input padding.
Krishna2323 Jun 8, 2025
6cbad49
fix: no vertical padding on DebugReportActionCreatePage.
Krishna2323 Jun 8, 2025
5f79ab4
fix: Multiline inputs in debug page do not have bottom padding.
Krishna2323 Jun 8, 2025
377cf85
fix ESLint.
Krishna2323 Jun 8, 2025
ad0eb14
fix split input padding.
Krishna2323 Jun 9, 2025
b2512ce
fix bank info steps margin.
Krishna2323 Jun 10, 2025
c05675f
Merge branch 'Expensify:main' into krishna2323/issue/59518_3
Krishna2323 Jun 10, 2025
674e8bb
fix amount input padding.
Krishna2323 Jun 10, 2025
865e66f
fix ESLint.
Krishna2323 Jun 10, 2025
96a0af4
Merge branch 'Expensify:main' into krishna2323/issue/59518_3
Krishna2323 Jun 12, 2025
d49a847
fix split input alignment.
Krishna2323 Jun 12, 2025
c86f71b
minor fix.
Krishna2323 Jun 12, 2025
bedec6a
Merge branch 'main' into krishna2323/issue/59518_3
Krishna2323 Jun 13, 2025
c060a44
Merge branch 'Expensify:main' into krishna2323/issue/59518_3
Krishna2323 Jun 19, 2025
b8085f5
fix: NetSuiteTokenInputForm title margin bottom.
Krishna2323 Jun 19, 2025
f95e3ed
Merge branch 'main' into krishna2323/issue/59518_3
Krishna2323 Jun 22, 2025
5184faf
Merge branch 'main' into krishna2323/issue/59518_3
Krishna2323 Jun 23, 2025
05f020d
fix prefix alignment.
Krishna2323 Jun 23, 2025
73fcfc5
minor update.
Krishna2323 Jun 23, 2025
ca8855e
fix ESLint.
Krishna2323 Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/AmountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ function AmountForm(
textInput.current = ref;
}}
prefixCharacter={currency}
prefixContainerStyle={styles.pb2half}
prefixStyle={styles.colorMuted}
keyboardType={CONST.KEYBOARD_TYPE.DECIMAL_PAD}
// On android autoCapitalize="words" is necessary when keyboardType="decimal-pad" or inputMode="decimal" to prevent input lag.
Expand Down
6 changes: 6 additions & 0 deletions src/components/AmountTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type AmountTextInputProps = {
/** Style for the TextInput container */
containerStyle?: StyleProp<ViewStyle>;

/** Whether to apply padding to the input, some inputs doesn't require any padding, e.g. Amount input in money request flow */
shouldApplyPaddingToContainer?: boolean;

/** Hide the focus styles on TextInput */
hideFocusedState?: boolean;
} & Pick<BaseTextInputProps, 'autoFocus' | 'autoGrowExtraSpace' | 'submitBehavior'>;
Expand All @@ -54,6 +57,7 @@ function AmountTextInput(
containerStyle,
disableKeyboard = true,
hideFocusedState = true,
shouldApplyPaddingToContainer = false,
...rest
}: AmountTextInputProps,
ref: ForwardedRef<BaseTextInputRef>,
Expand Down Expand Up @@ -85,6 +89,8 @@ function AmountTextInput(
autoCorrect={false}
spellCheck={false}
disableKeyboardShortcuts
shouldUseFullInputHeight
shouldApplyPaddingToContainer={shouldApplyPaddingToContainer}
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
/>
Expand Down
18 changes: 9 additions & 9 deletions src/components/EmojiPicker/EmojiPickerMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ import useSingleExecution from '@hooks/useSingleExecution';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as Browser from '@libs/Browser';
import {isMobile} from '@libs/Browser';
import canFocusInputOnScreenFocus from '@libs/canFocusInputOnScreenFocus';
import * as EmojiUtils from '@libs/EmojiUtils';
import {getRemovedSkinToneEmoji} from '@libs/EmojiUtils';
import type {EmojiPickerListItem} from '@libs/EmojiUtils';
import isEnterWhileComposition from '@libs/KeyboardShortcut/isEnterWhileComposition';
import * as ReportUtils from '@libs/ReportUtils';
import {shouldAutoFocusOnKeyPress} from '@libs/ReportUtils';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import BaseEmojiPickerMenu from './BaseEmojiPickerMenu';
import type EmojiPickerMenuProps from './types';
import useEmojiPickerMenu from './useEmojiPickerMenu';

const throttleTime = Browser.isMobile() ? 200 : 50;
const throttleTime = isMobile() ? 200 : 50;

function EmojiPickerMenu({onEmojiSelected, activeEmoji}: EmojiPickerMenuProps, ref: ForwardedRef<BaseTextInputRef>) {
const styles = useThemeStyles();
Expand Down Expand Up @@ -148,7 +149,7 @@ function EmojiPickerMenu({onEmojiSelected, activeEmoji}: EmojiPickerMenuProps, r
}

// We allow typing in the search box if any key is pressed apart from Arrow keys.
if (searchInputRef.current && !isTextInputFocused(searchInputRef) && ReportUtils.shouldAutoFocusOnKeyPress(keyBoardEvent)) {
if (searchInputRef.current && !isTextInputFocused(searchInputRef) && shouldAutoFocusOnKeyPress(keyBoardEvent)) {
searchInputRef.current.focus();
}
},
Expand Down Expand Up @@ -247,7 +248,7 @@ function EmojiPickerMenu({onEmojiSelected, activeEmoji}: EmojiPickerMenuProps, r
* so that the sticky headers function properly.
*
*/
const renderItem: ListRenderItem<EmojiUtils.EmojiPickerListItem> = useCallback(
const renderItem: ListRenderItem<EmojiPickerListItem> = useCallback(
({item, index, target}) => {
const code = item.code;
const types = 'types' in item ? item.types : undefined;
Expand All @@ -267,8 +268,7 @@ function EmojiPickerMenu({onEmojiSelected, activeEmoji}: EmojiPickerMenuProps, r
const emojiCode = typeof preferredSkinTone === 'number' && types?.at(preferredSkinTone) && preferredSkinTone !== -1 ? types.at(preferredSkinTone) : code;

const isEmojiFocused = index === focusedIndex && isUsingKeyboardMovement;
const shouldEmojiBeHighlighted =
(index === focusedIndex && highlightEmoji) || (!!activeEmoji && EmojiUtils.getRemovedSkinToneEmoji(emojiCode) === EmojiUtils.getRemovedSkinToneEmoji(activeEmoji));
const shouldEmojiBeHighlighted = (index === focusedIndex && highlightEmoji) || (!!activeEmoji && getRemovedSkinToneEmoji(emojiCode) === getRemovedSkinToneEmoji(activeEmoji));
const shouldFirstEmojiBeHighlighted = index === 0 && highlightFirstEmoji;

return (
Expand Down Expand Up @@ -320,7 +320,7 @@ function EmojiPickerMenu({onEmojiSelected, activeEmoji}: EmojiPickerMenuProps, r
arePointerEventsDisabled ? styles.pointerEventsNone : styles.pointerEventsAuto,
]}
>
<View style={[styles.ph4, styles.pb3, styles.pt2]}>
<View style={[styles.p4, styles.pb3]}>
<TextInput
label={translate('common.search')}
accessibilityLabel={translate('common.search')}
Expand Down
1 change: 1 addition & 0 deletions src/components/MagicCodeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ function MagicCodeInput(
StyleUtils.getHeightOfMagicCodeInput(),
hasError || errorText ? styles.borderColorDanger : {},
focusedIndex === index ? styles.borderColorFocus : {},
styles.pt0,
]}
>
<Text style={[styles.magicCodeInput, styles.textAlignCenter]}>{decomposeString(value, maxLength).at(index) ?? ''}</Text>
Expand Down
10 changes: 7 additions & 3 deletions src/components/MoneyRequestAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, {useCallback, useEffect, useImperativeHandle, useRef, useState} fr
import type {NativeSyntheticEvent, StyleProp, TextStyle, ViewStyle} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import {useMouseContext} from '@hooks/useMouseContext';
import useThemeStyles from '@hooks/useThemeStyles';
import {isMobileSafari} from '@libs/Browser';
import {convertToFrontendAmountAsString, getCurrencyDecimals} from '@libs/CurrencyUtils';
import getOperatingSystem from '@libs/getOperatingSystem';
Expand Down Expand Up @@ -92,6 +91,9 @@ type MoneyRequestAmountInputProps = {
/** The width of inner content */
contentWidth?: number;

/** Whether to apply padding to the input, some inputs doesn't require any padding, e.g. Amount input in money request flow */
shouldApplyPaddingToContainer?: boolean;

/** Whether the amount is negative */
isNegative?: boolean;

Expand All @@ -103,6 +105,7 @@ type MoneyRequestAmountInputProps = {

/** Whether to allow flipping amount */
allowFlippingAmount?: boolean;

/** The testID of the input. Used to locate this view in end-to-end tests. */
testID?: string;
} & Pick<TextInputWithCurrencySymbolProps, 'autoGrowExtraSpace' | 'submitBehavior'>;
Expand Down Expand Up @@ -148,11 +151,11 @@ function MoneyRequestAmountInput(
clearNegative,
testID,
submitBehavior,
shouldApplyPaddingToContainer = false,
...props
}: MoneyRequestAmountInputProps,
forwardedRef: ForwardedRef<BaseTextInputRef>,
) {
const styles = useThemeStyles();
const {toLocaleDigit, numberFormat} = useLocalize();

const textInput = useRef<BaseTextInputRef | null>(null);
Expand Down Expand Up @@ -360,7 +363,7 @@ function MoneyRequestAmountInput(
style={props.inputStyle}
containerStyle={props.containerStyle}
prefixStyle={props.prefixStyle}
prefixContainerStyle={[styles.pb2half, props.prefixContainerStyle]}
prefixContainerStyle={props.prefixContainerStyle}
touchableInputWrapperStyle={props.touchableInputWrapperStyle}
maxLength={maxLength}
hideFocusedState={hideFocusedState}
Expand All @@ -370,6 +373,7 @@ function MoneyRequestAmountInput(
isNegative={isNegative}
testID={testID}
submitBehavior={submitBehavior}
shouldApplyPaddingToContainer={shouldApplyPaddingToContainer}
/>
);
}
Expand Down
11 changes: 8 additions & 3 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -667,14 +667,16 @@ function MoneyRequestConfirmationList({
hideFocusedState={false}
hideCurrencySymbol
formatAmountOnBlur
prefixContainerStyle={[styles.pv0]}
inputStyle={[styles.optionRowAmountInput]}
containerStyle={[styles.textInputContainer]}
prefixContainerStyle={[styles.pv0, styles.h100]}
prefixStyle={styles.lineHeightUndefined}
inputStyle={[styles.optionRowAmountInput, styles.lineHeightUndefined]}
containerStyle={[styles.textInputContainer, styles.pl2, styles.pr1]}
touchableInputWrapperStyle={[styles.ml3]}
onFormatAmount={convertToDisplayStringWithoutCurrency}
onAmountChange={(value: string) => onSplitShareChange(participantOption.accountID ?? CONST.DEFAULT_NUMBER_ID, Number(value))}
maxLength={formattedTotalAmount.length + 1}
contentWidth={(formattedTotalAmount.length + 1) * 8}
shouldApplyPaddingToContainer
/>
),
}));
Expand All @@ -688,8 +690,11 @@ function MoneyRequestConfirmationList({
selectedParticipants,
styles.flexWrap,
styles.pl2,
styles.pr1,
styles.h100,
styles.textLabel,
styles.pv0,
styles.lineHeightUndefined,
styles.optionRowAmountInput,
styles.textInputContainer,
styles.ml3,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchAutocompleteInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function SearchAutocompleteInput(
onSubmitEditing={onSubmit}
shouldUseDisabledStyles={false}
textInputContainerStyles={[styles.borderNone, styles.pb0, styles.pl3]}
inputStyle={[inputWidth, {lineHeight: undefined}]}
inputStyle={[inputWidth, styles.lineHeightUndefined]}
placeholderTextColor={theme.textSupporting}
onFocus={() => {
onFocus?.();
Expand Down
8 changes: 5 additions & 3 deletions src/components/SelectionList/SplitListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ function SplitListItem<TItem extends ListItem>({
submitBehavior="blurAndSubmit"
formatAmountOnBlur
onAmountChange={onSplitExpenseAmountChange}
prefixContainerStyle={[styles.pv0]}
inputStyle={[styles.optionRowAmountInput]}
containerStyle={[styles.textInputContainer]}
prefixContainerStyle={[styles.pv0, styles.h100]}
prefixStyle={styles.lineHeightUndefined}
inputStyle={[styles.optionRowAmountInput, styles.lineHeightUndefined]}
containerStyle={[styles.textInputContainer, styles.pl2, styles.pr1]}
touchableInputWrapperStyle={[styles.ml3]}
maxLength={formattedOriginalAmount.length + 1}
contentWidth={(formattedOriginalAmount.length + 1) * 8}
shouldApplyPaddingToContainer
/>
</View>
<View style={[styles.popoverMenuIcon, styles.pointerEventsAuto]}>
Expand Down
10 changes: 8 additions & 2 deletions src/components/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ type TextProps = RNTextProps &

/** The family of the font to use */
family?: keyof FontUtilsType['fontFamily']['platform'];

/** Should apply default line height */
shouldUseDefaultLineHeight?: boolean;
};

function Text({color, fontSize = variables.fontSizeNormal, textAlign = 'left', children, family = 'EXP_NEUE', style = {}, ...props}: TextProps, ref: ForwardedRef<RNText>) {
function Text(
{color, fontSize = variables.fontSizeNormal, textAlign = 'left', children, family = 'EXP_NEUE', style = {}, shouldUseDefaultLineHeight = true, ...props}: TextProps,
ref: ForwardedRef<RNText>,
) {
const theme = useTheme();
const customStyle = useContext(CustomStylesForChildrenContext);

Expand All @@ -41,7 +47,7 @@ function Text({color, fontSize = variables.fontSizeNormal, textAlign = 'left', c
...StyleSheet.flatten(customStyle),
};

if (!componentStyle.lineHeight && componentStyle.fontSize === variables.fontSizeNormal) {
if (!componentStyle.lineHeight && componentStyle.fontSize === variables.fontSizeNormal && shouldUseDefaultLineHeight) {
componentStyle.lineHeight = variables.fontSizeNormalHeight;
}

Expand Down
Loading
Loading