expo-modules-core 1.11.13 → 1.12.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.
- package/CHANGELOG.md +77 -13
- package/ExpoModulesCore.podspec +7 -4
- package/android/ExpoModulesCorePlugin.gradle +40 -28
- package/android/build.gradle +12 -93
- package/android/proguard-rules.pro +0 -8
- package/android/src/main/cpp/Exceptions.cpp +1 -1
- package/android/src/main/cpp/Exceptions.h +1 -1
- package/android/src/main/cpp/ExpoModulesHostObject.cpp +7 -6
- package/android/src/main/cpp/ExpoModulesHostObject.h +3 -3
- package/android/src/main/cpp/JNIInjector.cpp +4 -2
- package/android/src/main/cpp/JSIContext.cpp +354 -0
- package/android/src/main/cpp/{JSIInteropModuleRegistry.h → JSIContext.h} +90 -9
- package/android/src/main/cpp/JavaCallback.cpp +210 -24
- package/android/src/main/cpp/JavaCallback.h +42 -7
- package/android/src/main/cpp/JavaScriptFunction.cpp +20 -6
- package/android/src/main/cpp/JavaScriptFunction.h +4 -1
- package/android/src/main/cpp/JavaScriptModuleObject.cpp +118 -82
- package/android/src/main/cpp/JavaScriptModuleObject.h +21 -18
- package/android/src/main/cpp/JavaScriptObject.cpp +7 -8
- package/android/src/main/cpp/JavaScriptObject.h +4 -2
- package/android/src/main/cpp/JavaScriptRuntime.cpp +18 -41
- package/android/src/main/cpp/JavaScriptRuntime.h +2 -8
- package/android/src/main/cpp/JavaScriptTypedArray.cpp +3 -3
- package/android/src/main/cpp/JavaScriptTypedArray.h +1 -1
- package/android/src/main/cpp/JavaScriptValue.cpp +7 -7
- package/android/src/main/cpp/JavaScriptValue.h +1 -1
- package/android/src/main/cpp/JavaScriptWeakObject.cpp +4 -4
- package/android/src/main/cpp/JavaScriptWeakObject.h +1 -1
- package/android/src/main/cpp/MethodMetadata.cpp +44 -120
- package/android/src/main/cpp/MethodMetadata.h +5 -11
- package/android/src/main/cpp/WeakRuntimeHolder.cpp +3 -3
- package/android/src/main/cpp/WeakRuntimeHolder.h +2 -2
- package/android/src/main/cpp/types/AnyType.cpp +1 -1
- package/android/src/main/cpp/types/AnyType.h +1 -1
- package/android/src/main/cpp/types/FrontendConverter.cpp +32 -43
- package/android/src/main/cpp/types/FrontendConverter.h +1 -23
- package/android/src/main/cpp/types/JNIToJSIConverter.cpp +5 -10
- package/android/src/main/cpp/types/JNIToJSIConverter.h +6 -2
- package/android/src/main/java/expo/modules/adapters/react/ModuleRegistryAdapter.java +3 -0
- package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +14 -100
- package/android/src/main/java/expo/modules/adapters/react/ReactAdapterPackage.java +3 -5
- package/android/src/main/java/expo/modules/adapters/react/ReactModuleRegistryProvider.java +6 -22
- package/android/src/main/java/expo/modules/adapters/react/apploader/RNHeadlessAppLoader.kt +8 -4
- package/android/src/main/java/expo/modules/adapters/react/services/EventEmitterModule.java +0 -1
- package/android/src/main/java/expo/modules/adapters/react/services/UIManagerModuleWrapper.java +23 -8
- package/android/src/main/java/expo/modules/core/BasePackage.java +0 -10
- package/android/src/main/java/expo/modules/core/ModulePriorities.kt +1 -0
- package/android/src/main/java/expo/modules/core/ModuleRegistry.java +2 -32
- package/android/src/main/java/expo/modules/core/ModuleRegistryProvider.java +0 -18
- package/android/src/main/java/expo/modules/core/Promise.java +2 -0
- package/android/src/main/java/expo/modules/core/interfaces/Package.java +0 -17
- package/android/src/main/java/expo/modules/core/interfaces/ReactActivityHandler.java +0 -9
- package/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +24 -31
- package/android/src/main/java/expo/modules/core/logging/LogHandler.kt +1 -7
- package/android/src/main/java/expo/modules/core/logging/LogHandlers.kt +11 -0
- package/android/src/main/java/expo/modules/core/logging/Logger.kt +18 -29
- package/android/src/main/java/expo/modules/core/logging/LoggerTimer.kt +11 -0
- package/android/src/main/java/expo/modules/core/logging/OSLogHandler.kt +2 -4
- package/android/src/main/java/expo/modules/core/logging/PersistentFileLogHandler.kt +1 -3
- package/android/src/main/java/expo/modules/interfaces/constants/ConstantsInterface.java +0 -2
- package/android/src/main/java/expo/modules/interfaces/permissions/PermissionsStatus.java +1 -1
- package/android/src/main/java/expo/modules/kotlin/AppContext.kt +44 -24
- package/android/src/main/java/expo/modules/kotlin/ArrayExtenstions.kt +15 -0
- package/android/src/main/java/expo/modules/kotlin/CoreLogger.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/DynamicExtenstions.kt +0 -3
- package/android/src/main/java/expo/modules/kotlin/ExpoBridgeModule.kt +41 -0
- package/android/src/main/java/expo/modules/kotlin/ExpoModulesHelper.kt +1 -2
- package/android/src/main/java/expo/modules/kotlin/KPromiseWrapper.kt +1 -2
- package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +1 -33
- package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +7 -6
- package/android/src/main/java/expo/modules/kotlin/ModuleRegistry.kt +12 -12
- package/android/src/main/java/expo/modules/kotlin/Promise.kt +10 -0
- package/android/src/main/java/expo/modules/kotlin/ReactExtensions.kt +14 -0
- package/android/src/main/java/expo/modules/kotlin/Utils.kt +4 -1
- package/android/src/main/java/expo/modules/kotlin/activityaware/AppCompatActivityAwareHelper.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultCaller.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt +6 -6
- package/android/src/main/java/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +44 -15
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/CoreModule.kt +31 -1
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/ErrorManagerModule.kt +2 -4
- package/android/src/main/java/expo/modules/kotlin/events/KModuleEventEmitterWrapper.kt +11 -4
- package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +2 -3
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +136 -43
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionComponent.kt +71 -2
- package/android/src/main/java/expo/modules/kotlin/functions/FunctionBuilder.kt +39 -12
- package/android/src/main/java/expo/modules/kotlin/jni/ExpectedType.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/jni/JNIDeallocator.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/jni/{JSIInteropModuleRegistry.kt → JSIContext.kt} +90 -14
- package/android/src/main/java/expo/modules/kotlin/jni/JavaCallback.kt +51 -24
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptFunction.kt +3 -3
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptModuleObject.kt +4 -1
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptObject.kt +1 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptValue.kt +1 -0
- package/android/src/main/java/expo/modules/kotlin/jni/PromiseImpl.kt +20 -0
- package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +0 -1
- package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +164 -65
- package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponentBuilder.kt +3 -4
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/ClassRegistry.kt +21 -0
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObject.kt +34 -1
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +23 -8
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedRef.kt +7 -1
- package/android/src/main/java/expo/modules/kotlin/tracing/ExpoTrace.kt +4 -0
- package/android/src/main/java/expo/modules/kotlin/types/AnyType.kt +134 -2
- package/android/src/main/java/expo/modules/kotlin/types/EnforceType.kt +60 -0
- package/android/src/main/java/expo/modules/kotlin/types/EnumTypeConverter.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverter.kt +0 -2
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +3 -27
- package/android/src/main/java/expo/modules/kotlin/types/UnitTypeConverter.kt +3 -7
- package/android/src/main/java/expo/modules/kotlin/types/io/PathTypeConverter.kt +3 -0
- package/android/src/main/java/expo/modules/kotlin/viewevent/ViewEvent.kt +2 -5
- package/android/src/main/java/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +137 -48
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinition.kt +2 -5
- package/build/EventEmitter.d.ts +2 -2
- package/build/EventEmitter.d.ts.map +1 -1
- package/build/EventEmitter.js +8 -8
- package/build/EventEmitter.js.map +1 -1
- package/build/NativeModule.d.ts +4 -0
- package/build/NativeModule.d.ts.map +1 -0
- package/build/NativeModule.js +4 -0
- package/build/NativeModule.js.map +1 -0
- package/build/NativeModulesProxy.native.d.ts.map +1 -1
- package/build/NativeModulesProxy.native.js +4 -0
- package/build/NativeModulesProxy.native.js.map +1 -1
- package/build/NativeModulesProxy.types.d.ts +2 -2
- package/build/NativeModulesProxy.types.d.ts.map +1 -1
- package/build/NativeModulesProxy.types.js.map +1 -1
- package/build/NativeViewManagerAdapter.native.d.ts.map +1 -1
- package/build/NativeViewManagerAdapter.native.js +20 -1
- package/build/NativeViewManagerAdapter.native.js.map +1 -1
- package/build/PermissionsHook.d.ts.map +1 -1
- package/build/PermissionsHook.js +2 -0
- package/build/PermissionsHook.js.map +1 -1
- package/build/Refs.d.ts +8 -0
- package/build/Refs.d.ts.map +1 -0
- package/build/Refs.js +10 -0
- package/build/Refs.js.map +1 -0
- package/build/SharedObject.d.ts +4 -0
- package/build/SharedObject.d.ts.map +1 -0
- package/build/SharedObject.js +4 -0
- package/build/SharedObject.js.map +1 -0
- package/build/createWebModule.d.ts +2 -0
- package/build/createWebModule.d.ts.map +1 -0
- package/build/createWebModule.js +6 -0
- package/build/createWebModule.js.map +1 -0
- package/build/createWebModule.web.d.ts +2 -0
- package/build/createWebModule.web.d.ts.map +1 -0
- package/build/createWebModule.web.js +6 -0
- package/build/createWebModule.web.js.map +1 -0
- package/build/ensureNativeModulesAreInstalled.d.ts +6 -0
- package/build/ensureNativeModulesAreInstalled.d.ts.map +1 -0
- package/build/ensureNativeModulesAreInstalled.js +26 -0
- package/build/ensureNativeModulesAreInstalled.js.map +1 -0
- package/build/hooks/useReleasingSharedObject.d.ts +7 -0
- package/build/hooks/useReleasingSharedObject.d.ts.map +1 -0
- package/build/hooks/useReleasingSharedObject.js +40 -0
- package/build/hooks/useReleasingSharedObject.js.map +1 -0
- package/build/index.d.ts +8 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/requireNativeModule.d.ts +0 -17
- package/build/requireNativeModule.d.ts.map +1 -1
- package/build/requireNativeModule.js +2 -23
- package/build/requireNativeModule.js.map +1 -1
- package/build/ts-declarations/EventEmitter.d.ts +50 -0
- package/build/ts-declarations/EventEmitter.d.ts.map +1 -0
- package/build/ts-declarations/EventEmitter.js +2 -0
- package/build/ts-declarations/EventEmitter.js.map +1 -0
- package/build/ts-declarations/NativeModule.d.ts +14 -0
- package/build/ts-declarations/NativeModule.d.ts.map +1 -0
- package/build/ts-declarations/NativeModule.js +2 -0
- package/build/ts-declarations/NativeModule.js.map +1 -0
- package/build/ts-declarations/SharedObject.d.ts +14 -0
- package/build/ts-declarations/SharedObject.d.ts.map +1 -0
- package/build/ts-declarations/SharedObject.js +2 -0
- package/build/ts-declarations/SharedObject.js.map +1 -0
- package/build/ts-declarations/global.d.ts +49 -0
- package/build/ts-declarations/global.d.ts.map +1 -0
- package/build/ts-declarations/global.js +2 -0
- package/build/ts-declarations/global.js.map +1 -0
- package/build/web/CoreModule.d.ts +17 -0
- package/build/web/CoreModule.d.ts.map +1 -0
- package/build/web/CoreModule.js +51 -0
- package/build/web/CoreModule.js.map +1 -0
- package/build/web/index.d.ts +1 -0
- package/build/web/index.d.ts.map +1 -0
- package/build/web/index.js +1 -0
- package/build/web/index.js.map +1 -0
- package/build/web/index.web.d.ts +2 -0
- package/build/web/index.web.d.ts.map +1 -0
- package/build/web/index.web.js +2 -0
- package/build/web/index.web.js.map +1 -0
- package/common/cpp/BridgelessJSCallInvoker.h +41 -0
- package/common/cpp/EventEmitter.cpp +299 -0
- package/common/cpp/EventEmitter.h +111 -0
- package/common/cpp/JSIUtils.cpp +116 -11
- package/common/cpp/JSIUtils.h +54 -7
- package/common/cpp/LazyObject.cpp +15 -3
- package/common/cpp/LazyObject.h +13 -0
- package/common/cpp/NativeModule.cpp +16 -0
- package/common/cpp/NativeModule.h +34 -0
- package/common/cpp/ObjectDeallocator.cpp +3 -5
- package/common/cpp/ObjectDeallocator.h +2 -3
- package/common/cpp/SharedObject.cpp +69 -0
- package/common/cpp/SharedObject.h +59 -0
- package/common/cpp/TestingSyncJSCallInvoker.h +44 -0
- package/ios/Api/Builders/ClassComponentBuilder.swift +34 -0
- package/ios/{Objects → Api/Builders}/ObjectDefinitionBuilder.swift +3 -3
- package/ios/Api/Builders/ViewDefinitionBuilder.swift +53 -0
- package/ios/Api/Factories/AsyncFunctionFactories.swift +173 -0
- package/ios/{Classes/ClassComponentFactories.swift → Api/Factories/ClassFactories.swift} +19 -19
- package/ios/{Functions/ConcurrentFunctionDefinition.swift → Api/Factories/ConcurrentFunctionFactories.swift} +0 -113
- package/ios/{Modules/ModuleDefinitionComponents.swift → Api/Factories/EventListenersFactories.swift} +0 -20
- package/ios/Api/Factories/ModuleFactories.swift +6 -0
- package/ios/{Objects/ObjectDefinitionComponents.swift → Api/Factories/ObjectFactories.swift} +5 -5
- package/ios/Api/Factories/PropertyFactories.swift +50 -0
- package/ios/Api/Factories/SyncFunctionFactories.swift +173 -0
- package/ios/{Views/ViewManagerDefinitionComponents.swift → Api/Factories/ViewFactories.swift} +7 -6
- package/ios/AppDelegates/EXAppDelegateWrapper.h +0 -21
- package/ios/AppDelegates/EXAppDelegateWrapper.mm +37 -29
- package/ios/{AppContext.swift → Core/AppContext.swift} +34 -11
- package/ios/Core/Classes/AnyClassDefinitionElement.swift +37 -0
- package/ios/{Classes/ClassComponent.swift → Core/Classes/ClassDefinition.swift} +10 -10
- package/ios/{Conversions.swift → Core/Conversions.swift} +1 -1
- package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicSharedObjectType.swift +3 -3
- package/ios/Core/Events/EventObservingDefinition.swift +79 -0
- package/ios/Core/Events/LegacyEventEmitterCompat.swift +32 -0
- package/ios/Core/ExpoBridgeModule.h +18 -0
- package/ios/Core/ExpoBridgeModule.mm +88 -0
- package/ios/Core/ExpoRuntime.swift +6 -0
- package/ios/{Functions/AnyFunction.swift → Core/Functions/AnyFunctionDefinition.swift} +9 -2
- package/ios/Core/Functions/AsyncFunctionDefinition.swift +150 -0
- package/ios/Core/Functions/ConcurrentFunctionDefinition.swift +112 -0
- package/ios/Core/Functions/SyncFunctionDefinition.swift +108 -0
- package/ios/{JavaScriptUtils.swift → Core/JavaScriptUtils.swift} +4 -4
- package/ios/{Logging → Core/Logging}/LogHandlers.swift +12 -5
- package/ios/{Logging → Core/Logging}/Logger.swift +14 -92
- package/ios/Core/Logging/LoggerTimer.swift +22 -0
- package/ios/{ModuleHolder.swift → Core/ModuleHolder.swift} +2 -10
- package/ios/Core/Modules/CoreModule.swift +43 -0
- package/ios/{Modules → Core/Modules}/ModuleDefinition.swift +20 -12
- package/ios/{Modules → Core/Modules}/ModuleDefinitionBuilder.swift +1 -3
- package/ios/{Objects → Core/Objects}/ObjectDefinition.swift +9 -9
- package/ios/{Objects/PropertyComponent.swift → Core/Objects/PropertyDefinition.swift} +11 -64
- package/ios/Core/Protocols/AnyDefinition.swift +4 -0
- package/ios/Core/Protocols/AnyExpoView.swift +7 -0
- package/ios/Core/Protocols/AnyModule.swift +17 -0
- package/ios/Core/Protocols/AnyViewDefinition.swift +34 -0
- package/ios/Core/SharedObjects/SharedObject.swift +80 -0
- package/ios/{SharedObjects → Core/SharedObjects}/SharedObjectRegistry.swift +45 -19
- package/ios/{Views → Core/Views}/AnyViewProp.swift +1 -1
- package/ios/{Views → Core/Views}/ComponentData.swift +7 -7
- package/ios/{Views → Core/Views}/ExpoView.swift +1 -1
- package/ios/Core/Views/ViewDefinition.swift +97 -0
- package/ios/{Views → Core/Views}/ViewLifecycleMethod.swift +1 -1
- package/ios/{Views → Core/Views}/ViewModuleWrapper.swift +1 -1
- package/ios/Fabric/ExpoFabricView.swift +5 -6
- package/ios/FileSystemUtilities/FileSystemLegacyUtilities.swift +111 -0
- package/ios/JSI/EXJSIInstaller.h +28 -0
- package/ios/JSI/EXJSIInstaller.mm +54 -10
- package/ios/JSI/EXJSIUtils.h +15 -11
- package/ios/JSI/EXJSIUtils.mm +21 -49
- package/ios/JSI/EXJavaScriptObject.mm +2 -2
- package/ios/JSI/EXJavaScriptRuntime.h +15 -0
- package/ios/JSI/EXJavaScriptRuntime.mm +53 -26
- package/ios/JSI/EXSharedObjectUtils.h +15 -0
- package/ios/JSI/EXSharedObjectUtils.mm +18 -0
- package/ios/JSI/JavaScriptRuntime.swift +16 -0
- package/ios/Legacy/ModuleRegistry/EXModuleRegistry.m +1 -0
- package/ios/Legacy/ModuleRegistryProvider/EXModuleRegistryProvider.m +5 -0
- package/ios/Legacy/NativeModulesProxy/EXNativeModulesProxy.mm +5 -4
- package/ios/Legacy/Services/EXReactNativeAdapter.mm +34 -28
- package/ios/ReactDelegates/EXReactDelegateWrapper.h +4 -12
- package/ios/ReactDelegates/EXReactDelegateWrapper.mm +41 -0
- package/ios/ReactDelegates/EXReactRootViewFactory.h +38 -0
- package/ios/ReactDelegates/EXReactRootViewFactory.mm +54 -0
- package/ios/ReactDelegates/ExpoReactDelegate.swift +22 -15
- package/ios/ReactDelegates/ExpoReactDelegateHandler.swift +10 -21
- package/ios/ReactDelegates/RCTAppDelegate+Recreate.h +28 -0
- package/ios/ReactDelegates/RCTAppDelegate+Recreate.mm +47 -0
- package/ios/Tests/{ClassComponentSpec.swift → ClassDefinitionSpec.swift} +6 -6
- package/ios/Tests/ConvertiblesSpec.swift +6 -1
- package/ios/Tests/CoreModuleSpec.swift +0 -4
- package/ios/Tests/DynamicTypeSpec.swift +1 -1
- package/ios/Tests/EventEmitterSpec.swift +274 -0
- package/ios/Tests/ExceptionsSpec.swift +114 -54
- package/ios/Tests/ExpoModulesSpec.swift +4 -3
- package/ios/Tests/LoggerSpec.swift +80 -0
- package/ios/Tests/{PropertyComponentSpec.swift → PropertyDefinitionSpec.swift} +1 -1
- package/ios/Tests/SharedObjectRegistrySpec.swift +34 -28
- package/ios/Tests/SharedObjectSpec.swift +141 -0
- package/ios/Tests/ViewDefinitionSpec.swift +1 -1
- package/package.json +2 -2
- package/src/EventEmitter.ts +15 -18
- package/src/NativeModule.ts +6 -0
- package/src/NativeModulesProxy.native.ts +5 -0
- package/src/NativeModulesProxy.types.ts +2 -2
- package/src/NativeViewManagerAdapter.native.tsx +25 -1
- package/src/PermissionsHook.ts +4 -0
- package/src/Refs.ts +10 -0
- package/src/SharedObject.ts +6 -0
- package/src/createWebModule.ts +5 -0
- package/src/createWebModule.web.ts +6 -0
- package/src/ensureNativeModulesAreInstalled.ts +24 -0
- package/src/hooks/useReleasingSharedObject.ts +51 -0
- package/src/index.ts +13 -0
- package/src/requireNativeModule.ts +2 -51
- package/src/ts-declarations/EventEmitter.ts +65 -0
- package/src/ts-declarations/ExpoModules.d.ts +0 -5
- package/src/ts-declarations/NativeModule.ts +18 -0
- package/src/ts-declarations/SharedObject.ts +16 -0
- package/src/ts-declarations/global.ts +60 -0
- package/src/web/CoreModule.ts +83 -0
- package/src/web/index.ts +0 -0
- package/src/web/index.web.ts +1 -0
- package/android/src/main/cpp/JSIInteropModuleRegistry.cpp +0 -196
- package/android/src/main/java/expo/modules/adapters/react/ArgumentsHelper.java +0 -48
- package/android/src/main/java/expo/modules/adapters/react/PromiseWrapper.java +0 -38
- package/android/src/main/java/expo/modules/adapters/react/services/CookieManagerModule.java +0 -53
- package/android/src/main/java/expo/modules/core/ArgumentsHelper.java +0 -44
- package/android/src/main/java/expo/modules/core/ExportedModule.java +0 -173
- package/android/src/main/java/expo/modules/core/ModuleRegistryDelegate.kt +0 -12
- package/android/src/main/java/expo/modules/core/ViewManager.java +0 -9
- package/android/src/main/java/expo/modules/core/interfaces/ExpoMethod.java +0 -12
- package/android/src/main/java/expo/modules/core/interfaces/ExpoProp.java +0 -10
- package/android/src/main/java/expo/modules/core/logging/LoggerOptions.kt +0 -29
- package/android-annotation/build.gradle +0 -48
- package/android-annotation/src/main/java/expo/modules/annotation/Config.kt +0 -7
- package/android-annotation/src/main/java/expo/modules/annotation/ConverterBinder.kt +0 -7
- package/android-annotation-processor/build.gradle +0 -54
- package/android-annotation-processor/src/main/java/expo/modules/annotationprocessor/ExpoSymbolProcessor.kt +0 -175
- package/android-annotation-processor/src/main/java/expo/modules/annotationprocessor/ExpoSymbolProcessorProvider.kt +0 -10
- package/android-annotation-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider +0 -1
- package/ios/Classes/ClassComponentElement.swift +0 -37
- package/ios/Classes/ClassComponentElementsBuilder.swift +0 -34
- package/ios/ExpoBridgeModule.m +0 -7
- package/ios/ExpoBridgeModule.swift +0 -108
- package/ios/ExpoRuntime.swift +0 -28
- package/ios/Functions/AsyncFunctionComponent.swift +0 -327
- package/ios/Functions/SyncFunctionComponent.swift +0 -282
- package/ios/Interfaces/Font/EXFontManagerInterface.h +0 -9
- package/ios/Interfaces/Font/EXFontProcessorInterface.h +0 -15
- package/ios/Interfaces/Font/EXFontScalerInterface.h +0 -9
- package/ios/Interfaces/Font/EXFontScalersManagerInterface.h +0 -9
- package/ios/Legacy/Services/EXReactFontManager.h +0 -6
- package/ios/Legacy/Services/EXReactFontManager.m +0 -130
- package/ios/Modules/AnyModule.swift +0 -53
- package/ios/Modules/CoreModule.swift +0 -17
- package/ios/ReactDelegates/EXRCTBridgeDelegateInterceptor.h +0 -16
- package/ios/ReactDelegates/EXRCTBridgeDelegateInterceptor.m +0 -49
- package/ios/ReactDelegates/EXReactCompatibleHelpers.h +0 -15
- package/ios/ReactDelegates/EXReactCompatibleHelpers.m +0 -25
- package/ios/ReactDelegates/EXReactDelegateWrapper.m +0 -53
- package/ios/SharedObjects/SharedObject.swift +0 -31
- package/ios/Views/ViewDefinition.swift +0 -114
- package/ios/Views/ViewFactory.swift +0 -16
- package/ios/Views/ViewManagerDefinition.swift +0 -77
- package/ios/Views/ViewManagerDefinitionBuilder.swift +0 -11
- /package/ios/{AppContextConfig.swift → Core/AppContextConfig.swift} +0 -0
- /package/ios/{Arguments → Core/Arguments}/AnyArgument.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Convertible.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Convertibles.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Enumerable.swift +0 -0
- /package/ios/{Classes → Core/Classes}/ClassRegistry.swift +0 -0
- /package/ios/{Convertibles → Core/Convertibles}/Convertibles+Color.swift +0 -0
- /package/ios/{Convertibles → Core/Convertibles}/Either.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/AnyDynamicType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicArrayType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicConvertibleType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicDataType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicDictionaryType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicEnumType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicJavaScriptType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicOptionalType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicRawType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicTypedArrayType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicViewType.swift +0 -0
- /package/ios/{EventListener.swift → Core/EventListener.swift} +0 -0
- /package/ios/{Events → Core/Events}/Callback.swift +0 -0
- /package/ios/{Events → Core/Events}/EventDispatcher.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/ChainableException.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/CodedError.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/CommonExceptions.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/Exception.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/ExceptionOrigin.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/GenericException.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/UnexpectedException.swift +0 -0
- /package/ios/{JavaScriptFunction.swift → Core/JavaScriptFunction.swift} +0 -0
- /package/ios/{Logging → Core/Logging}/LogType.swift +0 -0
- /package/ios/{Logging → Core/Logging}/PersistentFileLog.swift +0 -0
- /package/ios/{ModuleRegistry.swift → Core/ModuleRegistry.swift} +0 -0
- /package/ios/{Modules → Core/Modules}/Module.swift +0 -0
- /package/ios/{ModulesProvider.swift → Core/ModulesProvider.swift} +0 -0
- /package/ios/{Objects → Core/Objects}/JavaScriptObjectBuilder.swift +0 -0
- /package/ios/{Promise.swift → Core/Promise.swift} +0 -0
- /package/ios/{Records → Core/Records}/AnyField.swift +0 -0
- /package/ios/{Records → Core/Records}/Field.swift +0 -0
- /package/ios/{Records → Core/Records}/FieldExtensions.swift +0 -0
- /package/ios/{Records → Core/Records}/FieldOption.swift +0 -0
- /package/ios/{Records → Core/Records}/Record.swift +0 -0
- /package/ios/{SharedObjects → Core/SharedObjects}/SharedRef.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/AnyTypedArray.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/ConcreteTypedArrays.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/GenericTypedArray.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/TypedArray.swift +0 -0
- /package/ios/{Views → Core/Views}/ConcreteViewProp.swift +0 -0
|
@@ -20,12 +20,12 @@ namespace jsi = facebook::jsi;
|
|
|
20
20
|
namespace react = facebook::react;
|
|
21
21
|
|
|
22
22
|
namespace expo {
|
|
23
|
-
class
|
|
23
|
+
class JSIContext;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* A class that holds information about the exported function.
|
|
27
27
|
*/
|
|
28
|
-
class MethodMetadata {
|
|
28
|
+
class MethodMetadata : public std::enable_shared_from_this<MethodMetadata> {
|
|
29
29
|
public:
|
|
30
30
|
/**
|
|
31
31
|
* Function name
|
|
@@ -69,12 +69,10 @@ public:
|
|
|
69
69
|
* Transforms metadata to a jsi::Function.
|
|
70
70
|
*
|
|
71
71
|
* @param runtime
|
|
72
|
-
* @param moduleRegistry
|
|
73
72
|
* @return shared ptr to the jsi::Function that wrapped the underlying Kotlin's function.
|
|
74
73
|
*/
|
|
75
74
|
std::shared_ptr<jsi::Function> toJSFunction(
|
|
76
|
-
jsi::Runtime &runtime
|
|
77
|
-
JSIInteropModuleRegistry *moduleRegistry
|
|
75
|
+
jsi::Runtime &runtime
|
|
78
76
|
);
|
|
79
77
|
|
|
80
78
|
/**
|
|
@@ -82,7 +80,6 @@ public:
|
|
|
82
80
|
*/
|
|
83
81
|
jsi::Value callSync(
|
|
84
82
|
jsi::Runtime &rt,
|
|
85
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
86
83
|
const jsi::Value &thisValue,
|
|
87
84
|
const jsi::Value *args,
|
|
88
85
|
size_t count
|
|
@@ -91,7 +88,6 @@ public:
|
|
|
91
88
|
jni::local_ref<jobject> callJNISync(
|
|
92
89
|
JNIEnv *env,
|
|
93
90
|
jsi::Runtime &rt,
|
|
94
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
95
91
|
const jsi::Value &thisValue,
|
|
96
92
|
const jsi::Value *args,
|
|
97
93
|
size_t count
|
|
@@ -111,18 +107,16 @@ private:
|
|
|
111
107
|
*/
|
|
112
108
|
std::shared_ptr<jsi::Function> body = nullptr;
|
|
113
109
|
|
|
114
|
-
jsi::Function toSyncFunction(jsi::Runtime &runtime
|
|
110
|
+
jsi::Function toSyncFunction(jsi::Runtime &runtime);
|
|
115
111
|
|
|
116
|
-
jsi::Function toAsyncFunction(jsi::Runtime &runtime
|
|
112
|
+
jsi::Function toAsyncFunction(jsi::Runtime &runtime);
|
|
117
113
|
|
|
118
114
|
jsi::Function createPromiseBody(
|
|
119
115
|
jsi::Runtime &runtime,
|
|
120
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
121
116
|
jobjectArray globalArgs
|
|
122
117
|
);
|
|
123
118
|
|
|
124
119
|
jobjectArray convertJSIArgsToJNI(
|
|
125
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
126
120
|
JNIEnv *env,
|
|
127
121
|
jsi::Runtime &rt,
|
|
128
122
|
const jsi::Value &thisValue,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#include "WeakRuntimeHolder.h"
|
|
2
2
|
#include "JavaScriptRuntime.h"
|
|
3
|
-
#include "
|
|
3
|
+
#include "JSIContext.h"
|
|
4
4
|
|
|
5
5
|
namespace expo {
|
|
6
6
|
WeakRuntimeHolder::WeakRuntimeHolder(std::weak_ptr<JavaScriptRuntime> runtime)
|
|
@@ -16,9 +16,9 @@ void WeakRuntimeHolder::ensureRuntimeIsValid() {
|
|
|
16
16
|
assert((!expired()) && "JS Runtime was used after deallocation");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
JSIContext *WeakRuntimeHolder::getJSIContext() {
|
|
20
20
|
auto runtime = lock();
|
|
21
21
|
assert((runtime != nullptr) && "JS Runtime was used after deallocation");
|
|
22
|
-
return runtime->
|
|
22
|
+
return expo::getJSIContext(runtime->get());
|
|
23
23
|
}
|
|
24
24
|
} // namespace expo
|
|
@@ -12,7 +12,7 @@ namespace jsi = facebook::jsi;
|
|
|
12
12
|
|
|
13
13
|
class JavaScriptRuntime;
|
|
14
14
|
|
|
15
|
-
class
|
|
15
|
+
class JSIContext;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* A convenient class to access underlying jni::Runtime and hold a weak reference to expo::JavaScriptRuntime.
|
|
@@ -33,7 +33,7 @@ public:
|
|
|
33
33
|
*/
|
|
34
34
|
jsi::Runtime &getJSRuntime();
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
JSIContext *getJSIContext();
|
|
37
37
|
|
|
38
38
|
void ensureRuntimeIsValid();
|
|
39
39
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
#include "../JavaReferencesCache.h"
|
|
7
7
|
#include "../Exceptions.h"
|
|
8
8
|
#include "../JavaScriptTypedArray.h"
|
|
9
|
-
#include "../
|
|
9
|
+
#include "../JSIContext.h"
|
|
10
10
|
#include "../JavaScriptObject.h"
|
|
11
11
|
#include "../JavaScriptValue.h"
|
|
12
12
|
#include "../JavaScriptFunction.h"
|
|
@@ -27,7 +27,6 @@ namespace expo {
|
|
|
27
27
|
jobject IntegerFrontendConverter::convert(
|
|
28
28
|
jsi::Runtime &rt,
|
|
29
29
|
JNIEnv *env,
|
|
30
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
31
30
|
const jsi::Value &value
|
|
32
31
|
) const {
|
|
33
32
|
auto &integerClass = JavaReferencesCache::instance()
|
|
@@ -44,7 +43,6 @@ bool IntegerFrontendConverter::canConvert(jsi::Runtime &rt, const jsi::Value &va
|
|
|
44
43
|
jobject LongFrontendConverter::convert(
|
|
45
44
|
jsi::Runtime &rt,
|
|
46
45
|
JNIEnv *env,
|
|
47
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
48
46
|
const jsi::Value &value
|
|
49
47
|
) const {
|
|
50
48
|
auto &longClass = JavaReferencesCache::instance()
|
|
@@ -61,7 +59,6 @@ bool LongFrontendConverter::canConvert(jsi::Runtime &rt, const jsi::Value &value
|
|
|
61
59
|
jobject FloatFrontendConverter::convert(
|
|
62
60
|
jsi::Runtime &rt,
|
|
63
61
|
JNIEnv *env,
|
|
64
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
65
62
|
const jsi::Value &value
|
|
66
63
|
) const {
|
|
67
64
|
auto &floatClass = JavaReferencesCache::instance()
|
|
@@ -78,7 +75,6 @@ bool FloatFrontendConverter::canConvert(jsi::Runtime &rt, const jsi::Value &valu
|
|
|
78
75
|
jobject BooleanFrontendConverter::convert(
|
|
79
76
|
jsi::Runtime &rt,
|
|
80
77
|
JNIEnv *env,
|
|
81
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
82
78
|
const jsi::Value &value
|
|
83
79
|
) const {
|
|
84
80
|
auto &booleanClass = JavaReferencesCache::instance()
|
|
@@ -94,7 +90,6 @@ bool BooleanFrontendConverter::canConvert(jsi::Runtime &rt, const jsi::Value &va
|
|
|
94
90
|
jobject DoubleFrontendConverter::convert(
|
|
95
91
|
jsi::Runtime &rt,
|
|
96
92
|
JNIEnv *env,
|
|
97
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
98
93
|
const jsi::Value &value
|
|
99
94
|
) const {
|
|
100
95
|
auto &doubleClass = JavaReferencesCache::instance()
|
|
@@ -110,7 +105,6 @@ bool DoubleFrontendConverter::canConvert(jsi::Runtime &rt, const jsi::Value &val
|
|
|
110
105
|
jobject StringFrontendConverter::convert(
|
|
111
106
|
jsi::Runtime &rt,
|
|
112
107
|
JNIEnv *env,
|
|
113
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
114
108
|
const jsi::Value &value
|
|
115
109
|
) const {
|
|
116
110
|
return env->NewStringUTF(value.asString(rt).utf8(rt).c_str());
|
|
@@ -123,7 +117,6 @@ bool StringFrontendConverter::canConvert(jsi::Runtime &rt, const jsi::Value &val
|
|
|
123
117
|
jobject ReadableNativeArrayFrontendConverter::convert(
|
|
124
118
|
jsi::Runtime &rt,
|
|
125
119
|
JNIEnv *env,
|
|
126
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
127
120
|
const jsi::Value &value
|
|
128
121
|
) const {
|
|
129
122
|
auto dynamic = jsi::dynamicFromValue(rt, value);
|
|
@@ -140,7 +133,6 @@ bool ReadableNativeArrayFrontendConverter::canConvert(
|
|
|
140
133
|
jobject ReadableNativeMapArrayFrontendConverter::convert(
|
|
141
134
|
jsi::Runtime &rt,
|
|
142
135
|
JNIEnv *env,
|
|
143
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
144
136
|
const jsi::Value &value
|
|
145
137
|
) const {
|
|
146
138
|
auto dynamic = jsi::dynamicFromValue(rt, value);
|
|
@@ -156,7 +148,6 @@ bool ReadableNativeMapArrayFrontendConverter::canConvert(
|
|
|
156
148
|
jobject ByteArrayFrontendConverter::convert(
|
|
157
149
|
jsi::Runtime &rt,
|
|
158
150
|
JNIEnv *env,
|
|
159
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
160
151
|
const jsi::Value &value
|
|
161
152
|
) const {
|
|
162
153
|
auto typedArray = TypedArray(rt, value.asObject(rt));
|
|
@@ -183,12 +174,12 @@ bool ByteArrayFrontendConverter::canConvert(
|
|
|
183
174
|
jobject TypedArrayFrontendConverter::convert(
|
|
184
175
|
jsi::Runtime &rt,
|
|
185
176
|
JNIEnv *env,
|
|
186
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
187
177
|
const jsi::Value &value
|
|
188
178
|
) const {
|
|
179
|
+
JSIContext *jsiContext = getJSIContext(rt);
|
|
189
180
|
return JavaScriptTypedArray::newInstance(
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
jsiContext,
|
|
182
|
+
jsiContext->runtimeHolder->weak_from_this(),
|
|
192
183
|
std::make_shared<jsi::Object>(value.asObject(rt))
|
|
193
184
|
).release();
|
|
194
185
|
}
|
|
@@ -203,12 +194,12 @@ bool TypedArrayFrontendConverter::canConvert(
|
|
|
203
194
|
jobject JavaScriptValueFrontendConverter::convert(
|
|
204
195
|
jsi::Runtime &rt,
|
|
205
196
|
JNIEnv *env,
|
|
206
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
207
197
|
const jsi::Value &value
|
|
208
198
|
) const {
|
|
199
|
+
JSIContext *jsiContext = getJSIContext(rt);
|
|
209
200
|
return JavaScriptValue::newInstance(
|
|
210
|
-
|
|
211
|
-
|
|
201
|
+
jsiContext,
|
|
202
|
+
jsiContext->runtimeHolder->weak_from_this(),
|
|
212
203
|
// TODO(@lukmccall): make sure that copy here is necessary
|
|
213
204
|
std::make_shared<jsi::Value>(jsi::Value(rt, value))
|
|
214
205
|
).release();
|
|
@@ -221,12 +212,12 @@ bool JavaScriptValueFrontendConverter::canConvert(jsi::Runtime &rt, const jsi::V
|
|
|
221
212
|
jobject JavaScriptObjectFrontendConverter::convert(
|
|
222
213
|
jsi::Runtime &rt,
|
|
223
214
|
JNIEnv *env,
|
|
224
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
225
215
|
const jsi::Value &value
|
|
226
216
|
) const {
|
|
217
|
+
JSIContext *jsiContext = getJSIContext(rt);
|
|
227
218
|
return JavaScriptObject::newInstance(
|
|
228
|
-
|
|
229
|
-
|
|
219
|
+
jsiContext,
|
|
220
|
+
jsiContext->runtimeHolder->weak_from_this(),
|
|
230
221
|
std::make_shared<jsi::Object>(value.asObject(rt))
|
|
231
222
|
).release();
|
|
232
223
|
}
|
|
@@ -241,12 +232,12 @@ bool JavaScriptObjectFrontendConverter::canConvert(
|
|
|
241
232
|
jobject JavaScriptFunctionFrontendConverter::convert(
|
|
242
233
|
jsi::Runtime &rt,
|
|
243
234
|
JNIEnv *env,
|
|
244
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
245
235
|
const jsi::Value &value
|
|
246
236
|
) const {
|
|
237
|
+
JSIContext *jsiContext = getJSIContext(rt);
|
|
247
238
|
return JavaScriptFunction::newInstance(
|
|
248
|
-
|
|
249
|
-
|
|
239
|
+
jsiContext,
|
|
240
|
+
jsiContext->runtimeHolder->weak_from_this(),
|
|
250
241
|
std::make_shared<jsi::Function>(value.asObject(rt).asFunction(rt))
|
|
251
242
|
).release();
|
|
252
243
|
}
|
|
@@ -261,7 +252,6 @@ bool JavaScriptFunctionFrontendConverter::canConvert(
|
|
|
261
252
|
jobject UnknownFrontendConverter::convert(
|
|
262
253
|
jsi::Runtime &rt,
|
|
263
254
|
JNIEnv *env,
|
|
264
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
265
255
|
const jsi::Value &value
|
|
266
256
|
) const {
|
|
267
257
|
auto stringRepresentation = value.toString(rt).utf8(rt);
|
|
@@ -297,12 +287,11 @@ bool PolyFrontendConverter::canConvert(
|
|
|
297
287
|
jobject PolyFrontendConverter::convert(
|
|
298
288
|
jsi::Runtime &rt,
|
|
299
289
|
JNIEnv *env,
|
|
300
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
301
290
|
const jsi::Value &value
|
|
302
291
|
) const {
|
|
303
292
|
for (auto &converter: converters) {
|
|
304
293
|
if (converter->canConvert(rt, value)) {
|
|
305
|
-
return converter->convert(rt, env,
|
|
294
|
+
return converter->convert(rt, env, value);
|
|
306
295
|
}
|
|
307
296
|
}
|
|
308
297
|
// That shouldn't happen.
|
|
@@ -345,7 +334,6 @@ jobject createPrimitiveArray(
|
|
|
345
334
|
jobject PrimitiveArrayFrontendConverter::convert(
|
|
346
335
|
jsi::Runtime &rt,
|
|
347
336
|
JNIEnv *env,
|
|
348
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
349
337
|
const jsi::Value &value
|
|
350
338
|
) const {
|
|
351
339
|
auto jsArray = value.asObject(rt).asArray(rt);
|
|
@@ -394,7 +382,7 @@ jobject PrimitiveArrayFrontendConverter::convert(
|
|
|
394
382
|
);
|
|
395
383
|
for (size_t i = 0; i < size; i++) {
|
|
396
384
|
auto convertedElement = parameterConverter->convert(
|
|
397
|
-
rt, env,
|
|
385
|
+
rt, env, jsArray.getValueAtIndex(rt, i)
|
|
398
386
|
);
|
|
399
387
|
env->SetObjectArrayElement(result, i, convertedElement);
|
|
400
388
|
env->DeleteLocalRef(convertedElement);
|
|
@@ -417,7 +405,6 @@ ListFrontendConverter::ListFrontendConverter(
|
|
|
417
405
|
jobject ListFrontendConverter::convert(
|
|
418
406
|
jsi::Runtime &rt,
|
|
419
407
|
JNIEnv *env,
|
|
420
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
421
408
|
const jsi::Value &value
|
|
422
409
|
) const {
|
|
423
410
|
auto jsArray = value.asObject(rt).asArray(rt);
|
|
@@ -434,7 +421,7 @@ jobject ListFrontendConverter::convert(
|
|
|
434
421
|
}
|
|
435
422
|
|
|
436
423
|
auto convertedElement = parameterConverter->convert(
|
|
437
|
-
rt, env,
|
|
424
|
+
rt, env, jsValue
|
|
438
425
|
);
|
|
439
426
|
arrayList->add(convertedElement);
|
|
440
427
|
env->DeleteLocalRef(convertedElement);
|
|
@@ -458,7 +445,6 @@ MapFrontendConverter::MapFrontendConverter(
|
|
|
458
445
|
jobject MapFrontendConverter::convert(
|
|
459
446
|
jsi::Runtime &rt,
|
|
460
447
|
JNIEnv *env,
|
|
461
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
462
448
|
const jsi::Value &value
|
|
463
449
|
) const {
|
|
464
450
|
auto jsObject = value.asObject(rt);
|
|
@@ -479,7 +465,7 @@ jobject MapFrontendConverter::convert(
|
|
|
479
465
|
}
|
|
480
466
|
|
|
481
467
|
auto convertedValue = valueConverter->convert(
|
|
482
|
-
rt, env,
|
|
468
|
+
rt, env, jsValue
|
|
483
469
|
);
|
|
484
470
|
|
|
485
471
|
map->put(convertedKey, convertedValue);
|
|
@@ -498,9 +484,11 @@ bool MapFrontendConverter::canConvert(
|
|
|
498
484
|
return value.isObject();
|
|
499
485
|
}
|
|
500
486
|
|
|
501
|
-
jobject ViewTagFrontendConverter::convert(
|
|
502
|
-
|
|
503
|
-
|
|
487
|
+
jobject ViewTagFrontendConverter::convert(
|
|
488
|
+
jsi::Runtime &rt,
|
|
489
|
+
JNIEnv *env,
|
|
490
|
+
const jsi::Value &value
|
|
491
|
+
) const {
|
|
504
492
|
auto nativeTag = value.asObject(rt).getProperty(rt, "nativeTag");
|
|
505
493
|
if (nativeTag.isNull()) {
|
|
506
494
|
return nullptr;
|
|
@@ -517,9 +505,11 @@ bool ViewTagFrontendConverter::canConvert(jsi::Runtime &rt, const jsi::Value &va
|
|
|
517
505
|
return value.isObject() && value.getObject(rt).hasProperty(rt, "nativeTag");
|
|
518
506
|
}
|
|
519
507
|
|
|
520
|
-
jobject SharedObjectIdConverter::convert(
|
|
521
|
-
|
|
522
|
-
|
|
508
|
+
jobject SharedObjectIdConverter::convert(
|
|
509
|
+
jsi::Runtime &rt,
|
|
510
|
+
JNIEnv *env,
|
|
511
|
+
const jsi::Value &value
|
|
512
|
+
) const {
|
|
523
513
|
auto objectId = value.asObject(rt).getProperty(rt, "__expo_shared_object_id__");
|
|
524
514
|
if (objectId.isNull()) {
|
|
525
515
|
return nullptr;
|
|
@@ -539,7 +529,6 @@ bool SharedObjectIdConverter::canConvert(jsi::Runtime &rt, const jsi::Value &val
|
|
|
539
529
|
jobject AnyFrontendConvert::convert(
|
|
540
530
|
jsi::Runtime &rt,
|
|
541
531
|
JNIEnv *env,
|
|
542
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
543
532
|
const jsi::Value &value
|
|
544
533
|
) const {
|
|
545
534
|
if (value.isUndefined() || value.isNull()) {
|
|
@@ -547,15 +536,15 @@ jobject AnyFrontendConvert::convert(
|
|
|
547
536
|
}
|
|
548
537
|
|
|
549
538
|
if (booleanConverter.canConvert(rt, value)) {
|
|
550
|
-
return booleanConverter.convert(rt, env,
|
|
539
|
+
return booleanConverter.convert(rt, env, value);
|
|
551
540
|
}
|
|
552
541
|
|
|
553
542
|
if (doubleConverter.canConvert(rt, value)) {
|
|
554
|
-
return doubleConverter.convert(rt, env,
|
|
543
|
+
return doubleConverter.convert(rt, env, value);
|
|
555
544
|
}
|
|
556
545
|
|
|
557
546
|
if (stringConverter.canConvert(rt, value)) {
|
|
558
|
-
return stringConverter.convert(rt, env,
|
|
547
|
+
return stringConverter.convert(rt, env, value);
|
|
559
548
|
}
|
|
560
549
|
|
|
561
550
|
if (!value.isObject()) {
|
|
@@ -573,7 +562,7 @@ jobject AnyFrontendConvert::convert(
|
|
|
573
562
|
auto jsValue = jsArray.getValueAtIndex(rt, i);
|
|
574
563
|
|
|
575
564
|
auto convertedElement = this->convert(
|
|
576
|
-
rt, env,
|
|
565
|
+
rt, env, jsValue
|
|
577
566
|
);
|
|
578
567
|
arrayList->add(convertedElement);
|
|
579
568
|
env->DeleteLocalRef(convertedElement);
|
|
@@ -593,7 +582,7 @@ jobject AnyFrontendConvert::convert(
|
|
|
593
582
|
|
|
594
583
|
auto convertedKey = env->NewStringUTF(key.utf8(rt).c_str());
|
|
595
584
|
auto convertedValue = this->convert(
|
|
596
|
-
rt, env,
|
|
585
|
+
rt, env, jsValue
|
|
597
586
|
);
|
|
598
587
|
|
|
599
588
|
map->put(convertedKey, convertedValue);
|
|
@@ -11,7 +11,7 @@ namespace jni = facebook::jni;
|
|
|
11
11
|
namespace jsi = facebook::jsi;
|
|
12
12
|
|
|
13
13
|
namespace expo {
|
|
14
|
-
class
|
|
14
|
+
class JSIContext;
|
|
15
15
|
class SingleType;
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -35,7 +35,6 @@ public:
|
|
|
35
35
|
virtual jobject convert(
|
|
36
36
|
jsi::Runtime &rt,
|
|
37
37
|
JNIEnv *env,
|
|
38
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
39
38
|
const jsi::Value &value
|
|
40
39
|
) const = 0;
|
|
41
40
|
};
|
|
@@ -48,7 +47,6 @@ public:
|
|
|
48
47
|
jobject convert(
|
|
49
48
|
jsi::Runtime &rt,
|
|
50
49
|
JNIEnv *env,
|
|
51
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
52
50
|
const jsi::Value &value
|
|
53
51
|
) const override;
|
|
54
52
|
|
|
@@ -63,7 +61,6 @@ public:
|
|
|
63
61
|
jobject convert(
|
|
64
62
|
jsi::Runtime &rt,
|
|
65
63
|
JNIEnv *env,
|
|
66
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
67
64
|
const jsi::Value &value
|
|
68
65
|
) const override;
|
|
69
66
|
|
|
@@ -78,7 +75,6 @@ public:
|
|
|
78
75
|
jobject convert(
|
|
79
76
|
jsi::Runtime &rt,
|
|
80
77
|
JNIEnv *env,
|
|
81
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
82
78
|
const jsi::Value &value
|
|
83
79
|
) const override;
|
|
84
80
|
|
|
@@ -93,7 +89,6 @@ public:
|
|
|
93
89
|
jobject convert(
|
|
94
90
|
jsi::Runtime &rt,
|
|
95
91
|
JNIEnv *env,
|
|
96
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
97
92
|
const jsi::Value &value
|
|
98
93
|
) const override;
|
|
99
94
|
|
|
@@ -108,7 +103,6 @@ public:
|
|
|
108
103
|
jobject convert(
|
|
109
104
|
jsi::Runtime &rt,
|
|
110
105
|
JNIEnv *env,
|
|
111
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
112
106
|
const jsi::Value &value
|
|
113
107
|
) const override;
|
|
114
108
|
|
|
@@ -123,7 +117,6 @@ public:
|
|
|
123
117
|
jobject convert(
|
|
124
118
|
jsi::Runtime &rt,
|
|
125
119
|
JNIEnv *env,
|
|
126
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
127
120
|
const jsi::Value &value
|
|
128
121
|
) const override;
|
|
129
122
|
|
|
@@ -138,7 +131,6 @@ public:
|
|
|
138
131
|
jobject convert(
|
|
139
132
|
jsi::Runtime &rt,
|
|
140
133
|
JNIEnv *env,
|
|
141
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
142
134
|
const jsi::Value &value
|
|
143
135
|
) const override;
|
|
144
136
|
|
|
@@ -153,7 +145,6 @@ public:
|
|
|
153
145
|
jobject convert(
|
|
154
146
|
jsi::Runtime &rt,
|
|
155
147
|
JNIEnv *env,
|
|
156
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
157
148
|
const jsi::Value &value
|
|
158
149
|
) const override;
|
|
159
150
|
|
|
@@ -168,7 +159,6 @@ public:
|
|
|
168
159
|
jobject convert(
|
|
169
160
|
jsi::Runtime &rt,
|
|
170
161
|
JNIEnv *env,
|
|
171
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
172
162
|
const jsi::Value &value
|
|
173
163
|
) const override;
|
|
174
164
|
|
|
@@ -183,7 +173,6 @@ public:
|
|
|
183
173
|
jobject convert(
|
|
184
174
|
jsi::Runtime &rt,
|
|
185
175
|
JNIEnv *env,
|
|
186
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
187
176
|
const jsi::Value &value
|
|
188
177
|
) const override;
|
|
189
178
|
|
|
@@ -198,7 +187,6 @@ public:
|
|
|
198
187
|
jobject convert(
|
|
199
188
|
jsi::Runtime &rt,
|
|
200
189
|
JNIEnv *env,
|
|
201
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
202
190
|
const jsi::Value &value
|
|
203
191
|
) const override;
|
|
204
192
|
|
|
@@ -213,7 +201,6 @@ public:
|
|
|
213
201
|
jobject convert(
|
|
214
202
|
jsi::Runtime &rt,
|
|
215
203
|
JNIEnv *env,
|
|
216
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
217
204
|
const jsi::Value &value
|
|
218
205
|
) const override;
|
|
219
206
|
|
|
@@ -228,7 +215,6 @@ public:
|
|
|
228
215
|
jobject convert(
|
|
229
216
|
jsi::Runtime &rt,
|
|
230
217
|
JNIEnv *env,
|
|
231
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
232
218
|
const jsi::Value &value
|
|
233
219
|
) const override;
|
|
234
220
|
|
|
@@ -243,7 +229,6 @@ public:
|
|
|
243
229
|
jobject convert(
|
|
244
230
|
jsi::Runtime &rt,
|
|
245
231
|
JNIEnv *env,
|
|
246
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
247
232
|
const jsi::Value &value
|
|
248
233
|
) const override;
|
|
249
234
|
|
|
@@ -258,7 +243,6 @@ public:
|
|
|
258
243
|
jobject convert(
|
|
259
244
|
jsi::Runtime &rt,
|
|
260
245
|
JNIEnv *env,
|
|
261
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
262
246
|
const jsi::Value &value
|
|
263
247
|
) const override;
|
|
264
248
|
|
|
@@ -275,7 +259,6 @@ public:
|
|
|
275
259
|
jobject convert(
|
|
276
260
|
jsi::Runtime &rt,
|
|
277
261
|
JNIEnv *env,
|
|
278
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
279
262
|
const jsi::Value &value
|
|
280
263
|
) const override;
|
|
281
264
|
|
|
@@ -297,7 +280,6 @@ public:
|
|
|
297
280
|
jobject convert(
|
|
298
281
|
jsi::Runtime &rt,
|
|
299
282
|
JNIEnv *env,
|
|
300
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
301
283
|
const jsi::Value &value
|
|
302
284
|
) const override;
|
|
303
285
|
|
|
@@ -317,7 +299,6 @@ public:
|
|
|
317
299
|
jobject convert(
|
|
318
300
|
jsi::Runtime &rt,
|
|
319
301
|
JNIEnv *env,
|
|
320
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
321
302
|
const jsi::Value &value
|
|
322
303
|
) const override;
|
|
323
304
|
|
|
@@ -350,7 +331,6 @@ public:
|
|
|
350
331
|
jobject convert(
|
|
351
332
|
jsi::Runtime &rt,
|
|
352
333
|
JNIEnv *env,
|
|
353
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
354
334
|
const jsi::Value &value
|
|
355
335
|
) const override;
|
|
356
336
|
|
|
@@ -374,7 +354,6 @@ public:
|
|
|
374
354
|
jobject convert(
|
|
375
355
|
jsi::Runtime &rt,
|
|
376
356
|
JNIEnv *env,
|
|
377
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
378
357
|
const jsi::Value &value
|
|
379
358
|
) const override;
|
|
380
359
|
|
|
@@ -394,7 +373,6 @@ public:
|
|
|
394
373
|
jobject convert(
|
|
395
374
|
jsi::Runtime &rt,
|
|
396
375
|
JNIEnv *env,
|
|
397
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
398
376
|
const jsi::Value &value
|
|
399
377
|
) const override;
|
|
400
378
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
namespace react = facebook::react;
|
|
13
13
|
|
|
14
|
-
namespace {
|
|
14
|
+
namespace expo {
|
|
15
15
|
|
|
16
16
|
// This value should be synced with the value in **FollyDynamicExtensionConverter.kt**
|
|
17
17
|
constexpr char DYNAMIC_EXTENSION_PREFIX[] = "__expo_dynamic_extension__#";
|
|
@@ -47,12 +47,7 @@ std::optional<jsi::Value> convertStringToFollyDynamicIfNeeded(jsi::Runtime &rt,
|
|
|
47
47
|
return std::nullopt;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
} // namespace
|
|
51
|
-
|
|
52
|
-
namespace expo {
|
|
53
|
-
|
|
54
50
|
jsi::Value convert(
|
|
55
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
56
51
|
JNIEnv *env,
|
|
57
52
|
jsi::Runtime &rt,
|
|
58
53
|
jni::local_ref<jobject> value
|
|
@@ -113,7 +108,6 @@ jsi::Value convert(
|
|
|
113
108
|
if (env->IsInstanceOf(unpackedValue, JavaScriptModuleObject::javaClassStatic().get())) {
|
|
114
109
|
auto anonymousObject = jni::static_ref_cast<JavaScriptModuleObject::javaobject>(value)
|
|
115
110
|
->cthis();
|
|
116
|
-
anonymousObject->jsiInteropModuleRegistry = moduleRegistry;
|
|
117
111
|
auto jsiObject = anonymousObject->getJSIObject(rt);
|
|
118
112
|
|
|
119
113
|
jni::global_ref<jobject> globalRef = jni::make_global(value);
|
|
@@ -134,12 +128,13 @@ jsi::Value convert(
|
|
|
134
128
|
"expo/modules/kotlin/sharedobjects/SharedObject").clazz
|
|
135
129
|
)) {
|
|
136
130
|
auto jsObject = std::make_shared<jsi::Object>(jsi::Object(rt));
|
|
131
|
+
JSIContext *jsiContext = getJSIContext(rt);
|
|
137
132
|
auto jsObjectRef = JavaScriptObject::newInstance(
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
jsiContext,
|
|
134
|
+
jsiContext->runtimeHolder,
|
|
140
135
|
jsObject
|
|
141
136
|
);
|
|
142
|
-
|
|
137
|
+
jsiContext->registerSharedObject(jni::make_local(unpackedValue), jsObjectRef);
|
|
143
138
|
return jsi::Value(rt, *jsObject);
|
|
144
139
|
}
|
|
145
140
|
if (env->IsInstanceOf(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
-
#include "../
|
|
5
|
+
#include "../JSIContext.h"
|
|
6
6
|
|
|
7
7
|
#include <fbjni/fbjni.h>
|
|
8
8
|
#include <jsi/jsi.h>
|
|
@@ -14,12 +14,16 @@ namespace jsi = facebook::jsi;
|
|
|
14
14
|
namespace expo {
|
|
15
15
|
|
|
16
16
|
jsi::Value convert(
|
|
17
|
-
JSIInteropModuleRegistry *moduleRegistry,
|
|
18
17
|
JNIEnv *env,
|
|
19
18
|
jsi::Runtime &rt,
|
|
20
19
|
jni::local_ref<jobject> value
|
|
21
20
|
);
|
|
22
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Convert a string with FollyDynamicExtensionConverter support.
|
|
24
|
+
*/
|
|
25
|
+
std::optional<jsi::Value> convertStringToFollyDynamicIfNeeded(jsi::Runtime &rt, const std::string& string);
|
|
26
|
+
|
|
23
27
|
/**
|
|
24
28
|
* Decorate jsi::Value with FollyDynamicExtensionConverter support.
|
|
25
29
|
*/
|
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.NativeModule;
|
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager;
|
|
7
7
|
|
|
8
|
+
import java.lang.ref.WeakReference;
|
|
8
9
|
import java.util.ArrayList;
|
|
9
10
|
import java.util.List;
|
|
10
11
|
import java.util.Objects;
|
|
@@ -18,6 +19,7 @@ import expo.modules.core.interfaces.InternalModule;
|
|
|
18
19
|
import expo.modules.core.interfaces.Package;
|
|
19
20
|
import expo.modules.kotlin.AppContext;
|
|
20
21
|
import expo.modules.kotlin.CoreLoggerKt;
|
|
22
|
+
import expo.modules.kotlin.ExpoBridgeModule;
|
|
21
23
|
import expo.modules.kotlin.KotlinInteropModuleRegistry;
|
|
22
24
|
import expo.modules.kotlin.ModulesProvider;
|
|
23
25
|
import expo.modules.kotlin.views.ViewWrapperDelegateHolder;
|
|
@@ -95,6 +97,7 @@ public class ModuleRegistryAdapter implements ReactPackage {
|
|
|
95
97
|
nativeModulesList.addAll(reactPackage.createNativeModules(reactContext));
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
nativeModulesList.add(new ExpoBridgeModule(reactContext, new WeakReference<>(nativeModulesProxy)));
|
|
98
101
|
return nativeModulesList;
|
|
99
102
|
}
|
|
100
103
|
|