From 213555045c1ba7b56d2252ad4a30e425d786833d Mon Sep 17 00:00:00 2001 From: Jo Yaconelli Date: Wed, 17 Apr 2024 12:21:24 -0700 Subject: [PATCH] only update content size when bigger than previous --- src/tooltip.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tooltip.js b/src/tooltip.js index 3098692..c1a8792 100644 --- a/src/tooltip.js +++ b/src/tooltip.js @@ -243,8 +243,13 @@ class Tooltip extends Component { measureContent = e => { const { width, height } = e.nativeEvent.layout; - const contentSize = new Size(width, height); - this.setState({ contentSize }, () => { + const newContentSize = new Size(width, height); + this.setState(({ contentSize }) => ({ + contentSize: { + width: Math.max(contentSize.width, newContentSize.width), + height: Math.max(contentSize.height, newContentSize.height) + } + }), () => { this.computeGeometry(); }); };