expo-modules-core 0.7.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +1 -1
  3. package/android/ExpoModulesCorePlugin.gradle +15 -0
  4. package/android/build.gradle +46 -32
  5. package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +5 -5
  6. package/android/src/main/java/expo/modules/adapters/react/services/UIManagerModuleWrapper.java +13 -0
  7. package/android/src/main/java/expo/modules/core/ViewManager.java +9 -0
  8. package/android/src/main/java/expo/modules/core/interfaces/JavaScriptContextProvider.java +4 -0
  9. package/android/src/main/java/expo/modules/core/interfaces/ReactActivityHandler.java +37 -1
  10. package/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +30 -0
  11. package/android/src/main/java/expo/modules/core/interfaces/services/UIManager.java +2 -0
  12. package/android/src/main/java/expo/modules/kotlin/AppContext.kt +13 -5
  13. package/android/src/main/java/expo/modules/kotlin/KPromiseWrapper.kt +2 -13
  14. package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +11 -5
  15. package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +5 -1
  16. package/android/src/main/java/expo/modules/kotlin/ModuleRegistry.kt +17 -0
  17. package/android/src/main/java/expo/modules/kotlin/callbacks/ViewCallback.kt +14 -3
  18. package/android/src/main/java/expo/modules/kotlin/events/EventEmitter.kt +13 -0
  19. package/android/src/main/java/expo/modules/kotlin/events/KModuleEventEmitterWrapper.kt +102 -0
  20. package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +25 -1
  21. package/android/src/main/java/expo/modules/kotlin/{methods/AnyMethod.kt → functions/AnyFunction.kt} +6 -5
  22. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunction.kt +15 -0
  23. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +170 -0
  24. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionWithPromise.kt +15 -0
  25. package/android/src/main/java/expo/modules/kotlin/functions/AsyncSuspendFunction.kt +36 -0
  26. package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +14 -0
  27. package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +374 -41
  28. package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionData.kt +2 -2
  29. package/android/src/main/java/expo/modules/kotlin/records/FieldValidator.kt +139 -0
  30. package/android/src/main/java/expo/modules/kotlin/records/Record.kt +0 -39
  31. package/android/src/main/java/expo/modules/kotlin/records/RecordTypeConverter.kt +59 -10
  32. package/android/src/main/java/expo/modules/kotlin/records/Required.kt +5 -0
  33. package/android/src/main/java/expo/modules/kotlin/records/ValidationBinder.kt +110 -0
  34. package/android/src/main/java/expo/modules/kotlin/records/Validators.kt +61 -0
  35. package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverter.kt +35 -0
  36. package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverterHelper.kt +148 -0
  37. package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +9 -1
  38. package/android/src/main/java/expo/modules/kotlin/views/GroupViewManagerWrapper.kt +49 -0
  39. package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinition.kt +18 -0
  40. package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinitionBuilder.kt +114 -0
  41. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinition.kt +4 -1
  42. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +56 -5
  43. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerWrapperDelegate.kt +3 -0
  44. package/build/NativeModulesProxy.native.d.ts +0 -4
  45. package/build/NativeModulesProxy.native.d.ts.map +1 -1
  46. package/build/NativeModulesProxy.native.js +1 -14
  47. package/build/NativeModulesProxy.native.js.map +1 -1
  48. package/build/NativeModulesProxy.types.d.ts +0 -3
  49. package/build/NativeModulesProxy.types.d.ts.map +1 -1
  50. package/build/NativeModulesProxy.types.js.map +1 -1
  51. package/build/NativeViewManagerAdapter.native.d.ts.map +1 -1
  52. package/build/NativeViewManagerAdapter.native.js +9 -33
  53. package/build/NativeViewManagerAdapter.native.js.map +1 -1
  54. package/build/sweet/NativeErrorManager.js +1 -1
  55. package/build/sweet/NativeErrorManager.js.map +1 -1
  56. package/ios/AppDelegates/EXAppDelegatesLoader.m +4 -8
  57. package/ios/AppDelegates/ExpoAppDelegate.swift +4 -10
  58. package/ios/EXAppDefines.h +1 -0
  59. package/ios/EXAppDefines.m +6 -0
  60. package/ios/EXUtilities.h +2 -0
  61. package/ios/EXUtilities.m +12 -0
  62. package/ios/ExpoModulesCore.h +4 -0
  63. package/ios/ExpoModulesCore.podspec +4 -2
  64. package/ios/Interfaces/FileSystem/EXFileSystemInterface.h +1 -1
  65. package/ios/Interfaces/TaskManager/EXTaskServiceInterface.h +1 -0
  66. package/ios/JSI/{JSIConversions.h → EXJSIConversions.h} +4 -1
  67. package/ios/JSI/{JSIConversions.mm → EXJSIConversions.mm} +16 -5
  68. package/ios/JSI/{JSIInstaller.h → EXJSIInstaller.h} +3 -3
  69. package/ios/JSI/EXJSIInstaller.mm +17 -0
  70. package/ios/JSI/{ExpoModulesProxySpec.h → EXJSIUtils.h} +0 -9
  71. package/ios/JSI/{ExpoModulesProxySpec.mm → EXJSIUtils.mm} +4 -48
  72. package/ios/JSI/EXJavaScriptObject.h +97 -0
  73. package/ios/JSI/EXJavaScriptObject.mm +121 -0
  74. package/ios/JSI/{JavaScriptRuntime.h → EXJavaScriptRuntime.h} +27 -8
  75. package/ios/JSI/EXJavaScriptRuntime.mm +153 -0
  76. package/ios/JSI/EXJavaScriptValue.h +57 -0
  77. package/ios/JSI/EXJavaScriptValue.mm +166 -0
  78. package/ios/JSI/ExpoModulesHostObject.mm +2 -1
  79. package/ios/JSI/JavaScriptRuntime.swift +32 -0
  80. package/ios/JSI/JavaScriptValue.swift +94 -0
  81. package/ios/ModuleRegistryAdapter/EXModuleRegistryAdapter.m +1 -11
  82. package/ios/NativeModulesProxy/EXNativeModulesProxy.h +2 -2
  83. package/ios/NativeModulesProxy/EXNativeModulesProxy.mm +24 -22
  84. package/ios/ReactDelegates/EXReactCompatibleHelpers.h +18 -0
  85. package/ios/ReactDelegates/EXReactCompatibleHelpers.m +19 -0
  86. package/ios/ReactDelegates/ExpoReactDelegate.swift +2 -2
  87. package/ios/ReactDelegates/ExpoReactDelegateHandler.swift +1 -1
  88. package/ios/Swift/AppContext.swift +21 -2
  89. package/ios/Swift/Arguments/AnyArgumentType.swift +1 -1
  90. package/ios/Swift/Functions/AnyFunction.swift +5 -0
  91. package/ios/Swift/Functions/AsyncFunctionComponent.swift +182 -0
  92. package/ios/Swift/Functions/ConcreteFunction.swift +40 -68
  93. package/ios/Swift/Functions/SyncFunctionComponent.swift +181 -0
  94. package/ios/Swift/JavaScriptUtils.swift +56 -0
  95. package/ios/Swift/ModuleHolder.swift +17 -5
  96. package/ios/Swift/Modules/ModuleDefinitionComponents.swift +66 -44
  97. package/ios/Swift/ModulesProvider.swift +3 -10
  98. package/ios/Swift/Objects/ObjectDefinitionComponents.swift +49 -0
  99. package/ios/Swift/SwiftInteropBridge.swift +14 -5
  100. package/ios/Swift/Views/ComponentData.swift +2 -1
  101. package/ios/Swift/Views/ExpoView.swift +8 -0
  102. package/ios/Swift/Views/ViewManagerDefinitionComponents.swift +23 -0
  103. package/ios/Swift.h +5 -0
  104. package/ios/Tests/ArgumentTypeSpec.swift +2 -3
  105. package/ios/Tests/ConstantsSpec.swift +6 -7
  106. package/ios/Tests/ConvertiblesSpec.swift +2 -3
  107. package/ios/Tests/ExceptionsSpec.swift +2 -3
  108. package/ios/Tests/ExpoModulesSpec.swift +75 -0
  109. package/ios/Tests/FunctionSpec.swift +13 -15
  110. package/ios/Tests/FunctionWithConvertiblesSpec.swift +4 -5
  111. package/ios/Tests/JavaScriptObjectSpec.swift +97 -0
  112. package/ios/Tests/JavaScriptRuntimeSpec.swift +94 -0
  113. package/ios/Tests/ModuleEventListenersSpec.swift +15 -16
  114. package/ios/Tests/ModuleRegistrySpec.swift +2 -3
  115. package/ios/Tests/RecordSpec.swift +2 -3
  116. package/package.json +2 -2
  117. package/src/NativeModulesProxy.native.ts +2 -22
  118. package/src/NativeModulesProxy.types.ts +0 -8
  119. package/src/NativeViewManagerAdapter.native.tsx +12 -28
  120. package/src/sweet/NativeErrorManager.ts +1 -1
  121. package/android/src/main/java/expo/modules/kotlin/events/KEventEmitterWrapper.kt +0 -26
  122. package/android/src/main/java/expo/modules/kotlin/methods/Method.kt +0 -14
  123. package/android/src/main/java/expo/modules/kotlin/methods/PromiseMethod.kt +0 -15
  124. package/ios/JSI/JSIInstaller.mm +0 -34
  125. package/ios/JSI/JavaScriptObject.h +0 -60
  126. package/ios/JSI/JavaScriptObject.mm +0 -93
  127. package/ios/JSI/JavaScriptRuntime.mm +0 -102
  128. package/ios/NativeModulesProxy/EXComponentDataCompatibleWrapper.h +0 -16
  129. package/ios/NativeModulesProxy/EXComponentDataCompatibleWrapper.m +0 -28
@@ -1,34 +0,0 @@
1
- // Copyright 2018-present 650 Industries. All rights reserved.
2
-
3
- #import <ExpoModulesCore/JSIInstaller.h>
4
- #import <ExpoModulesCore/ExpoModulesProxySpec.h>
5
- #import <ExpoModulesCore/ExpoModulesHostObject.h>
6
- #import <ExpoModulesCore/Swift.h>
7
-
8
- using namespace facebook;
9
- using namespace react;
10
-
11
- namespace expo {
12
-
13
- void installRuntimeObjects(jsi::Runtime &runtime, std::shared_ptr<CallInvoker> callInvoker, EXNativeModulesProxy *nativeModulesProxy)
14
- {
15
- auto expoModulesProxyModule = std::make_shared<ExpoModulesProxySpec>(callInvoker, nativeModulesProxy);
16
-
17
- runtime
18
- .global()
19
- .setProperty(runtime, "ExpoModulesProxy", jsi::Object::createFromHostObject(runtime, expoModulesProxyModule));
20
- }
21
-
22
- } // namespace expo
23
-
24
- @implementation JavaScriptRuntimeManager
25
-
26
- + (void)installExpoModulesToRuntime:(nonnull JavaScriptRuntime *)runtime withSwiftInterop:(nonnull SwiftInteropBridge *)swiftInterop
27
- {
28
- std::shared_ptr<expo::ExpoModulesHostObject> hostObjectPtr = std::make_shared<expo::ExpoModulesHostObject>(swiftInterop);
29
- JavaScriptObject *global = [runtime global];
30
-
31
- global[@"ExpoModules"] = [runtime createHostObject:hostObjectPtr];
32
- }
33
-
34
- @end
@@ -1,60 +0,0 @@
1
- // Copyright 2022-present 650 Industries. All rights reserved.
2
-
3
- #import <Foundation/Foundation.h>
4
- #import <React/RCTBridgeModule.h>
5
-
6
- #ifdef __cplusplus
7
- #import <jsi/jsi.h>
8
- #import <ReactCommon/CallInvoker.h>
9
-
10
- namespace jsi = facebook::jsi;
11
- #endif // __cplusplus
12
-
13
- typedef void (^JSAsyncFunctionBlock)(NSArray * _Nonnull, RCTPromiseResolveBlock _Nonnull, RCTPromiseRejectBlock _Nonnull);
14
- typedef id _Nullable (^JSSyncFunctionBlock)(NSArray * _Nonnull);
15
-
16
- @class JavaScriptRuntime;
17
-
18
- @interface JavaScriptObject : NSObject
19
-
20
- // Some parts of the interface must be hidden for Swift – it can't import any C++ code.
21
- #ifdef __cplusplus
22
- - (nonnull instancetype)initWith:(std::shared_ptr<jsi::Object>)jsObjectPtr
23
- runtime:(nonnull JavaScriptRuntime *)runtime;
24
-
25
- /**
26
- Returns the pointer to the underlying object.
27
- */
28
- - (nonnull jsi::Object *)get;
29
- #endif // __cplusplus
30
-
31
- #pragma mark - Subscripting
32
-
33
- /**
34
- Subscript getter. Supports only values convertible to Foundation types, otherwise `nil` is returned.
35
- */
36
- - (nullable id)objectForKeyedSubscript:(nonnull NSString *)key;
37
-
38
- /**
39
- Subscript setter. Only `JavaScriptObject` and Foundation object convertible to JSI values can be used as a value,
40
- otherwise the property is set to `undefined`.
41
- */
42
- - (void)setObject:(nullable id)obj forKeyedSubscript:(nonnull NSString *)key;
43
-
44
- #pragma mark - Functions
45
-
46
- /**
47
- Sets given function block on the object as a host function returning a promise.
48
- */
49
- - (void)setAsyncFunction:(nonnull NSString *)key
50
- argsCount:(NSInteger)argsCount
51
- block:(nonnull JSAsyncFunctionBlock)block;
52
-
53
- /**
54
- Sets given synchronous function block as a host function on the object.
55
- */
56
- - (void)setSyncFunction:(nonnull NSString *)name
57
- argsCount:(NSInteger)argsCount
58
- block:(nonnull JSSyncFunctionBlock)block;
59
-
60
- @end
@@ -1,93 +0,0 @@
1
- // Copyright 2022-present 650 Industries. All rights reserved.
2
-
3
- #import <ExpoModulesCore/JSIConversions.h>
4
- #import <ExpoModulesCore/JavaScriptObject.h>
5
- #import <ExpoModulesCore/JavaScriptRuntime.h>
6
- #import <ExpoModulesCore/ExpoModulesProxySpec.h>
7
-
8
- @implementation JavaScriptObject {
9
- /**
10
- Pointer to the `JavaScriptRuntime` wrapper.
11
-
12
- \note It must be weak because only then the original runtime can be safely deallocated
13
- when the JS engine wants to without unsetting it on each created object.
14
- */
15
- __weak JavaScriptRuntime *_runtime;
16
-
17
- /**
18
- Shared pointer to the original JSI object that is being wrapped by `JavaScriptObject` class.
19
- */
20
- std::shared_ptr<jsi::Object> _jsObjectPtr;
21
- }
22
-
23
- - (nonnull instancetype)initWith:(std::shared_ptr<jsi::Object>)jsObjectPtr
24
- runtime:(nonnull JavaScriptRuntime *)runtime
25
- {
26
- if (self = [super init]) {
27
- _runtime = runtime;
28
- _jsObjectPtr = jsObjectPtr;
29
- }
30
- return self;
31
- }
32
-
33
- - (nonnull jsi::Object *)get
34
- {
35
- return _jsObjectPtr.get();
36
- }
37
-
38
- #pragma mark - Subscripting
39
-
40
- - (nullable id)objectForKeyedSubscript:(nonnull NSString *)key
41
- {
42
- auto runtime = [_runtime get];
43
- auto callInvoker = [_runtime callInvoker];
44
-
45
- if (runtime && callInvoker) {
46
- auto value = _jsObjectPtr->getProperty(*runtime, [key UTF8String]);
47
- return expo::convertJSIValueToObjCObject(*runtime, value, callInvoker);
48
- }
49
- return nil;
50
- }
51
-
52
- - (void)setObject:(nullable id)obj forKeyedSubscript:(nonnull NSString *)key
53
- {
54
- auto runtime = [_runtime get];
55
-
56
- if (!runtime) {
57
- NSLog(@"Cannot set '%@' property when the JavaScript runtime is no longer available.", key);
58
- return;
59
- }
60
- if ([obj isKindOfClass:[JavaScriptObject class]]) {
61
- _jsObjectPtr->setProperty(*runtime, [key UTF8String], *[obj get]);
62
- } else {
63
- _jsObjectPtr->setProperty(*runtime, [key UTF8String], expo::convertObjCObjectToJSIValue(*runtime, obj));
64
- }
65
- }
66
-
67
- #pragma mark - Functions
68
-
69
- - (void)setAsyncFunction:(nonnull NSString *)name
70
- argsCount:(NSInteger)argsCount
71
- block:(nonnull JSAsyncFunctionBlock)block
72
- {
73
- if (!_runtime) {
74
- NSLog(@"Cannot set '%@' async function when the JavaScript runtime is no longer available.", name);
75
- return;
76
- }
77
- jsi::Function function = [_runtime createAsyncFunction:name argsCount:argsCount block:block];
78
- _jsObjectPtr->setProperty(*[_runtime get], [name UTF8String], function);
79
- }
80
-
81
- - (void)setSyncFunction:(nonnull NSString *)name
82
- argsCount:(NSInteger)argsCount
83
- block:(nonnull JSSyncFunctionBlock)block
84
- {
85
- if (!_runtime) {
86
- NSLog(@"Cannot set '%@' sync function when the JavaScript runtime is no longer available.", name);
87
- return;
88
- }
89
- jsi::Function function = [_runtime createSyncFunction:name argsCount:argsCount block:block];
90
- _jsObjectPtr->setProperty(*[_runtime get], [name UTF8String], function);
91
- }
92
-
93
- @end
@@ -1,102 +0,0 @@
1
- // Copyright 2018-present 650 Industries. All rights reserved.
2
-
3
- #import <jsi/jsi.h>
4
-
5
- #import <ExpoModulesCore/JavaScriptRuntime.h>
6
- #import <ExpoModulesCore/ExpoModulesHostObject.h>
7
- #import <ExpoModulesCore/Swift.h>
8
-
9
- using namespace facebook;
10
-
11
- @implementation JavaScriptRuntime {
12
- jsi::Runtime *_runtime;
13
- std::shared_ptr<react::CallInvoker> _jsCallInvoker;
14
-
15
- JavaScriptObject *_global;
16
- }
17
-
18
- - (nonnull instancetype)initWithRuntime:(jsi::Runtime &)runtime callInvoker:(std::shared_ptr<react::CallInvoker>)callInvoker
19
- {
20
- if (self = [super init]) {
21
- _runtime = &runtime;
22
- _jsCallInvoker = callInvoker;
23
-
24
- auto jsGlobalPtr = std::make_shared<jsi::Object>(_runtime->global());
25
- _global = [[JavaScriptObject alloc] initWith:jsGlobalPtr runtime:self];
26
- }
27
- return self;
28
- }
29
-
30
- - (nonnull jsi::Runtime *)get
31
- {
32
- return _runtime;
33
- }
34
-
35
- - (std::shared_ptr<react::CallInvoker>)callInvoker
36
- {
37
- return _jsCallInvoker;
38
- }
39
-
40
- - (nonnull JavaScriptObject *)createObject
41
- {
42
- auto jsObjectPtr = std::make_shared<jsi::Object>(*_runtime);
43
- return [[JavaScriptObject alloc] initWith:jsObjectPtr runtime:self];
44
- }
45
-
46
- - (nonnull JavaScriptObject *)createHostObject:(std::shared_ptr<jsi::HostObject>)jsiHostObjectPtr
47
- {
48
- auto jsObjectPtr = std::make_shared<jsi::Object>(jsi::Object::createFromHostObject(*_runtime, jsiHostObjectPtr));
49
- return [[JavaScriptObject alloc] initWith:jsObjectPtr runtime:self];
50
- }
51
-
52
- - (nonnull JavaScriptObject *)global
53
- {
54
- return _global;
55
- }
56
-
57
- - (jsi::Function)createSyncFunction:(nonnull NSString *)name
58
- argsCount:(NSInteger)argsCount
59
- block:(nonnull JSSyncFunctionBlock)block
60
- {
61
- return [self createHostFunction:name argsCount:argsCount block:^jsi::Value(jsi::Runtime &runtime, std::shared_ptr<react::CallInvoker> callInvoker, NSArray * _Nonnull arguments) {
62
- return expo::convertObjCObjectToJSIValue(runtime, block(arguments));
63
- }];
64
- }
65
-
66
- - (jsi::Function)createAsyncFunction:(nonnull NSString *)name
67
- argsCount:(NSInteger)argsCount
68
- block:(nonnull JSAsyncFunctionBlock)block
69
- {
70
- return [self createHostFunction:name argsCount:argsCount block:^jsi::Value(jsi::Runtime &runtime, std::shared_ptr<react::CallInvoker> callInvoker, NSArray *arguments) {
71
- // The function that is invoked as a setup of the JavaScript `Promise`.
72
- auto promiseSetup = [callInvoker, block, arguments](jsi::Runtime &runtime, std::shared_ptr<Promise> promise) {
73
- expo::callPromiseSetupWithBlock(runtime, callInvoker, promise, ^(RCTPromiseResolveBlock resolver, RCTPromiseRejectBlock rejecter) {
74
- block(arguments, resolver, rejecter);
75
- });
76
- };
77
- return createPromiseAsJSIValue(runtime, promiseSetup);
78
- }];
79
- }
80
-
81
- #pragma mark - Private
82
-
83
- typedef jsi::Value (^JSHostFunctionBlock)(jsi::Runtime &runtime, std::shared_ptr<react::CallInvoker> callInvoker, NSArray * _Nonnull arguments);
84
-
85
- - (jsi::Function)createHostFunction:(nonnull NSString *)name
86
- argsCount:(NSInteger)argsCount
87
- block:(nonnull JSHostFunctionBlock)block
88
- {
89
- jsi::PropNameID propNameId = jsi::PropNameID::forAscii(*_runtime, [name UTF8String], [name length]);
90
- std::weak_ptr<react::CallInvoker> weakCallInvoker = _jsCallInvoker;
91
- jsi::HostFunctionType function = [weakCallInvoker, block](jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
92
- if (auto callInvoker = weakCallInvoker.lock()) {
93
- NSArray *arguments = expo::convertJSIValuesToNSArray(runtime, args, count, callInvoker);
94
- return block(runtime, callInvoker, arguments);
95
- }
96
- // TODO: We should throw some kind of error.
97
- return jsi::Value::undefined();
98
- };
99
- return jsi::Function::createFromHostFunction(*_runtime, propNameId, (unsigned int)argsCount, function);
100
- }
101
-
102
- @end
@@ -1,16 +0,0 @@
1
- // Copyright 2018-present 650 Industries. All rights reserved.
2
-
3
- #import <React/RCTComponentData.h>
4
-
5
- /**
6
- * A compatible wrapper for `RCTComponentData` which has different designated initializers between different react-native versions.
7
- * This class unifies the interface to make react-native <= 0.64 backward compatible.
8
- * Remove when we drop support for SDK 44
9
- */
10
- @interface EXComponentDataCompatibleWrapper : RCTComponentData
11
-
12
- - (instancetype)initWithManagerClass:(Class)managerClass
13
- bridge:(RCTBridge *)bridge
14
- eventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher NS_DESIGNATED_INITIALIZER;
15
-
16
- @end
@@ -1,28 +0,0 @@
1
- // Copyright 2018-present 650 Industries. All rights reserved.
2
-
3
- #import <ExpoModulesCore/EXComponentDataCompatibleWrapper.h>
4
-
5
- @interface RCTComponentData (EXComponentDataCompatibleWrapper)
6
-
7
- // available in RN 0.65+
8
- - (instancetype)initWithManagerClass:(Class)managerClass
9
- bridge:(RCTBridge *)bridge
10
- eventDispatcher:(id<RCTEventDispatcherProtocol>) eventDispatcher;
11
-
12
- - (instancetype)initWithManagerClass:(Class)managerClass bridge:(RCTBridge *)bridge;
13
-
14
- @end
15
-
16
- @implementation EXComponentDataCompatibleWrapper
17
-
18
- - (instancetype)initWithManagerClass:(Class)managerClass
19
- bridge:(RCTBridge *)bridge
20
- eventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher
21
- {
22
- if ([self respondsToSelector:@selector(initWithManagerClass:bridge:)]) {
23
- return [super initWithManagerClass:managerClass bridge:bridge];
24
- }
25
- return [super initWithManagerClass:managerClass bridge:bridge eventDispatcher:eventDispatcher];
26
- }
27
-
28
- @end