MCPcopy Index your code
hub / github.com/callstack/react-native-paper / calculateInputPadding

Function calculateInputPadding

src/components/TextInput/helpers.tsx:96–117  ·  view source on GitHub ↗
({
  topPosition,
  fontSize,
  multiline,
  scale,
  dense,
  offset,
  isAndroid,
}: PaddingProps)

Source from the content-addressed store, hash-verified

94};
95
96const calculateInputPadding = ({
97 topPosition,
98 fontSize,
99 multiline,
100 scale,
101 dense,
102 offset,
103 isAndroid,
104}: PaddingProps): number => {
105 const refFontSize = scale * fontSize;
106 let result = Math.floor(topPosition / 2);
107
108 result =
109 result +
110 Math.floor((refFontSize - fontSize) / 2) -
111 (scale < 1 ? offset / 2 : 0);
112
113 if (multiline && isAndroid)
114 result = Math.min(dense ? offset / 2 : offset, result);
115
116 return result;
117};
118
119export const adjustPaddingOut = ({
120 pad,

Callers 1

calculatePaddingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…