From bce832efeff440fa40f8442f4ab297a63e3dcf08 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 6 Nov 2025 08:00:30 +0100 Subject: [PATCH] Fix issue in measure component --- .../components/measure/measure.component.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/devsupport/components/measure/measure.component.tsx b/src/components/devsupport/components/measure/measure.component.tsx index 8abb33f5c..cb111fbae 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.floor(frame.size.width), + Math.floor(frame.size.height), ); return bindToWindow(boundFrame, window); @@ -68,14 +68,16 @@ 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.floor(w), Math.floor(h)), Frame.window()); props.onMeasure(frame); } }; const measureSelf = (): void => { const node: number = findNodeHandle(ref.current); - UIManager.measureInWindow(node, onUIManagerMeasure); + if (node) { + UIManager.measureInWindow(node, onUIManagerMeasure); + } }; if (props.force) { @@ -84,7 +86,3 @@ export const MeasureElement: React.FC = (props): MeasuringE return React.cloneElement(props.children, { ref, onLayout: measureSelf }); }; - -MeasureElement.defaultProps = { - shouldUseTopInsets: false, -};