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

Function adjustPaddingOut

src/components/TextInput/helpers.tsx:119–162  ·  view source on GitHub ↗
({
  pad,
  multiline,
  label,
  scale,
  height,
  fontSize,
  lineHeight,
  dense,
  offset,
  isAndroid,
}: AdjProps)

Source from the content-addressed store, hash-verified

117};
118
119export const adjustPaddingOut = ({
120 pad,
121 multiline,
122 label,
123 scale,
124 height,
125 fontSize,
126 lineHeight,
127 dense,
128 offset,
129 isAndroid,
130}: AdjProps): Padding => {
131 const fontHeight = lineHeight ?? fontSize;
132 const refFontHeight = scale * fontSize;
133 let result = pad;
134
135 if (!isAndroid && height && !multiline) {
136 return {
137 paddingTop: Math.max(0, (height - fontHeight) / 2),
138 paddingBottom: Math.max(0, (height - fontHeight) / 2),
139 };
140 }
141 if (!isAndroid && multiline) {
142 if (dense) {
143 if (label) {
144 result += scale < 1 ? Math.min(offset, (refFontHeight / 2) * scale) : 0;
145 } else {
146 result += 0;
147 }
148 }
149 if (!dense) {
150 if (label) {
151 result +=
152 scale < 1
153 ? Math.min(offset, refFontHeight * scale)
154 : Math.min(offset / 2, refFontHeight * scale);
155 } else {
156 result += scale < 1 ? Math.min(offset / 2, refFontHeight * scale) : 0;
157 }
158 }
159 result = Math.floor(result);
160 }
161 return { paddingTop: result, paddingBottom: result };
162};
163
164export const adjustPaddingFlat = ({
165 pad,

Callers 1

TextInputOutlinedFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…