Skip to content

Commit 2ae0c20

Browse files
authored
Use device events when remote debugging is enabled (#1929)
Don't rely on Reanimated for receiving events when using remote debugging, as it's not supported by Reanimated 2. Should fix #1797.
1 parent f30117f commit 2ae0c20

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/handlers/gestures/gesture.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
1515
import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
1616
import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
1717
import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
18+
import { isRemoteDebuggingEnabled } from '../../utils';
1819

1920
export type GestureType =
2021
| BaseGesture<Record<string, unknown>>
@@ -278,9 +279,13 @@ export abstract class BaseGesture<
278279
prepare() {}
279280

280281
get shouldUseReanimated(): boolean {
281-
// use Reanimated when runOnJS isn't set explicitly and all defined callbacks are worklets
282+
// use Reanimated when runOnJS isn't set explicitly,
283+
// and all defined callbacks are worklets,
284+
// and remote debugging is disabled
282285
return (
283-
this.config.runOnJS !== true && !this.handlers.isWorklet.includes(false)
286+
this.config.runOnJS !== true &&
287+
!this.handlers.isWorklet.includes(false) &&
288+
!isRemoteDebuggingEnabled()
284289
);
285290
}
286291
}

src/utils.ts

+6
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ export function isFabric(): boolean {
4444
// @ts-expect-error nativeFabricUIManager is not yet included in the RN types
4545
return !!global?.nativeFabricUIManager;
4646
}
47+
48+
export function isRemoteDebuggingEnabled(): boolean {
49+
// react-native-reanimated checks if in remote debugging in the same way
50+
// @ts-ignore global is available but node types are not included
51+
return !(global as any).nativeCallSyncHook || (global as any).__REMOTEDEV__;
52+
}

0 commit comments

Comments
 (0)