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

Function onTextLayout

src/components/FAB/AnimatedFAB.tsx:337–352  ·  view source on GitHub ↗
({
    nativeEvent,
  }: NativeSyntheticEvent<TextLayoutEventData>)

Source from the content-addressed store, hash-verified

335 }, [animFAB, scale, distance, extended]);
336
337 const onTextLayout = ({
338 nativeEvent,
339 }: NativeSyntheticEvent<TextLayoutEventData>) => {
340 const currentWidth = Math.ceil(nativeEvent.lines[0]?.width ?? 0);
341 const currentHeight = Math.ceil(nativeEvent.lines[0]?.height ?? 0);
342
343 if (currentWidth !== textWidth || currentHeight !== textHeight) {
344 setTextHeight(currentHeight);
345
346 if (isIOS) {
347 return setTextWidth(currentWidth - 12);
348 }
349
350 setTextWidth(currentWidth);
351 }
352 };
353
354 const propForDirection = <T,>(right: T[]): T[] => {
355 if (isAnimatedFromRight) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…