From 1f07068a7d9adb5788541a419feaeebe11642ea0 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Fri, 10 Nov 2023 05:43:23 -0600 Subject: [PATCH 1/4] fix: RNW patch for measureInWindow --- ...eact-native-web+0.19.9+003+measureInWindow.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patches/react-native-web+0.19.9+003+measureInWindow.patch diff --git a/patches/react-native-web+0.19.9+003+measureInWindow.patch b/patches/react-native-web+0.19.9+003+measureInWindow.patch new file mode 100644 index 000000000000..f41b4b3b48cb --- /dev/null +++ b/patches/react-native-web+0.19.9+003+measureInWindow.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/react-native-web/dist/exports/UIManager/index.js b/node_modules/react-native-web/dist/exports/UIManager/index.js +index 15b71d5..46b9e01 100644 +--- a/node_modules/react-native-web/dist/exports/UIManager/index.js ++++ b/node_modules/react-native-web/dist/exports/UIManager/index.js +@@ -77,7 +77,7 @@ var UIManager = { + measureInWindow(node, callback) { + if (node) { + setTimeout(() => { +- var _getRect2 = getRect(node), ++ var _getRect2 = node.getBoundingClientRect(), + height = _getRect2.height, + left = _getRect2.left, + top = _getRect2.top, From 5e9f3df09f543e4dd734b66563c9efb85fc141d9 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Fri, 10 Nov 2023 05:59:02 -0600 Subject: [PATCH 2/4] fix: remove shouldUseTargetLocation from PopoverWithMeasuredContent --- src/components/EmojiPicker/EmojiPicker.js | 1 - .../EmojiPicker/EmojiPickerButtonDropdown.js | 1 - src/components/PopoverWithMeasuredContent.js | 14 +++----------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/components/EmojiPicker/EmojiPicker.js b/src/components/EmojiPicker/EmojiPicker.js index 75777e37f2ee..d0ba8f80f94b 100644 --- a/src/components/EmojiPicker/EmojiPicker.js +++ b/src/components/EmojiPicker/EmojiPicker.js @@ -164,7 +164,6 @@ const EmojiPicker = forwardRef((props, ref) => { outerStyle={StyleUtils.getOuterModalStyle(windowHeight, props.viewportOffsetTop)} innerContainerStyle={styles.popoverInnerContainer} avoidKeyboard - shouldUseTargetLocation > { let horizontalConstraint; switch (props.anchorAlignment.horizontal) { @@ -111,11 +103,11 @@ function PopoverWithMeasuredContent(props) { break; case CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT: default: - horizontalConstraint = {left: clickedTargetLocation.horizontal}; + horizontalConstraint = {left: props.anchorPosition.horizontal}; } let verticalConstraint; - const anchorLocationVertical = clickedTargetLocation.vertical; + const anchorLocationVertical = props.anchorPosition.vertical; switch (props.anchorAlignment.vertical) { case CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM: @@ -138,7 +130,7 @@ function PopoverWithMeasuredContent(props) { ...horizontalConstraint, ...verticalConstraint, }; - }, [props.anchorPosition, props.anchorAlignment, clickedTargetLocation.vertical, clickedTargetLocation.horizontal, popoverWidth, popoverHeight]); + }, [props.anchorPosition, props.anchorAlignment, popoverWidth, popoverHeight]); const horizontalShift = computeHorizontalShift(adjustedAnchorPosition.left, popoverWidth, windowWidth); const verticalShift = computeVerticalShift(adjustedAnchorPosition.top, popoverHeight, windowHeight); From a75ce3eb8588952d487298ee4f3e618a57f061ec Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Fri, 10 Nov 2023 07:38:58 -0600 Subject: [PATCH 3/4] fix: emoji picker not open first time --- src/components/PopoverWithMeasuredContent.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/PopoverWithMeasuredContent.js b/src/components/PopoverWithMeasuredContent.js index 0f358a1e8ac2..f6e7cf5e5fad 100644 --- a/src/components/PopoverWithMeasuredContent.js +++ b/src/components/PopoverWithMeasuredContent.js @@ -111,9 +111,6 @@ function PopoverWithMeasuredContent(props) { switch (props.anchorAlignment.vertical) { case CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM: - if (!anchorLocationVertical) { - break; - } verticalConstraint = {top: anchorLocationVertical - popoverHeight}; break; case CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.CENTER: From 6bf03f2cf88dca5d28cc57912152a557b6d2a97f Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Fri, 10 Nov 2023 07:53:28 -0600 Subject: [PATCH 4/4] fix: remove unnecessary variable --- src/components/PopoverWithMeasuredContent.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/PopoverWithMeasuredContent.js b/src/components/PopoverWithMeasuredContent.js index f6e7cf5e5fad..04eacfa88ec8 100644 --- a/src/components/PopoverWithMeasuredContent.js +++ b/src/components/PopoverWithMeasuredContent.js @@ -107,11 +107,9 @@ function PopoverWithMeasuredContent(props) { } let verticalConstraint; - const anchorLocationVertical = props.anchorPosition.vertical; - switch (props.anchorAlignment.vertical) { case CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM: - verticalConstraint = {top: anchorLocationVertical - popoverHeight}; + verticalConstraint = {top: props.anchorPosition.vertical - popoverHeight}; break; case CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.CENTER: verticalConstraint = {