From a9b0d1aebbfb58b25bb9bc8b296af8d6ab54bdfb Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:14:34 +0100 Subject: [PATCH 01/14] Bump react-native-live-markdown to 0.1.192 --- ios/NewExpensify.xcodeproj/project.pbxproj | 4 -- ios/Podfile.lock | 10 +++-- package-lock.json | 48 +++++++++++++++++----- package.json | 4 +- src/components/RNMarkdownTextInput.tsx | 9 ++-- 5 files changed, 51 insertions(+), 24 deletions(-) diff --git a/ios/NewExpensify.xcodeproj/project.pbxproj b/ios/NewExpensify.xcodeproj/project.pbxproj index cd2598608a0f..3d9119add122 100644 --- a/ios/NewExpensify.xcodeproj/project.pbxproj +++ b/ios/NewExpensify.xcodeproj/project.pbxproj @@ -637,7 +637,6 @@ "${PODS_CONFIGURATION_BUILD_DIR}/GoogleUtilities/GoogleUtilities_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/PromisesObjC/FBLPromises_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RCT-Folly/RCT-Folly_privacy.bundle", - "${PODS_ROOT}/../../node_modules/@expensify/react-native-live-markdown/parser/react-native-live-markdown-parser.js", "${PODS_CONFIGURATION_BUILD_DIR}/RNSVG/RNSVGFilters.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle", @@ -658,7 +657,6 @@ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleUtilities_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FBLPromises_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCT-Folly_privacy.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/react-native-live-markdown-parser.js", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNSVGFilters.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle", @@ -843,7 +841,6 @@ "${PODS_CONFIGURATION_BUILD_DIR}/GoogleUtilities/GoogleUtilities_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/PromisesObjC/FBLPromises_Privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RCT-Folly/RCT-Folly_privacy.bundle", - "${PODS_ROOT}/../../node_modules/@expensify/react-native-live-markdown/parser/react-native-live-markdown-parser.js", "${PODS_CONFIGURATION_BUILD_DIR}/RNSVG/RNSVGFilters.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle", @@ -864,7 +861,6 @@ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleUtilities_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FBLPromises_Privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCT-Folly_privacy.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/react-native-live-markdown-parser.js", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNSVGFilters.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle", diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c8e92768eb9a..519001da3b1a 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2391,7 +2391,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.187): + - RNLiveMarkdown (0.1.192): - DoubleConversion - glog - hermes-engine @@ -2411,9 +2411,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/newarch (= 0.1.187) + - RNLiveMarkdown/newarch (= 0.1.192) + - RNReanimated/worklets - Yoga - - RNLiveMarkdown/newarch (0.1.187): + - RNLiveMarkdown/newarch (0.1.192): - DoubleConversion - glog - hermes-engine @@ -2433,6 +2434,7 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core + - RNReanimated/worklets - Yoga - RNLocalize (2.2.6): - React-Core @@ -3271,7 +3273,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 8781e2529230a1bc3ea8d75e5c3cd071b6c6aed7 RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 8338447b39fcd86596c74b9e0e9509e365a2dd3b + RNLiveMarkdown: 0237c0ab4befe29235f837ee5972eb1f60be59ab RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: 460d6ff97ae49c7d5708c3212c6521697c36a0c4 RNPermissions: 0b1429b55af59d1d08b75a8be2459f65a8ac3f28 diff --git a/package-lock.json b/package-lock.json index c3079b1f9a9b..015e5133ebe6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.187", + "@expensify/react-native-live-markdown": "0.1.192", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", @@ -51,7 +51,7 @@ "date-fns-tz": "^3.2.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.106", + "expensify-common": "2.0.108", "expo": "51.0.31", "expo-av": "14.0.7", "expo-image": "1.12.15", @@ -3503,12 +3503,12 @@ } }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.187", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.187.tgz", - "integrity": "sha512-bw+dfhRN31u2xfG8LCI3e28g5EG/BfkyX1EqjPBRQlDZo4fZsdA61UFW6P8Y4rHlqspjYXJ0vk4ctECRWYl4Yg==", + "version": "0.1.192", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.192.tgz", + "integrity": "sha512-CZghhnKzMWuYXjFW99MEka8WvGkwYB0SAnxY9/wiGMbJEWAgnkT66/iJ5L76vZcRyj2IEhmDiU/LlwZKkxN+gw==", + "hasInstallScript": true, "license": "MIT", "workspaces": [ - "./parser", "./example", "./WebExample" ], @@ -3516,8 +3516,10 @@ "node": ">= 18.0.0" }, "peerDependencies": { + "expensify-common": ">=2.0.108", "react": "*", - "react-native": "*" + "react-native": "*", + "react-native-reanimated": ">=3.16.3" } }, "node_modules/@expo/bunyan": { @@ -18793,6 +18795,8 @@ }, "node_modules/classnames": { "version": "2.5.0", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.0.tgz", + "integrity": "sha512-FQuRlyKinxrb5gwJlfVASbSrDlikDJ07426TrfPsdGLvtochowmkbnSFdQGJ2aoXrSetq5KqGV9emvWpy+91xA==", "license": "MIT", "workspaces": [ "benchmarks" @@ -18876,6 +18880,8 @@ }, "node_modules/clipboard": { "version": "2.0.11", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz", + "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==", "license": "MIT", "dependencies": { "good-listener": "^1.2.2", @@ -20543,6 +20549,8 @@ }, "node_modules/delegate": { "version": "3.2.0", + "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", + "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==", "license": "MIT" }, "node_modules/delegates": { @@ -22956,9 +22964,9 @@ } }, "node_modules/expensify-common": { - "version": "2.0.106", - "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.106.tgz", - "integrity": "sha512-KmxKvglbIUJb0sAcmNxb/AXYAqa3GIZfu3MbmtlYDNJx24mjDjtbGkKhm+16TICDoPj2PDRNogIqgUGWmSSZFQ==", + "version": "2.0.108", + "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.108.tgz", + "integrity": "sha512-q4chHq1dxHJP/5CRTmTiIRrQKZik0Ms2yM6kjCMlCuJT/3aTlFOHCChb24TB/7TgjbSw0utj1cnFhRDfL87RWg==", "license": "MIT", "dependencies": { "awesome-phonenumber": "^5.4.0", @@ -22980,6 +22988,7 @@ "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -22988,7 +22997,9 @@ } }, "node_modules/expensify-common/node_modules/ua-parser-js": { - "version": "1.0.38", + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.39.tgz", + "integrity": "sha512-k24RCVWlEcjkdOxYmVJgeD/0a1TiSpqLg+ZalVGV9lsnr4yqu0w7tX/x2xX6G4zpkgQnRf89lxuZ1wsbjXM8lw==", "funding": [ { "type": "opencollective", @@ -23004,6 +23015,9 @@ } ], "license": "MIT", + "bin": { + "ua-parser-js": "script/cli.js" + }, "engines": { "node": "*" } @@ -24568,6 +24582,8 @@ }, "node_modules/good-listener": { "version": "1.2.2", + "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", + "integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==", "license": "MIT", "dependencies": { "delegate": "^3.1.2" @@ -25397,6 +25413,8 @@ }, "node_modules/immediate": { "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", "license": "MIT" }, "node_modules/import-fresh": { @@ -28678,6 +28696,8 @@ }, "node_modules/jquery": { "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", "license": "MIT" }, "node_modules/js-base64": { @@ -29092,6 +29112,8 @@ }, "node_modules/lie": { "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", + "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", "license": "MIT", "dependencies": { "immediate": "~3.0.5" @@ -29347,6 +29369,8 @@ }, "node_modules/localforage": { "version": "1.10.0", + "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", + "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", "license": "Apache-2.0", "dependencies": { "lie": "3.1.1" @@ -35058,6 +35082,8 @@ }, "node_modules/select": { "version": "1.1.2", + "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", + "integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==", "license": "MIT" }, "node_modules/select-hose": { diff --git a/package.json b/package.json index dfc64c7be0c1..7269ec4bb92d 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ }, "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.187", + "@expensify/react-native-live-markdown": "0.1.192", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", @@ -108,7 +108,7 @@ "date-fns-tz": "^3.2.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.106", + "expensify-common": "2.0.108", "expo": "51.0.31", "expo-av": "14.0.7", "expo-image": "1.12.15", diff --git a/src/components/RNMarkdownTextInput.tsx b/src/components/RNMarkdownTextInput.tsx index d36af6e13826..892b82c84df0 100644 --- a/src/components/RNMarkdownTextInput.tsx +++ b/src/components/RNMarkdownTextInput.tsx @@ -1,5 +1,5 @@ import type {MarkdownTextInputProps} from '@expensify/react-native-live-markdown'; -import {MarkdownTextInput} from '@expensify/react-native-live-markdown'; +import {MarkdownTextInput, parseExpensiMark} from '@expensify/react-native-live-markdown'; import type {ForwardedRef} from 'react'; import React from 'react'; import type {TextInput} from 'react-native'; @@ -9,9 +9,11 @@ import useTheme from '@hooks/useTheme'; // Convert the underlying TextInput into an Animated component so that we can take an animated ref and pass it to a worklet const AnimatedMarkdownTextInput = Animated.createAnimatedComponent(MarkdownTextInput); -type AnimatedMarkdownTextInputRef = typeof AnimatedMarkdownTextInput & TextInput & HTMLInputElement; +type AnimatedMarkdownTextInputRef = typeof AnimatedMarkdownTextInput & MarkdownTextInput & HTMLInputElement; -function RNMarkdownTextInputWithRef(props: MarkdownTextInputProps, ref: ForwardedRef) { +type RNMarkdownTextInputProps = Omit; + +function RNMarkdownTextInputWithRef(props: RNMarkdownTextInputProps, ref: ForwardedRef) { const theme = useTheme(); return ( @@ -19,6 +21,7 @@ function RNMarkdownTextInputWithRef(props: MarkdownTextInputProps, ref: Forwarde allowFontScaling={false} textBreakStrategy="simple" keyboardAppearance={theme.colorScheme} + parser={parseExpensiMark} ref={(refHandle) => { if (typeof ref !== 'function') { return; From 2bc34bb6f296729eaffd7a79c2aea06907e0e978 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:06:12 +0100 Subject: [PATCH 02/14] worklets patch --- ...03+worklets-support-multiple-runtimes.patch | 18 ++++++++++++++++++ src/components/RNMarkdownTextInput.tsx | 1 - .../report/AnimatedEmptyStateBackground.tsx | 8 ++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 patches/react-native-reanimated+3.16.3+003+worklets-support-multiple-runtimes.patch diff --git a/patches/react-native-reanimated+3.16.3+003+worklets-support-multiple-runtimes.patch b/patches/react-native-reanimated+3.16.3+003+worklets-support-multiple-runtimes.patch new file mode 100644 index 000000000000..82d5c23e6f3a --- /dev/null +++ b/patches/react-native-reanimated+3.16.3+003+worklets-support-multiple-runtimes.patch @@ -0,0 +1,18 @@ +diff --git a/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp b/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp +index 4087065..86e2f68 100644 +--- a/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp ++++ b/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp +@@ -302,7 +302,12 @@ jsi::Value ShareableHandle::toJSValue(jsi::Runtime &rt) { + remoteRuntime_ = &rt; + } + } +- return jsi::Value(rt, *remoteValue_); ++ if (&rt == remoteRuntime_) { ++ return jsi::Value(rt, *remoteValue_); ++ } ++ auto initObj = initializer_->toJSValue(rt); ++ return getValueUnpacker(rt).call( ++ rt, initObj, jsi::String::createFromAscii(rt, "Handle")); + } + + jsi::Value ShareableString::toJSValue(jsi::Runtime &rt) { diff --git a/src/components/RNMarkdownTextInput.tsx b/src/components/RNMarkdownTextInput.tsx index 892b82c84df0..26827bed5fa5 100644 --- a/src/components/RNMarkdownTextInput.tsx +++ b/src/components/RNMarkdownTextInput.tsx @@ -2,7 +2,6 @@ import type {MarkdownTextInputProps} from '@expensify/react-native-live-markdown import {MarkdownTextInput, parseExpensiMark} from '@expensify/react-native-live-markdown'; import type {ForwardedRef} from 'react'; import React from 'react'; -import type {TextInput} from 'react-native'; import Animated from 'react-native-reanimated'; import useTheme from '@hooks/useTheme'; diff --git a/src/pages/home/report/AnimatedEmptyStateBackground.tsx b/src/pages/home/report/AnimatedEmptyStateBackground.tsx index 56ae27de5ea1..2c0dca03e54e 100644 --- a/src/pages/home/report/AnimatedEmptyStateBackground.tsx +++ b/src/pages/home/report/AnimatedEmptyStateBackground.tsx @@ -12,6 +12,10 @@ import CONST from '@src/CONST'; const IMAGE_OFFSET_X = 30; const IMAGE_OFFSET_Y = 20; +// This is necessary so we don't send the entire CONST object to the worklet which could lead to performance issues +// https://docs.swmansion.com/react-native-reanimated/docs/guides/worklets/#capturing-closure +const ANIMATION_GYROSCOPE_VALUE = CONST.ANIMATION_GYROSCOPE_VALUE; + function AnimatedEmptyStateBackground() { const StyleUtils = useStyleUtils(); const {windowWidth} = useWindowDimensions(); @@ -37,8 +41,8 @@ function AnimatedEmptyStateBackground() { */ const {x, y} = animatedSensor.sensor.get(); // The x vs y here seems wrong but is the way to make it feel right to the user - xOffset.set((value) => clamp(value + y * CONST.ANIMATION_GYROSCOPE_VALUE, -IMAGE_OFFSET_X, IMAGE_OFFSET_X)); - yOffset.set((value) => clamp(value - x * CONST.ANIMATION_GYROSCOPE_VALUE, -IMAGE_OFFSET_Y, IMAGE_OFFSET_Y)); + xOffset.set((value) => clamp(value + y * ANIMATION_GYROSCOPE_VALUE, -IMAGE_OFFSET_X, IMAGE_OFFSET_X)); + yOffset.set((value) => clamp(value - x * ANIMATION_GYROSCOPE_VALUE, -IMAGE_OFFSET_Y, IMAGE_OFFSET_Y)); return { transform: [{translateX: withSpring(xOffset.get())}, {translateY: withSpring(yOffset.get(), {overshootClamping: true})}, {scale: 1.15}], }; From fd3768d5b2b7ab991ca20e56c1aeca7bf91d3737 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:50:56 +0100 Subject: [PATCH 03/14] patch html-entities --- patches/html-entities+2.5.2.patch | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 patches/html-entities+2.5.2.patch diff --git a/patches/html-entities+2.5.2.patch b/patches/html-entities+2.5.2.patch new file mode 100644 index 000000000000..0df30b6bd686 --- /dev/null +++ b/patches/html-entities+2.5.2.patch @@ -0,0 +1,9 @@ +diff --git a/node_modules/html-entities/lib/index.js b/node_modules/html-entities/lib/index.js +index 3a44c85..c7dfa67 100644 +--- a/node_modules/html-entities/lib/index.js ++++ b/node_modules/html-entities/lib/index.js +@@ -1,2 +1,3 @@ ++"worklet"; // This function is used in react-native-live-markdown parser and it must be a worklet to run in UI thread (react-native-reanimated) + "use strict";var __assign=this&&this.__assign||function(){__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i'"&]/g,nonAscii:/[<>'"&\u0080-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,nonAsciiPrintable:/[<>'"&\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,nonAsciiPrintableOnly:/[\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,extensive:/[\x01-\x0c\x0e-\x1f\x21-\x2c\x2e-\x2f\x3a-\x40\x5b-\x60\x7b-\x7d\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g};var defaultEncodeOptions={mode:"specialChars",level:"all",numeric:"decimal"};function encode(text,_a){var _b=_a===void 0?defaultEncodeOptions:_a,_c=_b.mode,mode=_c===void 0?"specialChars":_c,_d=_b.numeric,numeric=_d===void 0?"decimal":_d,_e=_b.level,level=_e===void 0?"all":_e;if(!text){return""}var encodeRegExp=encodeRegExps[mode];var references=allNamedReferences[level].characters;var isHex=numeric==="hexadecimal";return replaceUsingRegExp(text,encodeRegExp,(function(input){var result=references[input];if(!result){var code=input.length>1?surrogate_pairs_1.getCodePoint(input,0):input.charCodeAt(0);result=(isHex?"&#x"+code.toString(16):"&#"+code)+";"}return result}))}exports.encode=encode;var defaultDecodeOptions={scope:"body",level:"all"};var strict=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g;var attribute=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g;var baseDecodeRegExps={xml:{strict:strict,attribute:attribute,body:named_references_1.bodyRegExps.xml},html4:{strict:strict,attribute:attribute,body:named_references_1.bodyRegExps.html4},html5:{strict:strict,attribute:attribute,body:named_references_1.bodyRegExps.html5}};var decodeRegExps=__assign(__assign({},baseDecodeRegExps),{all:baseDecodeRegExps.html5});var fromCharCode=String.fromCharCode;var outOfBoundsChar=fromCharCode(65533);var defaultDecodeEntityOptions={level:"all"};function getDecodedEntity(entity,references,isAttribute,isStrict){var decodeResult=entity;var decodeEntityLastChar=entity[entity.length-1];if(isAttribute&&decodeEntityLastChar==="="){decodeResult=entity}else if(isStrict&&decodeEntityLastChar!==";"){decodeResult=entity}else{var decodeResultByReference=references[entity];if(decodeResultByReference){decodeResult=decodeResultByReference}else if(entity[0]==="&"&&entity[1]==="#"){var decodeSecondChar=entity[2];var decodeCode=decodeSecondChar=="x"||decodeSecondChar=="X"?parseInt(entity.substr(3),16):parseInt(entity.substr(2));decodeResult=decodeCode>=1114111?outOfBoundsChar:decodeCode>65535?surrogate_pairs_1.fromCodePoint(decodeCode):fromCharCode(numeric_unicode_map_1.numericUnicodeMap[decodeCode]||decodeCode)}}return decodeResult}function decodeEntity(entity,_a){var _b=(_a===void 0?defaultDecodeEntityOptions:_a).level,level=_b===void 0?"all":_b;if(!entity){return""}return getDecodedEntity(entity,allNamedReferences[level].entities,false,false)}exports.decodeEntity=decodeEntity;function decode(text,_a){var _b=_a===void 0?defaultDecodeOptions:_a,_c=_b.level,level=_c===void 0?"all":_c,_d=_b.scope,scope=_d===void 0?level==="xml"?"strict":"body":_d;if(!text){return""}var decodeRegExp=decodeRegExps[level][scope];var references=allNamedReferences[level].entities;var isAttribute=scope==="attribute";var isStrict=scope==="strict";return replaceUsingRegExp(text,decodeRegExp,(function(entity){return getDecodedEntity(entity,references,isAttribute,isStrict)}))}exports.decode=decode; + //# sourceMappingURL=./index.js.map +\ No newline at end of file From 18d23a2a49ac43e916c0f2df97163a3d2093db6d Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 10 Dec 2024 03:04:17 +0100 Subject: [PATCH 04/14] mock LiveMarkdownModule --- .../@expensify/react-native-live-markdown.ts | 13 +++++++++++++ __mocks__/react-native.ts | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 __mocks__/@expensify/react-native-live-markdown.ts diff --git a/__mocks__/@expensify/react-native-live-markdown.ts b/__mocks__/@expensify/react-native-live-markdown.ts new file mode 100644 index 000000000000..eff81596b4d5 --- /dev/null +++ b/__mocks__/@expensify/react-native-live-markdown.ts @@ -0,0 +1,13 @@ +import {MarkdownTextInput} from '@expensify/react-native-live-markdown'; + +global.jsi_registerMarkdownWorklet = jest.fn(); +global.jsi_setMarkdownRuntime = jest.fn(); +global.jsi_registerMarkdownWorklet = jest.fn(); +global.jsi_unregisterMarkdownWorklet = jest.fn(); + +function parseExpensiMark() { + 'worklet'; + return []; +} + +export {MarkdownTextInput, parseExpensiMark}; diff --git a/__mocks__/react-native.ts b/__mocks__/react-native.ts index 4c2a86818e9b..4f590940dc2c 100644 --- a/__mocks__/react-native.ts +++ b/__mocks__/react-native.ts @@ -1,5 +1,6 @@ // eslint-disable-next-line no-restricted-imports import * as ReactNative from 'react-native'; +import {getEnforcing} from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; import type StartupTimer from '@libs/StartupTimer/types'; const {BootSplash} = ReactNative.NativeModules; @@ -42,6 +43,21 @@ jest.doMock('react-native', () => { const reactNativeMock = Object.setPrototypeOf( { + TurboModuleRegistry: { + ...ReactNative.TurboModuleRegistry, + get(name: string) { + if (name === 'LiveMarkdownModule') { + return {install: () => true} as ReactNative.TurboModule; + } + return ReactNative.TurboModuleRegistry.get(name); + }, + getEnforcing(name: string) { + if (name === 'LiveMarkdownModule') { + return {install: () => true} as ReactNative.TurboModule; + } + return ReactNative.TurboModuleRegistry.getEnforcing(name); + }, + }, NativeModules: { ...ReactNative.NativeModules, BootSplash: { From b4a19c26eecb979a8ae861f269915fc9b0b7466f Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 10 Dec 2024 03:07:21 +0100 Subject: [PATCH 05/14] remove unused import --- __mocks__/react-native.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/__mocks__/react-native.ts b/__mocks__/react-native.ts index 4f590940dc2c..507165a9169a 100644 --- a/__mocks__/react-native.ts +++ b/__mocks__/react-native.ts @@ -1,6 +1,5 @@ // eslint-disable-next-line no-restricted-imports import * as ReactNative from 'react-native'; -import {getEnforcing} from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; import type StartupTimer from '@libs/StartupTimer/types'; const {BootSplash} = ReactNative.NativeModules; From eb731978950545652f78c01b7a3457c2ba328e6f Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 10 Dec 2024 03:12:28 +0100 Subject: [PATCH 06/14] better type for parseExpensiMark mock --- __mocks__/@expensify/react-native-live-markdown.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/__mocks__/@expensify/react-native-live-markdown.ts b/__mocks__/@expensify/react-native-live-markdown.ts index eff81596b4d5..46b3ebc553e7 100644 --- a/__mocks__/@expensify/react-native-live-markdown.ts +++ b/__mocks__/@expensify/react-native-live-markdown.ts @@ -1,13 +1,14 @@ -import {MarkdownTextInput} from '@expensify/react-native-live-markdown'; +import {MarkdownTextInput, parseExpensiMark} from '@expensify/react-native-live-markdown'; global.jsi_registerMarkdownWorklet = jest.fn(); global.jsi_setMarkdownRuntime = jest.fn(); global.jsi_registerMarkdownWorklet = jest.fn(); global.jsi_unregisterMarkdownWorklet = jest.fn(); -function parseExpensiMark() { +const parseExpensiMarkMock: typeof parseExpensiMark = () => { 'worklet'; + return []; -} +}; -export {MarkdownTextInput, parseExpensiMark}; +export {MarkdownTextInput, parseExpensiMarkMock as parseExpensiMark}; From ff3c095d965b44793589c024544c432d360ae99b Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 10 Dec 2024 03:15:31 +0100 Subject: [PATCH 07/14] fix lint --- __mocks__/@expensify/react-native-live-markdown.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/__mocks__/@expensify/react-native-live-markdown.ts b/__mocks__/@expensify/react-native-live-markdown.ts index 46b3ebc553e7..cb4106e0218a 100644 --- a/__mocks__/@expensify/react-native-live-markdown.ts +++ b/__mocks__/@expensify/react-native-live-markdown.ts @@ -1,4 +1,5 @@ -import {MarkdownTextInput, parseExpensiMark} from '@expensify/react-native-live-markdown'; +import {MarkdownTextInput} from '@expensify/react-native-live-markdown'; +import type {parseExpensiMark} from '@expensify/react-native-live-markdown'; global.jsi_registerMarkdownWorklet = jest.fn(); global.jsi_setMarkdownRuntime = jest.fn(); From 02d1d08d927519c1a8b8019c0c08c7b3393932fb Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 10 Dec 2024 03:32:41 +0100 Subject: [PATCH 08/14] removed duplicated line --- __mocks__/@expensify/react-native-live-markdown.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/__mocks__/@expensify/react-native-live-markdown.ts b/__mocks__/@expensify/react-native-live-markdown.ts index cb4106e0218a..8437724c6c8b 100644 --- a/__mocks__/@expensify/react-native-live-markdown.ts +++ b/__mocks__/@expensify/react-native-live-markdown.ts @@ -1,7 +1,6 @@ import {MarkdownTextInput} from '@expensify/react-native-live-markdown'; import type {parseExpensiMark} from '@expensify/react-native-live-markdown'; -global.jsi_registerMarkdownWorklet = jest.fn(); global.jsi_setMarkdownRuntime = jest.fn(); global.jsi_registerMarkdownWorklet = jest.fn(); global.jsi_unregisterMarkdownWorklet = jest.fn(); From 4a9bd7cb3bbbbd95ec7b9a229611786ebe4dbbe8 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:01:34 +0100 Subject: [PATCH 09/14] update react-native-live-markdown, expensify-common and react-native-reanimated --- ios/Podfile.lock | 24 +++++++++---------- package-lock.json | 24 +++++++++---------- package.json | 6 ++--- ...3+worklets-support-multiple-runtimes.patch | 18 -------------- ...ve-reanimated+3.16.4+001+hybrid-app.patch} | 0 ...ed+3.16.4+002+dontWhitelistTextProp.patch} | 0 6 files changed, 27 insertions(+), 45 deletions(-) delete mode 100644 patches/react-native-reanimated+3.16.3+003+worklets-support-multiple-runtimes.patch rename patches/{react-native-reanimated+3.16.3+001+hybrid-app.patch => react-native-reanimated+3.16.4+001+hybrid-app.patch} (100%) rename patches/{react-native-reanimated+3.16.3+002+dontWhitelistTextProp.patch => react-native-reanimated+3.16.4+002+dontWhitelistTextProp.patch} (100%) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 519001da3b1a..2c984d9e0eb4 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2391,7 +2391,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.192): + - RNLiveMarkdown (0.1.205): - DoubleConversion - glog - hermes-engine @@ -2411,10 +2411,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/newarch (= 0.1.192) + - RNLiveMarkdown/newarch (= 0.1.205) - RNReanimated/worklets - Yoga - - RNLiveMarkdown/newarch (0.1.192): + - RNLiveMarkdown/newarch (0.1.205): - DoubleConversion - glog - hermes-engine @@ -2505,7 +2505,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNReanimated (3.16.3): + - RNReanimated (3.16.4): - DoubleConversion - glog - hermes-engine @@ -2525,10 +2525,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNReanimated/reanimated (= 3.16.3) - - RNReanimated/worklets (= 3.16.3) + - RNReanimated/reanimated (= 3.16.4) + - RNReanimated/worklets (= 3.16.4) - Yoga - - RNReanimated/reanimated (3.16.3): + - RNReanimated/reanimated (3.16.4): - DoubleConversion - glog - hermes-engine @@ -2548,9 +2548,9 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNReanimated/reanimated/apple (= 3.16.3) + - RNReanimated/reanimated/apple (= 3.16.4) - Yoga - - RNReanimated/reanimated/apple (3.16.3): + - RNReanimated/reanimated/apple (3.16.4): - DoubleConversion - glog - hermes-engine @@ -2571,7 +2571,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNReanimated/worklets (3.16.3): + - RNReanimated/worklets (3.16.4): - DoubleConversion - glog - hermes-engine @@ -3273,12 +3273,12 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 8781e2529230a1bc3ea8d75e5c3cd071b6c6aed7 RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 0237c0ab4befe29235f837ee5972eb1f60be59ab + RNLiveMarkdown: bf0f16b1e8c3320d600a5931d270e19afef9fa92 RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: 460d6ff97ae49c7d5708c3212c6521697c36a0c4 RNPermissions: 0b1429b55af59d1d08b75a8be2459f65a8ac3f28 RNReactNativeHapticFeedback: 73756a3477a5a622fa16862a3ab0d0fc5e5edff5 - RNReanimated: 03ba2447d5a7789e2843df2ee05108d93b6441d6 + RNReanimated: d95f865e1e42c34ca56b987e0719a8c72fc02dbc RNScreens: de6e57426ba0e6cbc3fb5b4f496e7f08cb2773c2 RNShare: bd4fe9b95d1ee89a200778cc0753ebe650154bb0 RNSound: 6c156f925295bdc83e8e422e7d8b38d33bc71852 diff --git a/package-lock.json b/package-lock.json index 2af4c6847f48..115ec8814f5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.192", + "@expensify/react-native-live-markdown": "0.1.205", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", @@ -51,7 +51,7 @@ "date-fns-tz": "^3.2.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.108", + "expensify-common": "2.0.109", "expo": "51.0.31", "expo-av": "14.0.7", "expo-image": "1.12.15", @@ -104,7 +104,7 @@ "react-native-plaid-link-sdk": "11.11.0", "react-native-qrcode-svg": "6.3.11", "react-native-quick-sqlite": "git+https://github.com/margelo/react-native-nitro-sqlite#99f34ebefa91698945f3ed26622e002bd79489e0", - "react-native-reanimated": "3.16.3", + "react-native-reanimated": "3.16.4", "react-native-release-profiler": "^0.2.1", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.10.9", @@ -3498,9 +3498,9 @@ } }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.192", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.192.tgz", - "integrity": "sha512-CZghhnKzMWuYXjFW99MEka8WvGkwYB0SAnxY9/wiGMbJEWAgnkT66/iJ5L76vZcRyj2IEhmDiU/LlwZKkxN+gw==", + "version": "0.1.205", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.205.tgz", + "integrity": "sha512-+GST0Yp7HJeZN+k43ehf/WXcUL96ejzE1anaANKkKbn5gTDmAcnQ0oBte1CqWW3eNJEjrbWBnZqSFdbqp56DLw==", "hasInstallScript": true, "license": "MIT", "workspaces": [ @@ -21562,9 +21562,9 @@ } }, "node_modules/expensify-common": { - "version": "2.0.108", - "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.108.tgz", - "integrity": "sha512-q4chHq1dxHJP/5CRTmTiIRrQKZik0Ms2yM6kjCMlCuJT/3aTlFOHCChb24TB/7TgjbSw0utj1cnFhRDfL87RWg==", + "version": "2.0.109", + "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.109.tgz", + "integrity": "sha512-5XTrJxiDSjQhojnJfXH1G+fSgRM92oAJ5HiLo28HppmJQuA350GOONVo88rRalcI029rlYGIMh8WfhMlOuE/gA==", "license": "MIT", "dependencies": { "awesome-phonenumber": "^5.4.0", @@ -32303,9 +32303,9 @@ } }, "node_modules/react-native-reanimated": { - "version": "3.16.3", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.16.3.tgz", - "integrity": "sha512-OWlA6e1oHhytTpc7WiSZ7Tmb8OYwLKYZz29Sz6d6WAg60Hm5GuAiKIWUG7Ako7FLcYhFkA0pEQ2xPMEYUo9vlw==", + "version": "3.16.4", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.16.4.tgz", + "integrity": "sha512-dF1Vvu8gG+p0+DmBhKMTx5X9iw/rH1ZF9WaIn2nW0c5rxsVFf00axmDgaAdPxNWblmtLnroaKwrV7SjMUyOx+g==", "license": "MIT", "dependencies": { "@babel/plugin-transform-arrow-functions": "^7.0.0-0", diff --git a/package.json b/package.json index d221d62648f6..c3074f740bf9 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ }, "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.192", + "@expensify/react-native-live-markdown": "0.1.205", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", @@ -108,7 +108,7 @@ "date-fns-tz": "^3.2.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.108", + "expensify-common": "2.0.109", "expo": "51.0.31", "expo-av": "14.0.7", "expo-image": "1.12.15", @@ -161,7 +161,7 @@ "react-native-plaid-link-sdk": "11.11.0", "react-native-qrcode-svg": "6.3.11", "react-native-quick-sqlite": "git+https://github.com/margelo/react-native-nitro-sqlite#99f34ebefa91698945f3ed26622e002bd79489e0", - "react-native-reanimated": "3.16.3", + "react-native-reanimated": "3.16.4", "react-native-release-profiler": "^0.2.1", "react-native-render-html": "6.3.1", "react-native-safe-area-context": "4.10.9", diff --git a/patches/react-native-reanimated+3.16.3+003+worklets-support-multiple-runtimes.patch b/patches/react-native-reanimated+3.16.3+003+worklets-support-multiple-runtimes.patch deleted file mode 100644 index 82d5c23e6f3a..000000000000 --- a/patches/react-native-reanimated+3.16.3+003+worklets-support-multiple-runtimes.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp b/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp -index 4087065..86e2f68 100644 ---- a/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp -+++ b/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp -@@ -302,7 +302,12 @@ jsi::Value ShareableHandle::toJSValue(jsi::Runtime &rt) { - remoteRuntime_ = &rt; - } - } -- return jsi::Value(rt, *remoteValue_); -+ if (&rt == remoteRuntime_) { -+ return jsi::Value(rt, *remoteValue_); -+ } -+ auto initObj = initializer_->toJSValue(rt); -+ return getValueUnpacker(rt).call( -+ rt, initObj, jsi::String::createFromAscii(rt, "Handle")); - } - - jsi::Value ShareableString::toJSValue(jsi::Runtime &rt) { diff --git a/patches/react-native-reanimated+3.16.3+001+hybrid-app.patch b/patches/react-native-reanimated+3.16.4+001+hybrid-app.patch similarity index 100% rename from patches/react-native-reanimated+3.16.3+001+hybrid-app.patch rename to patches/react-native-reanimated+3.16.4+001+hybrid-app.patch diff --git a/patches/react-native-reanimated+3.16.3+002+dontWhitelistTextProp.patch b/patches/react-native-reanimated+3.16.4+002+dontWhitelistTextProp.patch similarity index 100% rename from patches/react-native-reanimated+3.16.3+002+dontWhitelistTextProp.patch rename to patches/react-native-reanimated+3.16.4+002+dontWhitelistTextProp.patch From 1717f7b13847297b5d4d08a870e9e023fad04683 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:55:06 +0100 Subject: [PATCH 10/14] update react-native-live-markdown to 0.1.207 --- .../@expensify/react-native-live-markdown.ts | 15 +-------------- __mocks__/react-native.ts | 15 --------------- ios/Podfile.lock | 8 ++++---- package-lock.json | 10 +++++----- package.json | 2 +- 5 files changed, 11 insertions(+), 39 deletions(-) diff --git a/__mocks__/@expensify/react-native-live-markdown.ts b/__mocks__/@expensify/react-native-live-markdown.ts index 8437724c6c8b..3ee327efed40 100644 --- a/__mocks__/@expensify/react-native-live-markdown.ts +++ b/__mocks__/@expensify/react-native-live-markdown.ts @@ -1,14 +1 @@ -import {MarkdownTextInput} from '@expensify/react-native-live-markdown'; -import type {parseExpensiMark} from '@expensify/react-native-live-markdown'; - -global.jsi_setMarkdownRuntime = jest.fn(); -global.jsi_registerMarkdownWorklet = jest.fn(); -global.jsi_unregisterMarkdownWorklet = jest.fn(); - -const parseExpensiMarkMock: typeof parseExpensiMark = () => { - 'worklet'; - - return []; -}; - -export {MarkdownTextInput, parseExpensiMarkMock as parseExpensiMark}; +export * from '@expensify/react-native-live-markdown/mock'; diff --git a/__mocks__/react-native.ts b/__mocks__/react-native.ts index 507165a9169a..4c2a86818e9b 100644 --- a/__mocks__/react-native.ts +++ b/__mocks__/react-native.ts @@ -42,21 +42,6 @@ jest.doMock('react-native', () => { const reactNativeMock = Object.setPrototypeOf( { - TurboModuleRegistry: { - ...ReactNative.TurboModuleRegistry, - get(name: string) { - if (name === 'LiveMarkdownModule') { - return {install: () => true} as ReactNative.TurboModule; - } - return ReactNative.TurboModuleRegistry.get(name); - }, - getEnforcing(name: string) { - if (name === 'LiveMarkdownModule') { - return {install: () => true} as ReactNative.TurboModule; - } - return ReactNative.TurboModuleRegistry.getEnforcing(name); - }, - }, NativeModules: { ...ReactNative.NativeModules, BootSplash: { diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2c984d9e0eb4..a8af1baf9715 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2391,7 +2391,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.205): + - RNLiveMarkdown (0.1.207): - DoubleConversion - glog - hermes-engine @@ -2411,10 +2411,10 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/newarch (= 0.1.205) + - RNLiveMarkdown/newarch (= 0.1.207) - RNReanimated/worklets - Yoga - - RNLiveMarkdown/newarch (0.1.205): + - RNLiveMarkdown/newarch (0.1.207): - DoubleConversion - glog - hermes-engine @@ -3273,7 +3273,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 8781e2529230a1bc3ea8d75e5c3cd071b6c6aed7 RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: bf0f16b1e8c3320d600a5931d270e19afef9fa92 + RNLiveMarkdown: 8f9d9b32a25969ddb5f59eb92136b73823bbd141 RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: 460d6ff97ae49c7d5708c3212c6521697c36a0c4 RNPermissions: 0b1429b55af59d1d08b75a8be2459f65a8ac3f28 diff --git a/package-lock.json b/package-lock.json index 115ec8814f5b..151fbeda092a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.205", + "@expensify/react-native-live-markdown": "0.1.207", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", @@ -3498,9 +3498,9 @@ } }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.205", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.205.tgz", - "integrity": "sha512-+GST0Yp7HJeZN+k43ehf/WXcUL96ejzE1anaANKkKbn5gTDmAcnQ0oBte1CqWW3eNJEjrbWBnZqSFdbqp56DLw==", + "version": "0.1.207", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.207.tgz", + "integrity": "sha512-8snKeruLuHJCecnwQ+ru6pJhrDeI2Y3EywmXf/keT4aMk2xcW1fyCAr925zikTWANMDghcKkeuR/JqLe2b3rkA==", "hasInstallScript": true, "license": "MIT", "workspaces": [ @@ -3514,7 +3514,7 @@ "expensify-common": ">=2.0.108", "react": "*", "react-native": "*", - "react-native-reanimated": ">=3.16.3" + "react-native-reanimated": ">=3.16.4" } }, "node_modules/@expo/bunyan": { diff --git a/package.json b/package.json index c3074f740bf9..b7d466c28788 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ }, "dependencies": { "@dotlottie/react-player": "^1.6.3", - "@expensify/react-native-live-markdown": "0.1.205", + "@expensify/react-native-live-markdown": "0.1.207", "@expo/metro-runtime": "~3.2.3", "@firebase/app": "^0.10.10", "@firebase/performance": "^0.6.8", From 9dd7f4fe9c9595fdce5a7c4fd3bf42f6a56e542d Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:36:14 +0100 Subject: [PATCH 11/14] Delete patches/react-native-reanimated+3.16.4+001+hybrid-app.patch --- ...ative-reanimated+3.16.4+001+hybrid-app.patch | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 patches/react-native-reanimated+3.16.4+001+hybrid-app.patch diff --git a/patches/react-native-reanimated+3.16.4+001+hybrid-app.patch b/patches/react-native-reanimated+3.16.4+001+hybrid-app.patch deleted file mode 100644 index 835df1f034a9..000000000000 --- a/patches/react-native-reanimated+3.16.4+001+hybrid-app.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/node_modules/react-native-reanimated/scripts/reanimated_utils.rb b/node_modules/react-native-reanimated/scripts/reanimated_utils.rb -index 9fc7b15..e453d84 100644 ---- a/node_modules/react-native-reanimated/scripts/reanimated_utils.rb -+++ b/node_modules/react-native-reanimated/scripts/reanimated_utils.rb -@@ -17,7 +17,11 @@ def find_config() - :react_native_reanimated_dir_from_pods_root => nil, - } - -- react_native_node_modules_dir = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`), '..') -+ root_project = Pod::Config.instance.installation_root.to_s -+ if(ENV['PROJECT_ROOT_DIR']) -+ root_project = ENV['PROJECT_ROOT_DIR'] -+ end -+ react_native_node_modules_dir = File.join(File.dirname(`cd "#{root_project}" && node --print "require.resolve('react-native/package.json')"`), '..') - react_native_json = try_to_parse_react_native_package_json(react_native_node_modules_dir) - - if react_native_json == nil From 129ea27d036072c93276cda9846af07039fadc96 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:07:53 +0100 Subject: [PATCH 12/14] Add back "Clean up deleted files" task --- .github/workflows/reassurePerformanceTests.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index ed5803c35b42..bb7d8c920e98 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -22,6 +22,16 @@ jobs: git config --global user.email "test@test.com" git config --global user.name "Test" + - name: Clean up deleted files + run: | + DELETED_FILES=$(git diff --name-only --diff-filter=D "$COMMIT_HASH" "${{ github.sha }}") + for file in $DELETED_FILES; do + if [ -n "$file" ]; then + rm -f "$file" + echo "Deleted file: $file" + fi + done + - name: Run performance testing script shell: bash run: | From 0eb5bd5dfb7531a1e8b2099d781b49e02fa99494 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:12:20 +0100 Subject: [PATCH 13/14] Add back "Get common ancestor commit" task --- .github/workflows/reassurePerformanceTests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index bb7d8c920e98..08a30b0d35eb 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -22,6 +22,12 @@ jobs: git config --global user.email "test@test.com" git config --global user.name "Test" + - name: Get common ancestor commit + run: | + git fetch origin main + common_ancestor=$(git merge-base "${{ github.sha }}" origin/main) + echo "COMMIT_HASH=$common_ancestor" >> "$GITHUB_ENV" + - name: Clean up deleted files run: | DELETED_FILES=$(git diff --name-only --diff-filter=D "$COMMIT_HASH" "${{ github.sha }}") From 9a1b9547bd60a0b2d9da99e92bb783c4357135e2 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:21:57 +0100 Subject: [PATCH 14/14] add comment to trigger git diff --- .github/workflows/reassurePerformanceTests.yml | 16 ---------------- ...imated+3.16.4+002+dontWhitelistTextProp.patch | 1 + 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/.github/workflows/reassurePerformanceTests.yml b/.github/workflows/reassurePerformanceTests.yml index 08a30b0d35eb..ed5803c35b42 100644 --- a/.github/workflows/reassurePerformanceTests.yml +++ b/.github/workflows/reassurePerformanceTests.yml @@ -22,22 +22,6 @@ jobs: git config --global user.email "test@test.com" git config --global user.name "Test" - - name: Get common ancestor commit - run: | - git fetch origin main - common_ancestor=$(git merge-base "${{ github.sha }}" origin/main) - echo "COMMIT_HASH=$common_ancestor" >> "$GITHUB_ENV" - - - name: Clean up deleted files - run: | - DELETED_FILES=$(git diff --name-only --diff-filter=D "$COMMIT_HASH" "${{ github.sha }}") - for file in $DELETED_FILES; do - if [ -n "$file" ]; then - rm -f "$file" - echo "Deleted file: $file" - fi - done - - name: Run performance testing script shell: bash run: | diff --git a/patches/react-native-reanimated+3.16.4+002+dontWhitelistTextProp.patch b/patches/react-native-reanimated+3.16.4+002+dontWhitelistTextProp.patch index 6084dca4adc8..934da3014441 100644 --- a/patches/react-native-reanimated+3.16.4+002+dontWhitelistTextProp.patch +++ b/patches/react-native-reanimated+3.16.4+002+dontWhitelistTextProp.patch @@ -1,5 +1,6 @@ diff --git a/node_modules/react-native-reanimated/src/component/PerformanceMonitor.tsx b/node_modules/react-native-reanimated/src/component/PerformanceMonitor.tsx index 38e3d39..9936670 100644 + --- a/node_modules/react-native-reanimated/src/component/PerformanceMonitor.tsx +++ b/node_modules/react-native-reanimated/src/component/PerformanceMonitor.tsx @@ -46,7 +46,6 @@ function createCircularDoublesBuffer(size: number) {