expo-modules-core 1.6.0 → 1.7.0
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.
- package/CHANGELOG.md +24 -0
- package/android/build.gradle +26 -19
- package/android/src/main/cpp/JSIInteropModuleRegistry.cpp +19 -2
- package/android/src/main/cpp/JSIInteropModuleRegistry.h +11 -1
- package/android/src/main/cpp/JavaScriptModuleObject.cpp +14 -13
- package/android/src/main/cpp/JavaScriptModuleObject.h +4 -1
- package/android/src/main/cpp/JavaScriptObject.cpp +12 -27
- package/android/src/main/cpp/JavaScriptObject.h +2 -8
- package/android/src/main/cpp/JavaScriptRuntime.cpp +44 -17
- package/android/src/main/cpp/JavaScriptRuntime.h +9 -16
- package/android/src/main/cpp/MethodMetadata.cpp +12 -13
- package/android/src/main/cpp/types/FrontendConverter.cpp +20 -3
- package/android/src/main/cpp/types/JNIToJSIConverter.cpp +7 -8
- package/android/src/main/java/expo/modules/adapters/react/ModuleRegistryAdapter.java +1 -14
- package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +1 -11
- package/android/src/main/java/expo/modules/adapters/react/views/ViewManagerAdapterUtils.java +0 -54
- package/android/src/main/java/expo/modules/core/ModuleRegistry.java +0 -16
- package/android/src/main/java/expo/modules/core/ViewManager.java +3 -130
- package/android/src/main/java/expo/modules/kotlin/AppContext.kt +21 -3
- package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +3 -2
- package/android/src/main/java/expo/modules/kotlin/Promise.kt +5 -1
- package/android/src/main/java/expo/modules/kotlin/activityresult/ActivityResultsManager.kt +1 -2
- package/android/src/main/java/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +18 -1
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/ErrorManagerModule.kt +12 -1
- package/android/src/main/java/expo/modules/kotlin/functions/AnyFunction.kt +1 -0
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunction.kt +1 -13
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +106 -13
- package/android/src/main/java/expo/modules/kotlin/functions/FunctionBuilder.kt +103 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JSIInteropModuleRegistry.kt +2 -1
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptModuleObject.kt +10 -2
- package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +32 -1
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +43 -20
- package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponent.kt +11 -7
- package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponentBuilder.kt +35 -3
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +12 -2
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObjectTypeConverter.kt +11 -3
- package/android/src/main/java/expo/modules/kotlin/types/EnumTypeConverter.kt +0 -1
- package/android/src/main/java/expo/modules/kotlin/types/MapTypeConverter.kt +0 -2
- package/android/src/main/java/expo/modules/kotlin/types/ReadableArgumentsTypeConverter.kt +24 -0
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +3 -2
- package/android/src/main/java/expo/modules/kotlin/viewevent/ViewEventDelegate.kt +0 -2
- package/android/src/main/java/expo/modules/kotlin/views/AnyViewProp.kt +2 -1
- package/android/src/main/java/expo/modules/kotlin/views/ConcreteViewProp.kt +3 -2
- package/android/src/main/java/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +1 -2
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinition.kt +3 -4
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerType.kt +5 -0
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerWrapperDelegate.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/views/ViewTypeConverter.kt +3 -3
- package/android/src/reactnative/expo/modules/kotlin/ReactNativeCompatibleHelper.kt +12 -0
- package/android/src/reactnative72/expo/modules/kotlin/ReactNativeCompatibleHelper.kt +12 -0
- package/android-annotation/build.gradle +6 -3
- package/android-annotation-processor/build.gradle +6 -3
- package/build/errors/UnavailabilityError.d.ts.map +1 -1
- package/build/errors/UnavailabilityError.js +1 -1
- package/build/errors/UnavailabilityError.js.map +1 -1
- package/build/sweet/setUpErrorManager.fx.js +5 -1
- package/build/sweet/setUpErrorManager.fx.js.map +1 -1
- package/build/uuid/v4.js +2 -7
- package/build/uuid/v4.js.map +1 -1
- package/common/cpp/JSIUtils.cpp +23 -2
- package/common/cpp/JSIUtils.h +12 -2
- package/common/cpp/LazyObject.cpp +1 -1
- package/common/cpp/ObjectDeallocator.cpp +21 -0
- package/common/cpp/ObjectDeallocator.h +37 -0
- package/ios/JSI/EXJSIUtils.h +1 -12
- package/ios/JSI/EXJSIUtils.mm +5 -27
- package/ios/JSI/EXJavaScriptObject.mm +8 -21
- package/ios/ReactDelegates/EXReactCompatibleHelpers.m +7 -7
- package/ios/Swift/Views/ViewModuleWrapper.swift +3 -1
- package/package.json +2 -2
- package/src/errors/UnavailabilityError.ts +1 -1
- package/src/sweet/setUpErrorManager.fx.ts +6 -1
- package/src/uuid/v4.ts +2 -6
- package/tsconfig.json +1 -1
- package/android/src/main/cpp/ObjectDeallocator.h +0 -25
- package/android/src/main/java/expo/modules/adapters/react/views/SimpleViewManagerAdapter.java +0 -62
- package/android/src/main/java/expo/modules/adapters/react/views/ViewGroupManagerAdapter.java +0 -62
- package/ios/JSI/EXObjectDeallocator.h +0 -27
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
#import <React/RCTRootView.h>
|
|
6
6
|
|
|
7
|
-
#if __has_include(<React/RCTAppSetupUtils.h>)
|
|
7
|
+
#if __has_include(<React-RCTAppDelegate/RCTAppSetupUtils.h>)
|
|
8
|
+
#import <React-RCTAppDelegate/RCTAppSetupUtils.h>
|
|
9
|
+
#elif __has_include(<React_RCTAppDelegate/RCTAppSetupUtils.h>)
|
|
10
|
+
// for importing the header from framework, the dash will be transformed to underscore
|
|
11
|
+
#import <React_RCTAppDelegate/RCTAppSetupUtils.h>
|
|
12
|
+
#else
|
|
13
|
+
// react-native < 0.72
|
|
8
14
|
#import <React/RCTAppSetupUtils.h>
|
|
9
15
|
#endif
|
|
10
16
|
|
|
11
17
|
UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties, BOOL fabricEnabled)
|
|
12
18
|
{
|
|
13
|
-
#if __has_include(<React/RCTAppSetupUtils.h>)
|
|
14
|
-
|
|
15
19
|
#if REACT_NATIVE_MINOR_VERSION >= 71
|
|
16
20
|
return RCTAppSetupDefaultRootView(bridge, moduleName, initialProperties, fabricEnabled);
|
|
17
21
|
#else
|
|
18
22
|
return RCTAppSetupDefaultRootView(bridge, moduleName, initialProperties);
|
|
19
23
|
#endif // REACT_NATIVE_MINOR_VERSION >= 71
|
|
20
|
-
|
|
21
|
-
#else
|
|
22
|
-
return [[RCTRootView alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
|
|
23
|
-
#endif // __has_include(<React/RCTAppSetupUtils.h>)
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -32,13 +32,15 @@ public final class ViewModuleWrapper: RCTViewManager, DynamicModuleWrapperProtoc
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
The designated initializer that is used by React Native to create module instances.
|
|
35
|
+
https://github.com/facebook/react-native/blob/540c41be9/packages/react-native/React/Views/RCTComponentData.m#L506-L507
|
|
36
|
+
It doesn't matter to return dummy class here. The wrapper will then to subclass dynamically.
|
|
35
37
|
Must be called on a dynamic class to get access to underlying wrapped module. Throws fatal exception otherwise.
|
|
36
38
|
*/
|
|
37
39
|
@objc
|
|
38
40
|
public override init() {
|
|
39
41
|
super.init()
|
|
40
42
|
guard let module = (self as DynamicModuleWrapperProtocol).wrappedModule?() else {
|
|
41
|
-
|
|
43
|
+
return
|
|
42
44
|
}
|
|
43
45
|
self.wrappedModuleHolder = module.wrappedModuleHolder
|
|
44
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "The core of Expo Modules architecture",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@testing-library/react-hooks": "^7.0.1",
|
|
43
43
|
"expo-module-scripts": "^3.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "79607a7325f47aa17c36d266100d09a4ff2cc544"
|
|
46
46
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
import NativeErrorManager from './NativeErrorManager';
|
|
1
2
|
import { EventEmitter } from '../EventEmitter';
|
|
2
3
|
import Platform from '../Platform';
|
|
3
4
|
import { CodedError } from '../errors/CodedError';
|
|
4
|
-
import NativeErrorManager from './NativeErrorManager';
|
|
5
5
|
|
|
6
6
|
if (__DEV__ && Platform.OS === 'android' && NativeErrorManager) {
|
|
7
7
|
const onNewException = 'ExpoModulesCoreErrorManager.onNewException';
|
|
8
|
+
const onNewWarning = 'ExpoModulesCoreErrorManager.onNewWarning';
|
|
8
9
|
const eventEmitter = new EventEmitter(NativeErrorManager);
|
|
9
10
|
|
|
10
11
|
eventEmitter.addListener(onNewException, ({ message }: { message: string }) => {
|
|
11
12
|
console.error(message);
|
|
12
13
|
});
|
|
14
|
+
|
|
15
|
+
eventEmitter.addListener(onNewWarning, ({ message }: { message: string }) => {
|
|
16
|
+
console.warn(message);
|
|
17
|
+
});
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
// We have to export `CodedError` via global object to use in later in the C++ code.
|
package/src/uuid/v4.ts
CHANGED
|
@@ -22,12 +22,8 @@ export function uuidv4<T extends OutputBuffer>(
|
|
|
22
22
|
|
|
23
23
|
options = options || undefined;
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
rnds = options.random as number[];
|
|
28
|
-
} else if (options && 'rng' in options) {
|
|
29
|
-
rnds = (options.rng || rng)() as number[];
|
|
30
|
-
}
|
|
25
|
+
// @ts-expect-error
|
|
26
|
+
const rnds: number[] = options?.random || (options?.rng || rng)();
|
|
31
27
|
|
|
32
28
|
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
33
29
|
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
package/tsconfig.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Copyright © 2021-present 650 Industries, Inc. (aka Expo)
|
|
2
|
-
|
|
3
|
-
#pragma once
|
|
4
|
-
|
|
5
|
-
#include <jsi/jsi.h>
|
|
6
|
-
|
|
7
|
-
namespace jsi = facebook::jsi;
|
|
8
|
-
|
|
9
|
-
namespace expo {
|
|
10
|
-
|
|
11
|
-
class JSI_EXPORT ObjectDeallocator : public jsi::HostObject {
|
|
12
|
-
public:
|
|
13
|
-
typedef std::function<void()> ObjectDeallocatorType;
|
|
14
|
-
|
|
15
|
-
ObjectDeallocator(ObjectDeallocatorType deallocator) : deallocator(deallocator) {};
|
|
16
|
-
|
|
17
|
-
virtual ~ObjectDeallocator() {
|
|
18
|
-
deallocator();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const ObjectDeallocatorType deallocator;
|
|
22
|
-
|
|
23
|
-
}; // class ObjectDeallocator
|
|
24
|
-
|
|
25
|
-
}
|
package/android/src/main/java/expo/modules/adapters/react/views/SimpleViewManagerAdapter.java
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
package expo.modules.adapters.react.views;
|
|
2
|
-
|
|
3
|
-
import android.view.View;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
6
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
7
|
-
import com.facebook.react.uimanager.SimpleViewManager;
|
|
8
|
-
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
9
|
-
|
|
10
|
-
import java.util.Map;
|
|
11
|
-
|
|
12
|
-
import javax.annotation.Nullable;
|
|
13
|
-
|
|
14
|
-
import expo.modules.core.ModuleRegistry;
|
|
15
|
-
import expo.modules.core.ViewManager;
|
|
16
|
-
import expo.modules.core.interfaces.RegistryLifecycleListener;
|
|
17
|
-
|
|
18
|
-
public class SimpleViewManagerAdapter<M extends ViewManager<V>, V extends View> extends SimpleViewManager<V> implements RegistryLifecycleListener {
|
|
19
|
-
private M mViewManager;
|
|
20
|
-
|
|
21
|
-
public SimpleViewManagerAdapter(M viewManager) {
|
|
22
|
-
mViewManager = viewManager;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
protected V createViewInstance(ThemedReactContext reactContext) {
|
|
27
|
-
return mViewManager.createViewInstance(reactContext);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public void onDropViewInstance(V view) {
|
|
32
|
-
mViewManager.onDropViewInstance(view);
|
|
33
|
-
super.onDropViewInstance(view);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@Nullable
|
|
37
|
-
@Override
|
|
38
|
-
public Map<String, Object> getConstants() {
|
|
39
|
-
return ViewManagerAdapterUtils.getConstants(mViewManager);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@Override
|
|
43
|
-
public String getName() {
|
|
44
|
-
return ViewManagerAdapterUtils.getViewManagerAdapterName(mViewManager);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@ReactProp(name = "proxiedProperties")
|
|
48
|
-
public void setProxiedProperties(V view, ReadableMap proxiedProperties) {
|
|
49
|
-
ViewManagerAdapterUtils.setProxiedProperties(getName(), mViewManager, view, proxiedProperties);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@Nullable
|
|
53
|
-
@Override
|
|
54
|
-
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
55
|
-
return ViewManagerAdapterUtils.getExportedCustomDirectEventTypeConstants(mViewManager);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@Override
|
|
59
|
-
public void onCreate(ModuleRegistry moduleRegistry) {
|
|
60
|
-
mViewManager.onCreate(moduleRegistry);
|
|
61
|
-
}
|
|
62
|
-
}
|
package/android/src/main/java/expo/modules/adapters/react/views/ViewGroupManagerAdapter.java
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
package expo.modules.adapters.react.views;
|
|
2
|
-
|
|
3
|
-
import android.view.ViewGroup;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
6
|
-
import com.facebook.react.uimanager.ViewGroupManager;
|
|
7
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
8
|
-
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
9
|
-
|
|
10
|
-
import java.util.Map;
|
|
11
|
-
|
|
12
|
-
import javax.annotation.Nullable;
|
|
13
|
-
|
|
14
|
-
import expo.modules.core.ModuleRegistry;
|
|
15
|
-
import expo.modules.core.ViewManager;
|
|
16
|
-
import expo.modules.core.interfaces.RegistryLifecycleListener;
|
|
17
|
-
|
|
18
|
-
public class ViewGroupManagerAdapter<M extends ViewManager<V>, V extends ViewGroup> extends ViewGroupManager<V> implements RegistryLifecycleListener {
|
|
19
|
-
private M mViewManager;
|
|
20
|
-
|
|
21
|
-
public ViewGroupManagerAdapter(M viewManager) {
|
|
22
|
-
mViewManager = viewManager;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
protected V createViewInstance(ThemedReactContext reactContext) {
|
|
27
|
-
return mViewManager.createViewInstance(reactContext);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public void onDropViewInstance(V view) {
|
|
32
|
-
mViewManager.onDropViewInstance(view);
|
|
33
|
-
super.onDropViewInstance(view);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@Nullable
|
|
37
|
-
@Override
|
|
38
|
-
public Map<String, Object> getConstants() {
|
|
39
|
-
return ViewManagerAdapterUtils.getConstants(mViewManager);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@Override
|
|
43
|
-
public String getName() {
|
|
44
|
-
return ViewManagerAdapterUtils.getViewManagerAdapterName(mViewManager);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@ReactProp(name = "proxiedProperties")
|
|
48
|
-
public void setProxiedProperties(V view, ReadableMap proxiedProperties) {
|
|
49
|
-
ViewManagerAdapterUtils.setProxiedProperties(getName(), mViewManager, view, proxiedProperties);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@Nullable
|
|
53
|
-
@Override
|
|
54
|
-
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
55
|
-
return ViewManagerAdapterUtils.getExportedCustomDirectEventTypeConstants(mViewManager);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@Override
|
|
59
|
-
public void onCreate(ModuleRegistry moduleRegistry) {
|
|
60
|
-
mViewManager.onCreate(moduleRegistry);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#ifdef __cplusplus
|
|
4
|
-
|
|
5
|
-
#import <jsi/jsi.h>
|
|
6
|
-
|
|
7
|
-
namespace jsi = facebook::jsi;
|
|
8
|
-
|
|
9
|
-
namespace expo {
|
|
10
|
-
|
|
11
|
-
typedef void (^ObjectDeallocatorBlock)();
|
|
12
|
-
|
|
13
|
-
class JSI_EXPORT ObjectDeallocator : public jsi::HostObject {
|
|
14
|
-
public:
|
|
15
|
-
ObjectDeallocator(const ObjectDeallocatorBlock deallocator) : deallocator(deallocator) {};
|
|
16
|
-
|
|
17
|
-
virtual ~ObjectDeallocator() {
|
|
18
|
-
deallocator();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const ObjectDeallocatorBlock deallocator;
|
|
22
|
-
|
|
23
|
-
}; // class ObjectDeallocator
|
|
24
|
-
|
|
25
|
-
} // namespace expo
|
|
26
|
-
|
|
27
|
-
#endif
|