From aed4b6d56109481f7d5db17d12104d1b3653b556 Mon Sep 17 00:00:00 2001 From: Felipe Rocha Date: Thu, 13 Jun 2024 14:44:36 -0300 Subject: [PATCH] fix: fix useless onlayout any typing on textwithbadge component --- .../Result/native/Result/TextWithBadge/index.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/yoga/src/Result/native/Result/TextWithBadge/index.tsx b/packages/yoga/src/Result/native/Result/TextWithBadge/index.tsx index 6961973935..285320efec 100644 --- a/packages/yoga/src/Result/native/Result/TextWithBadge/index.tsx +++ b/packages/yoga/src/Result/native/Result/TextWithBadge/index.tsx @@ -31,11 +31,16 @@ const TextWithBadge = ({ const containerWidth = shouldTruncate ? null : textSize; const textWidth = shouldTruncate ? '100%' : null; - const onTextLayout = useCallback(event => { - const { width } = event.nativeEvent.layout; - - setTextSize(width); - }, []); + const onTextLayout = useCallback( + ({ + nativeEvent: { + layout: { width }, + }, + }) => { + setTextSize(width); + }, + [], + ); return (