File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 55 */
66
77#import < Foundation/Foundation.h>
8+ #import < React/RCTEventEmitter.h>
9+
810@class DdSdkImplementation;
911
1012#ifdef RCT_NEW_ARCH_ENABLED
1113
1214#import < DdSdkReactNative/DdSdkReactNative.h>
13- @interface DdSdk : NSObject <NativeDdSdkSpec>
15+ @interface DdSdk : RCTEventEmitter <NativeDdSdkSpec>
1416
1517#else
1618
1719#import < React/RCTBridgeModule.h>
18- #import < React/RCTEventEmitter.h>
1920@interface DdSdk : RCTEventEmitter <RCTBridgeModule>
2021
2122#endif
2223
23- @property (nonatomic , strong ) DdSdkImplementation* ddSdkImplementation;
24+ @property (nonatomic , strong ) DdSdkImplementation * ddSdkImplementation;
2425
2526+ (void )initFromNative ;
2627
Original file line number Diff line number Diff line change 33 * This product includes software developed at Datadog (https://www.datadoghq.com/).
44 * Copyright 2016-Present Datadog, Inc.
55 */
6-
76import type { GestureResponderEvent } from 'react-native' ;
8- import { NativeEventEmitter , NativeModules } from 'react-native' ;
7+ import { NativeEventEmitter , NativeModules , Platform } from 'react-native' ;
98
109import { InternalLog } from '../InternalLog' ;
1110import { SdkVerbosity } from '../SdkVerbosity' ;
@@ -42,7 +41,10 @@ import type {
4241
4342const generateEmptyPromise = ( ) => new Promise < void > ( resolve => resolve ( ) ) ;
4443
45- const nativeEventEmitter = new NativeEventEmitter ( NativeModules . DdSdk ) ;
44+ const nativeEventEmitter =
45+ Platform . OS === 'android'
46+ ? new NativeEventEmitter ( )
47+ : new NativeEventEmitter ( NativeModules . DdSdk ) ;
4648
4749class DdRumWrapper implements DdRumType {
4850 // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
Original file line number Diff line number Diff line change @@ -62,6 +62,13 @@ export interface Spec extends TurboModule {
6262 * Clears all data that has not already been sent to Datadog servers
6363 */
6464 clearAllData ( ) : Promise < void > ;
65+
66+ /**
67+ * Required definitions, because of:
68+ * https://github.com/react-native-community/RNNewArchitectureLibraries/tree/feat/swift-event-emitter?tab=readme-ov-file#codegen-update-codegen-specs)
69+ */
70+ addListener : ( eventType : string ) => void ;
71+ removeListeners : ( count : number ) => void ;
6572}
6673
6774// eslint-disable-next-line import/no-default-export
You can’t perform that action at this time.
0 commit comments