Skip to content

Commit 0323f42

Browse files
committed
fix: ts/lint
1 parent 6ce60ef commit 0323f42

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

src/components/AmountWithoutCurrencyInput.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ function AmountWithoutCurrencyForm(
3131
keyboardType={!shouldAllowNegative ? CONST.KEYBOARD_TYPE.DECIMAL_PAD : undefined}
3232
type="mask"
3333
mask="[09999999].[99]"
34-
customNotations={[{character: '.', characterSet: '.', isOptional: true}, {character: ',', characterSet: ',', isOptional: true}]}
3534
// On android autoCapitalize="words" is necessary when keyboardType="decimal-pad" or inputMode="decimal" to prevent input lag.
3635
// See https://github.com/Expensify/App/issues/51868 for more information
3736
autoCapitalize="words"

src/components/TextInput/BaseTextInput/implementations.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import RNMarkdownTextInput from '@components/RNMarkdownTextInput';
22
import RNMaskedTextInput from '@components/RNMaskedTextInput';
33
import RNTextInput from '@components/RNTextInput';
4+
import type {BaseTextInputProps, InputType} from './types';
45

5-
const InputComponentMap = new Map([
6+
type InputComponentType = React.ComponentType<BaseTextInputProps>;
7+
8+
const InputComponentMap = new Map<InputType, InputComponentType>([
69
['default', RNTextInput],
7-
['mask', RNMaskedTextInput],
10+
['mask', RNMaskedTextInput as InputComponentType],
811
['markdown', RNMarkdownTextInput],
912
]);
1013

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as Expensicons from '@components/Icon/Expensicons';
1111
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
1212
import type {AnimatedMarkdownTextInputRef} from '@components/RNMarkdownTextInput';
1313
import type {AnimatedTextInputRef} from '@components/RNTextInput';
14+
import RNTextInput from '@components/RNTextInput';
1415
import Text from '@components/Text';
1516
import * as styleConst from '@components/TextInput/styleConst';
1617
import TextInputClearButton from '@components/TextInput/TextInputClearButton';
@@ -75,7 +76,7 @@ function BaseTextInput(
7576
}: BaseTextInputProps,
7677
ref: ForwardedRef<BaseTextInputRef>,
7778
) {
78-
const InputComponent = InputComponentMap.get(type);
79+
const InputComponent = InputComponentMap.get(type) ?? RNTextInput;
7980
const isMarkdownEnabled = type === 'markdown';
8081
const isAutoGrowHeightMarkdown = isMarkdownEnabled && autoGrowHeight;
8182

src/components/TextInput/BaseTextInput/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as Expensicons from '@components/Icon/Expensicons';
1111
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
1212
import type {AnimatedMarkdownTextInputRef} from '@components/RNMarkdownTextInput';
1313
import type {AnimatedTextInputRef} from '@components/RNTextInput';
14+
import RNTextInput from '@components/RNTextInput';
1415
import SwipeInterceptPanResponder from '@components/SwipeInterceptPanResponder';
1516
import Text from '@components/Text';
1617
import * as styleConst from '@components/TextInput/styleConst';
@@ -80,7 +81,7 @@ function BaseTextInput(
8081
}: BaseTextInputProps,
8182
ref: ForwardedRef<BaseTextInputRef>,
8283
) {
83-
const InputComponent = InputComponentMap.get(type);
84+
const InputComponent = InputComponentMap.get(type) ?? RNTextInput;
8485
const isMarkdownEnabled = type === 'markdown';
8586
const isAutoGrowHeightMarkdown = isMarkdownEnabled && autoGrowHeight;
8687

src/components/TextInput/BaseTextInput/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type {MarkdownStyle} from '@expensify/react-native-live-markdown';
22
import type {GestureResponderEvent, StyleProp, TextInputProps, TextStyle, ViewStyle} from 'react-native';
3+
import type {MaskedTextInputOwnProps} from 'react-native-advanced-input-mask/lib/typescript/src/types';
34
import type {AnimatedTextInputRef} from '@components/RNTextInput';
45
import type IconAsset from '@src/types/utils/IconAsset';
56

@@ -120,6 +121,8 @@ type CustomBaseTextInputProps = {
120121
/** List of markdowns that won't be styled as a markdown */
121122
excludedMarkdownStyles?: Array<keyof MarkdownStyle>;
122123

124+
markdownStyle?: MarkdownStyle;
125+
123126
/** Whether the clear button should be displayed */
124127
shouldShowClearButton?: boolean;
125128

@@ -144,9 +147,12 @@ type CustomBaseTextInputProps = {
144147
/** The width of inner content */
145148
contentWidth?: number;
146149

147-
/** The type (internal implementation) of input. Cab one of: `default`, `mask`, `markdown` */
150+
/** The type (internal implementation) of input. Can be one of: `default`, `mask`, `markdown` */
148151
type?: InputType;
149152

153+
/** The mask of the masked input */
154+
mask?: MaskedTextInputOwnProps['mask'];
155+
150156
/** Whether the input should be enforced to be uncontrolled. Default is `false` */
151157
uncontrolled?: boolean;
152158
};

src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersAmountPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ function SearchFiltersAmountPage() {
7676
<InputWrapper
7777
InputComponent={AmountWithoutCurrencyInput}
7878
inputID={INPUT_IDS.LESS_THAN}
79-
onPaste={(e) => console.log('paste', e.nativeEvent)}
8079
name={INPUT_IDS.LESS_THAN}
8180
defaultValue={lessThanFormattedAmount}
8281
label={translate('search.filters.amount.lessThan')}

0 commit comments

Comments
 (0)