MCPcopy Create free account
hub / github.com/callstack/react-native-paper / Underline

Function Underline

src/components/TextInput/Addons/Underline.tsx:23–64  ·  view source on GitHub ↗
({
  parentState,
  error,
  colors,
  activeColor,
  underlineColorCustom,
  hasActiveOutline,
  style,
  theme: themeOverrides,
}: UnderlineProps)

Source from the content-addressed store, hash-verified

21};
22
23export const Underline = ({
24 parentState,
25 error,
26 colors,
27 activeColor,
28 underlineColorCustom,
29 hasActiveOutline,
30 style,
31 theme: themeOverrides,
32}: UnderlineProps) => {
33 const { isV3 } = useInternalTheme(themeOverrides);
34
35 let backgroundColor = parentState.focused
36 ? activeColor
37 : underlineColorCustom;
38
39 if (error) backgroundColor = colors?.error;
40
41 const activeScale = isV3 ? 2 : 1;
42
43 return (
44 <Animated.View
45 testID="text-input-underline"
46 style={[
47 styles.underline,
48 isV3 && styles.md3Underline,
49 {
50 backgroundColor,
51 // Underlines is thinner when input is not focused
52 transform: [
53 {
54 scaleY: (isV3 ? hasActiveOutline : parentState.focused)
55 ? activeScale
56 : 0.5,
57 },
58 ],
59 },
60 style,
61 ]}
62 />
63 );
64};
65
66const styles = StyleSheet.create({
67 underline: {

Callers

nothing calls this directly

Calls 1

useInternalThemeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…