({
disabled = false,
editable = true,
label,
error = false,
selectionColor: customSelectionColor,
cursorColor,
underlineColor,
underlineStyle,
activeUnderlineColor,
textColor,
dense,
style,
theme,
render = (props: RenderProps) => <NativeTextInput {...props} />,
multiline = false,
parentState,
innerRef,
onFocus,
forceFocus,
onBlur,
onChangeText,
onLayoutAnimatedText,
onLabelTextLayout,
onLeftAffixLayoutChange,
onRightAffixLayoutChange,
onInputLayout,
left,
right,
placeholderTextColor,
testID = 'text-input-flat',
contentStyle,
scaledLabel,
...rest
}: ChildTextInputProps)
| 43 | import type { ChildTextInputProps, RenderProps } from './types'; |
| 44 | |
| 45 | const TextInputFlat = ({ |
| 46 | disabled = false, |
| 47 | editable = true, |
| 48 | label, |
| 49 | error = false, |
| 50 | selectionColor: customSelectionColor, |
| 51 | cursorColor, |
| 52 | underlineColor, |
| 53 | underlineStyle, |
| 54 | activeUnderlineColor, |
| 55 | textColor, |
| 56 | dense, |
| 57 | style, |
| 58 | theme, |
| 59 | render = (props: RenderProps) => <NativeTextInput {...props} />, |
| 60 | multiline = false, |
| 61 | parentState, |
| 62 | innerRef, |
| 63 | onFocus, |
| 64 | forceFocus, |
| 65 | onBlur, |
| 66 | onChangeText, |
| 67 | onLayoutAnimatedText, |
| 68 | onLabelTextLayout, |
| 69 | onLeftAffixLayoutChange, |
| 70 | onRightAffixLayoutChange, |
| 71 | onInputLayout, |
| 72 | left, |
| 73 | right, |
| 74 | placeholderTextColor, |
| 75 | testID = 'text-input-flat', |
| 76 | contentStyle, |
| 77 | scaledLabel, |
| 78 | ...rest |
| 79 | }: ChildTextInputProps) => { |
| 80 | const isAndroid = Platform.OS === 'android'; |
| 81 | const { colors, isV3, roundness } = theme; |
| 82 | const font = isV3 ? theme.fonts.bodyLarge : theme.fonts.regular; |
| 83 | const hasActiveOutline = parentState.focused || error; |
| 84 | |
| 85 | const { LABEL_PADDING_TOP, FLAT_INPUT_OFFSET, MIN_HEIGHT, MIN_WIDTH } = |
| 86 | getConstants(isV3); |
| 87 | |
| 88 | const { |
| 89 | fontSize: fontSizeStyle, |
| 90 | lineHeight: lineHeightStyle, |
| 91 | fontWeight, |
| 92 | height, |
| 93 | paddingHorizontal, |
| 94 | textAlign, |
| 95 | ...viewStyle |
| 96 | } = (StyleSheet.flatten(style) || {}) as TextStyle; |
| 97 | const fontSize = fontSizeStyle || MAXIMIZED_LABEL_FONT_SIZE; |
| 98 | const lineHeight = |
| 99 | lineHeightStyle || (Platform.OS === 'web' ? fontSize * 1.2 : undefined); |
| 100 | |
| 101 | const isPaddingHorizontalPassed = |
| 102 | paddingHorizontal !== undefined && typeof paddingHorizontal === 'number'; |
nothing calls this directly
no test coverage detected
searching dependent graphs…