From fcda79efe9d0bcc3628a27d774128200d69ae3f8 Mon Sep 17 00:00:00 2001 From: Pierre Segalen Date: Tue, 7 Nov 2023 17:20:35 +0100 Subject: [PATCH 1/5] Measure a node only if it has been found, fixes issue #1782 --- .../devsupport/components/measure/measure.component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/devsupport/components/measure/measure.component.tsx b/src/components/devsupport/components/measure/measure.component.tsx index 8abb33f5c..dc695c6d9 100644 --- a/src/components/devsupport/components/measure/measure.component.tsx +++ b/src/components/devsupport/components/measure/measure.component.tsx @@ -75,7 +75,7 @@ export const MeasureElement: React.FC = (props): MeasuringE const measureSelf = (): void => { const node: number = findNodeHandle(ref.current); - UIManager.measureInWindow(node, onUIManagerMeasure); + if (typeof node === 'number') UIManager.measureInWindow(node, onUIManagerMeasure); }; if (props.force) { From f63dc7dad61b287b9ba734c1698f7a59a6a7709f Mon Sep 17 00:00:00 2001 From: Pierre Segalen Date: Tue, 7 Nov 2023 17:23:06 +0100 Subject: [PATCH 2/5] Round a frame's dimensions to avoid flickering of modals, fixes #1767 --- .../devsupport/components/measure/measure.component.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/devsupport/components/measure/measure.component.tsx b/src/components/devsupport/components/measure/measure.component.tsx index dc695c6d9..3288e0175 100644 --- a/src/components/devsupport/components/measure/measure.component.tsx +++ b/src/components/devsupport/components/measure/measure.component.tsx @@ -56,8 +56,8 @@ export const MeasureElement: React.FC = (props): MeasuringE const boundFrame: Frame = new Frame( frame.origin.x - window.size.width, frame.origin.y, - frame.size.width, - frame.size.height, + Math.round(frame.size.width), + Math.round(frame.size.height), ); return bindToWindow(boundFrame, window); @@ -68,7 +68,7 @@ export const MeasureElement: React.FC = (props): MeasuringE measureSelf(); } else { const originY = props.shouldUseTopInsets ? y + StatusBar.currentHeight || 0 : y; - const frame: Frame = bindToWindow(new Frame(x, originY, w, h), Frame.window()); + const frame: Frame = bindToWindow(new Frame(x, originY, Math.round(w), Math.round(h)), Frame.window()); props.onMeasure(frame); } }; From 828da47bb5d7ca725c8f4ee16afdc30b36357668 Mon Sep 17 00:00:00 2001 From: Pierre Segalen Date: Thu, 7 Dec 2023 09:56:56 +0100 Subject: [PATCH 3/5] Update src/components/devsupport/components/measure/measure.component.tsx Co-authored-by: raqso --- .../devsupport/components/measure/measure.component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/devsupport/components/measure/measure.component.tsx b/src/components/devsupport/components/measure/measure.component.tsx index 3288e0175..9340cb946 100644 --- a/src/components/devsupport/components/measure/measure.component.tsx +++ b/src/components/devsupport/components/measure/measure.component.tsx @@ -75,7 +75,7 @@ export const MeasureElement: React.FC = (props): MeasuringE const measureSelf = (): void => { const node: number = findNodeHandle(ref.current); - if (typeof node === 'number') UIManager.measureInWindow(node, onUIManagerMeasure); + if (typeof node === 'number' || typeof node === 'object') UIManager.measureInWindow(node, onUIManagerMeasure); }; if (props.force) { From af43065190508eed6463b1b0f4a9cb360644350c Mon Sep 17 00:00:00 2001 From: Pierre Segalen Date: Wed, 20 Dec 2023 12:10:55 +0100 Subject: [PATCH 4/5] Integrated @raqso's feedback --- .../devsupport/components/measure/measure.component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/devsupport/components/measure/measure.component.tsx b/src/components/devsupport/components/measure/measure.component.tsx index 9340cb946..83bba17e7 100644 --- a/src/components/devsupport/components/measure/measure.component.tsx +++ b/src/components/devsupport/components/measure/measure.component.tsx @@ -75,7 +75,7 @@ export const MeasureElement: React.FC = (props): MeasuringE const measureSelf = (): void => { const node: number = findNodeHandle(ref.current); - if (typeof node === 'number' || typeof node === 'object') UIManager.measureInWindow(node, onUIManagerMeasure); + if (node) UIManager.measureInWindow(node, onUIManagerMeasure); }; if (props.force) { From 8701781fe8e134a47a363cdb5564ec633faf31f6 Mon Sep 17 00:00:00 2001 From: Pierre Segalen Date: Wed, 7 Feb 2024 23:48:38 +0100 Subject: [PATCH 5/5] Update measure.component.tsx following @rklomp advice --- .../devsupport/components/measure/measure.component.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/devsupport/components/measure/measure.component.tsx b/src/components/devsupport/components/measure/measure.component.tsx index 83bba17e7..521dbe9f3 100644 --- a/src/components/devsupport/components/measure/measure.component.tsx +++ b/src/components/devsupport/components/measure/measure.component.tsx @@ -56,8 +56,8 @@ export const MeasureElement: React.FC = (props): MeasuringE const boundFrame: Frame = new Frame( frame.origin.x - window.size.width, frame.origin.y, - Math.round(frame.size.width), - Math.round(frame.size.height), + Math.floor(frame.size.width), + Math.floor(frame.size.height), ); return bindToWindow(boundFrame, window); @@ -68,7 +68,7 @@ export const MeasureElement: React.FC = (props): MeasuringE measureSelf(); } else { const originY = props.shouldUseTopInsets ? y + StatusBar.currentHeight || 0 : y; - const frame: Frame = bindToWindow(new Frame(x, originY, Math.round(w), Math.round(h)), Frame.window()); + const frame: Frame = bindToWindow(new Frame(x, originY, Math.floor(w), Math.floor(h)), Frame.window()); props.onMeasure(frame); } };