From e4e5381fd5fef5e5962d4ba4dfa5856a7594af47 Mon Sep 17 00:00:00 2001 From: alexandrius Date: Wed, 2 Apr 2025 17:32:57 +0400 Subject: [PATCH] refactor: resurrect dispatchCommand --- .../RuntimeDecorators/UIRuntimeDecorator.cpp | 8 ++++---- .../src/platformFunctions/dispatchCommand.ts | 16 +++------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp b/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp index 3874bca7e2eb..d8d6b138cc0d 100644 --- a/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +++ b/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp @@ -28,13 +28,13 @@ void UIRuntimeDecorator::decorate( jsi_utils::installJsiFunction(uiRuntime, "_updatePropsFabric", updateProps); jsi_utils::installJsiFunction( uiRuntime, "_removeFromPropsRegistry", removeFromPropsRegistry); -// jsi_utils::installJsiFunction( -// uiRuntime, "_dispatchCommandFabric", dispatchCommand); + jsi_utils::installJsiFunction( + uiRuntime, "_dispatchCommandFabric", dispatchCommand); jsi_utils::installJsiFunction(uiRuntime, "_measureFabric", measure); #else jsi_utils::installJsiFunction(uiRuntime, "_updatePropsPaper", updateProps); -// jsi_utils::installJsiFunction( -// uiRuntime, "_dispatchCommandPaper", dispatchCommand); + jsi_utils::installJsiFunction( + uiRuntime, "_dispatchCommandPaper", dispatchCommand); jsi_utils::installJsiFunction(uiRuntime, "_scrollToPaper", scrollTo); jsi_utils::installJsiFunction( uiRuntime, diff --git a/packages/react-native-reanimated/src/platformFunctions/dispatchCommand.ts b/packages/react-native-reanimated/src/platformFunctions/dispatchCommand.ts index 4a306e9b9832..53fe7ba3c6c9 100644 --- a/packages/react-native-reanimated/src/platformFunctions/dispatchCommand.ts +++ b/packages/react-native-reanimated/src/platformFunctions/dispatchCommand.ts @@ -1,5 +1,5 @@ 'use strict'; -// import type { ShadowNodeWrapper } from '../commonTypes'; +import type { ShadowNodeWrapper } from '../commonTypes'; import { isChromeDebugger, isFabric, @@ -36,39 +36,29 @@ export let dispatchCommand: DispatchCommand; function dispatchCommandFabric( animatedRef: AnimatedRefOnJS | AnimatedRefOnUI, commandName: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars args: Array = [] ) { - /* 'worklet'; + 'worklet'; if (!_WORKLET) { return; } const shadowNodeWrapper = animatedRef() as ShadowNodeWrapper; global._dispatchCommandFabric!(shadowNodeWrapper, commandName, args); -*/ - logger.warn( - 'dispatchCommand() is disabled: https://github.com/ExodusMovement/exodus-mobile/pull/24699. Contact AppSec if you need this.' - ); } function dispatchCommandPaper( animatedRef: AnimatedRefOnJS | AnimatedRefOnUI, commandName: string, - // eslint-disable-next-line @typescript-eslint/no-unused-vars args: Array = [] ) { - /* 'worklet'; + 'worklet'; if (!_WORKLET) { return; } const viewTag = animatedRef() as number; global._dispatchCommandPaper!(viewTag, commandName, args); -*/ - logger.warn( - 'dispatchCommand() is disabled: https://github.com/ExodusMovement/exodus-mobile/pull/24699. Contact AppSec if you need this.' - ); } function dispatchCommandJest() {