MCPcopy
hub / github.com/callstack/react-native-paper / TextInputFlat

Function TextInputFlat

src/components/TextInput/TextInputFlat.tsx:45–441  ·  view source on GitHub ↗
({
  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)

Source from the content-addressed store, hash-verified

43import type { ChildTextInputProps, RenderProps } from './types';
44
45const 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';

Callers

nothing calls this directly

Calls 11

getConstantsFunction · 0.90
getAdornmentConfigFunction · 0.90
getFlatInputColorsFunction · 0.90
calculateInputHeightFunction · 0.90
calculatePaddingFunction · 0.90
adjustPaddingFlatFunction · 0.90
renderFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…