Skip to content

Commit

Permalink
fix: fix useless onlayout any typing on textwithbadge component
Browse files Browse the repository at this point in the history
  • Loading branch information
ffeliperocha committed Jun 13, 2024
1 parent a3f1a95 commit aed4b6d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/yoga/src/Result/native/Result/TextWithBadge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<StyledBoxContainer containerWidth={containerWidth}>
Expand Down

0 comments on commit aed4b6d

Please sign in to comment.