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
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
#import <ExpoModulesCore/EXSingletonModule.h>
|
|
5
5
|
#import <ExpoModulesCore/EXModuleRegistryProvider.h>
|
|
6
6
|
|
|
7
|
+
#import <ExpoModulesCore/Swift.h>
|
|
8
|
+
|
|
7
9
|
static dispatch_once_t onceToken;
|
|
8
10
|
static NSMutableSet<Class> *EXModuleClasses;
|
|
9
11
|
static NSMutableSet<Class> *EXSingletonModuleClasses;
|
|
@@ -11,6 +13,9 @@ static NSMutableSet<Class> *EXSingletonModuleClasses;
|
|
|
11
13
|
void (^EXinitializeGlobalModulesRegistry)(void) = ^{
|
|
12
14
|
EXModuleClasses = [NSMutableSet set];
|
|
13
15
|
EXSingletonModuleClasses = [NSMutableSet set];
|
|
16
|
+
|
|
17
|
+
// Also add temporary Swift modules from core
|
|
18
|
+
[EXModuleClasses addObject:[EXFileSystemLegacyUtilities class]];
|
|
14
19
|
};
|
|
15
20
|
|
|
16
21
|
extern void EXRegisterModule(Class);
|
|
@@ -192,9 +192,9 @@ RCT_EXPORT_MODULE(NativeUnimoduleProxy)
|
|
|
192
192
|
|
|
193
193
|
- (void)setBridge:(RCTBridge *)bridge
|
|
194
194
|
{
|
|
195
|
-
ExpoBridgeModule*
|
|
196
|
-
[expoBridgeModule
|
|
197
|
-
|
|
195
|
+
ExpoBridgeModule *expoBridgeModule = [bridge moduleForClass:ExpoBridgeModule.class];
|
|
196
|
+
[expoBridgeModule legacyProxyDidSetBridge:self legacyModuleRegistry:_exModuleRegistry];
|
|
197
|
+
|
|
198
198
|
_appContext = [expoBridgeModule appContext];
|
|
199
199
|
|
|
200
200
|
if (!_bridge) {
|
|
@@ -336,7 +336,8 @@ RCT_EXPORT_METHOD(callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNa
|
|
|
336
336
|
- (Class)registerComponentData:(ViewModuleWrapper *)viewModule inBridge:(RCTBridge *)bridge
|
|
337
337
|
{
|
|
338
338
|
// Hacky way to get a dictionary with `RCTComponentData` from UIManager.
|
|
339
|
-
NSMutableDictionary<NSString *, RCTComponentData *> *componentDataByName = [bridge
|
|
339
|
+
NSMutableDictionary<NSString *, RCTComponentData *> *componentDataByName = [[bridge uiManager] valueForKey:@"_componentDataByName"];
|
|
340
|
+
|
|
340
341
|
Class wrappedViewModuleClass = [ViewModuleWrapper createViewModuleWrapperClassWithModule:viewModule];
|
|
341
342
|
NSString *className = NSStringFromClass(wrappedViewModuleClass);
|
|
342
343
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#import <React/RCTBridge+Private.h>
|
|
7
7
|
#import <React/RCTAppState.h>
|
|
8
8
|
#import <React/RCTImageLoader.h>
|
|
9
|
+
#import <React/RCTUIManagerUtils.h>
|
|
9
10
|
|
|
10
11
|
#import <ExpoModulesCore/EXReactNativeAdapter.h>
|
|
11
12
|
|
|
@@ -74,7 +75,11 @@ EX_REGISTER_MODULE();
|
|
|
74
75
|
|
|
75
76
|
- (void)addUIBlock:(void (^)(NSDictionary<id, UIView *> *))block
|
|
76
77
|
{
|
|
78
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
79
|
+
[NSException raise:NSGenericException format:@"This version of `addUIBlock` is not supported in the New Architecture"];
|
|
80
|
+
#else
|
|
77
81
|
__weak EXReactNativeAdapter *weakSelf = self;
|
|
82
|
+
|
|
78
83
|
dispatch_async(_bridge.uiManager.methodQueue, ^{
|
|
79
84
|
__strong EXReactNativeAdapter *strongSelf = weakSelf;
|
|
80
85
|
if (strongSelf) {
|
|
@@ -83,6 +88,7 @@ EX_REGISTER_MODULE();
|
|
|
83
88
|
}];
|
|
84
89
|
}
|
|
85
90
|
});
|
|
91
|
+
#endif
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
- (void)addUIBlock:(void (^)(id))block forView:(id)viewId ofClass:(Class)klass
|
|
@@ -113,6 +119,9 @@ EX_REGISTER_MODULE();
|
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
- (void)executeUIBlock:(void (^)(NSDictionary<id,UIView *> *))block {
|
|
122
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
123
|
+
[NSException raise:NSGenericException format:@"This version of `executeUIBlock` is not supported in the New Architecture"];
|
|
124
|
+
#else
|
|
116
125
|
__weak EXReactNativeAdapter *weakSelf = self;
|
|
117
126
|
dispatch_async(_bridge.uiManager.methodQueue, ^{
|
|
118
127
|
__strong EXReactNativeAdapter *strongSelf = weakSelf;
|
|
@@ -123,6 +132,7 @@ EX_REGISTER_MODULE();
|
|
|
123
132
|
[strongSelf.bridge.uiManager setNeedsLayout];
|
|
124
133
|
}
|
|
125
134
|
});
|
|
135
|
+
#endif
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
|
|
@@ -190,11 +200,7 @@ EX_REGISTER_MODULE();
|
|
|
190
200
|
|
|
191
201
|
- (void *)javaScriptRuntimePointer
|
|
192
202
|
{
|
|
193
|
-
|
|
194
|
-
return _bridge.runtime;
|
|
195
|
-
} else {
|
|
196
|
-
return nil;
|
|
197
|
-
}
|
|
203
|
+
return _bridge.runtime;
|
|
198
204
|
}
|
|
199
205
|
|
|
200
206
|
# pragma mark - App state observing
|
|
@@ -282,36 +288,36 @@ EX_REGISTER_MODULE();
|
|
|
282
288
|
|
|
283
289
|
- (void)addUIBlock:(void (^)(UIView *view))block forView:(id)viewId
|
|
284
290
|
{
|
|
285
|
-
__weak
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
__weak RCTUIManager *uiManager = [_bridge uiManager];
|
|
292
|
+
|
|
293
|
+
dispatch_async(RCTGetUIManagerQueue(), ^{
|
|
294
|
+
[uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
295
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
296
|
+
UIView<RCTComponentViewProtocol> *componentView = [uiManager viewForReactTag:(NSNumber *)viewId];
|
|
297
|
+
UIView *view = [(ExpoFabricViewObjC *)componentView contentView];
|
|
298
|
+
#else
|
|
299
|
+
UIView *view = viewRegistry[viewId];
|
|
300
|
+
#endif
|
|
301
|
+
block(view);
|
|
302
|
+
}];
|
|
294
303
|
});
|
|
295
304
|
}
|
|
296
305
|
|
|
297
306
|
- (void)executeUIBlock:(void (^)(UIView *view))block forView:(id)viewId
|
|
298
307
|
{
|
|
299
|
-
__weak
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
UIView<RCTComponentViewProtocol> *componentView = [surfacePresenter.mountingManager.componentViewRegistry findComponentViewWithTag:[viewId integerValue]];
|
|
307
|
-
UIView *view = [(ExpoFabricViewObjC *)componentView contentView];
|
|
308
|
+
__weak RCTUIManager *uiManager = [_bridge uiManager];
|
|
309
|
+
|
|
310
|
+
dispatch_async(RCTGetUIManagerQueue(), ^{
|
|
311
|
+
[uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
312
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
313
|
+
UIView<RCTComponentViewProtocol> *componentView = [uiManager viewForReactTag:(NSNumber *)viewId];
|
|
314
|
+
UIView *view = [(ExpoFabricViewObjC *)componentView contentView];
|
|
308
315
|
#else
|
|
309
|
-
|
|
316
|
+
UIView *view = viewRegistry[viewId];
|
|
310
317
|
#endif
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
318
|
+
block(view);
|
|
319
|
+
}];
|
|
320
|
+
[uiManager setNeedsLayout];
|
|
315
321
|
});
|
|
316
322
|
}
|
|
317
323
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
-
#import <React/RCTBridge.h>
|
|
4
|
-
#import <React/RCTRootView.h>
|
|
5
3
|
#import <ExpoModulesCore/Platform.h>
|
|
6
4
|
|
|
7
5
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -11,17 +9,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
11
9
|
*/
|
|
12
10
|
@interface EXReactDelegateWrapper : NSObject
|
|
13
11
|
|
|
14
|
-
- (
|
|
15
|
-
|
|
12
|
+
- (UIView *)createReactRootView:(NSString *)moduleName
|
|
13
|
+
initialProperties:(nullable NSDictionary *)initialProperties
|
|
14
|
+
launchOptions:(nullable NSDictionary *)launchOptions;
|
|
16
15
|
|
|
17
|
-
- (
|
|
18
|
-
moduleName:(NSString *)moduleName
|
|
19
|
-
initialProperties:(nullable NSDictionary *)initialProperties;
|
|
20
|
-
|
|
21
|
-
- (RCTRootView *)createRootViewWithBridge:(RCTBridge *)bridge
|
|
22
|
-
moduleName:(NSString *)moduleName
|
|
23
|
-
initialProperties:(nullable NSDictionary *)initialProperties
|
|
24
|
-
fabricEnabled:(BOOL)fabricEnabled;
|
|
16
|
+
- (NSURL *)bundleURL;
|
|
25
17
|
|
|
26
18
|
- (UIViewController *)createRootViewController;
|
|
27
19
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#import <ExpoModulesCore/EXReactDelegateWrapper.h>
|
|
4
|
+
#import <ExpoModulesCore/EXReactDelegateWrapper+Private.h>
|
|
5
|
+
|
|
6
|
+
@interface EXReactDelegateWrapper()
|
|
7
|
+
|
|
8
|
+
@property (nonatomic, weak) EXReactDelegate *expoReactDelegate;
|
|
9
|
+
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
@implementation EXReactDelegateWrapper
|
|
13
|
+
|
|
14
|
+
- (instancetype)initWithExpoReactDelegate:(EXReactDelegate *)expoReactDelegate
|
|
15
|
+
{
|
|
16
|
+
if (self = [super init]) {
|
|
17
|
+
_expoReactDelegate = expoReactDelegate;
|
|
18
|
+
}
|
|
19
|
+
return self;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
- (UIView *)createReactRootView:(NSString *)moduleName
|
|
23
|
+
initialProperties:(nullable NSDictionary *)initialProperties
|
|
24
|
+
launchOptions:(nullable NSDictionary *)launchOptions
|
|
25
|
+
{
|
|
26
|
+
return [_expoReactDelegate createReactRootViewWithModuleName:moduleName
|
|
27
|
+
initialProperties:initialProperties
|
|
28
|
+
launchOptions:launchOptions];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (NSURL *)bundleURL
|
|
32
|
+
{
|
|
33
|
+
return [_expoReactDelegate bundleURL];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (UIViewController *)createRootViewController
|
|
37
|
+
{
|
|
38
|
+
return [_expoReactDelegate createRootViewController];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#import <ExpoModulesCore/Platform.h>
|
|
6
|
+
#import <ExpoModulesCore/EXReactDelegateWrapper.h>
|
|
7
|
+
|
|
8
|
+
#if __has_include(<React-RCTAppDelegate/RCTRootViewFactory.h>)
|
|
9
|
+
#import <React-RCTAppDelegate/RCTRootViewFactory.h>
|
|
10
|
+
#elif __has_include(<React_RCTAppDelegate/RCTRootViewFactory.h>)
|
|
11
|
+
// for importing the header from framework, the dash will be transformed to underscore
|
|
12
|
+
#import <React_RCTAppDelegate/RCTRootViewFactory.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
16
|
+
|
|
17
|
+
NS_SWIFT_NAME(ExpoReactRootViewFactory)
|
|
18
|
+
@interface EXReactRootViewFactory : RCTRootViewFactory
|
|
19
|
+
|
|
20
|
+
@property (nonatomic, weak, nullable) EXReactDelegateWrapper *reactDelegate;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
Initializer for EXAppDelegateWrapper integration
|
|
24
|
+
*/
|
|
25
|
+
- (instancetype)initWithReactDelegate:(nullable EXReactDelegateWrapper *)reactDelegate
|
|
26
|
+
configuration:(RCTRootViewFactoryConfiguration *)configuration
|
|
27
|
+
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
Calls super `viewWithModuleName:initialProperties:launchOptions:` from `RCTRootViewFactory`.
|
|
31
|
+
*/
|
|
32
|
+
- (UIView *)superViewWithModuleName:(NSString *)moduleName
|
|
33
|
+
initialProperties:(NSDictionary *)initialProperties
|
|
34
|
+
launchOptions:(NSDictionary *)launchOptions;
|
|
35
|
+
|
|
36
|
+
@end
|
|
37
|
+
|
|
38
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#import <ExpoModulesCore/EXReactRootViewFactory.h>
|
|
4
|
+
|
|
5
|
+
#import <ExpoModulesCore/EXReactDelegateWrapper+Private.h>
|
|
6
|
+
|
|
7
|
+
#if __has_include(<React-RCTAppDelegate/RCTAppDelegate.h>)
|
|
8
|
+
#import <React-RCTAppDelegate/RCTAppDelegate.h>
|
|
9
|
+
#elif __has_include(<React_RCTAppDelegate/RCTAppDelegate.h>)
|
|
10
|
+
// for importing the header from framework, the dash will be transformed to underscore
|
|
11
|
+
#import <React_RCTAppDelegate/RCTAppDelegate.h>
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
@interface RCTRootViewFactory ()
|
|
15
|
+
|
|
16
|
+
- (NSURL *)bundleURL;
|
|
17
|
+
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
@implementation EXReactRootViewFactory
|
|
21
|
+
|
|
22
|
+
- (instancetype)initWithReactDelegate:(nullable EXReactDelegateWrapper *)reactDelegate
|
|
23
|
+
configuration:(RCTRootViewFactoryConfiguration *)configuration
|
|
24
|
+
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
|
|
25
|
+
{
|
|
26
|
+
if (self = [super initWithConfiguration:configuration andTurboModuleManagerDelegate:turboModuleManagerDelegate]) {
|
|
27
|
+
self.reactDelegate = reactDelegate;
|
|
28
|
+
}
|
|
29
|
+
return self;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (UIView *)viewWithModuleName:(NSString *)moduleName
|
|
33
|
+
initialProperties:(nullable NSDictionary *)initialProperties
|
|
34
|
+
launchOptions:(nullable NSDictionary *)launchOptions
|
|
35
|
+
{
|
|
36
|
+
if (self.reactDelegate != nil) {
|
|
37
|
+
return [self.reactDelegate createReactRootView:moduleName initialProperties:initialProperties launchOptions:launchOptions];
|
|
38
|
+
}
|
|
39
|
+
return [super viewWithModuleName:moduleName initialProperties:initialProperties launchOptions:launchOptions];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (UIView *)superViewWithModuleName:(NSString *)moduleName
|
|
43
|
+
initialProperties:(NSDictionary *)initialProperties
|
|
44
|
+
launchOptions:(NSDictionary *)launchOptions
|
|
45
|
+
{
|
|
46
|
+
return [super viewWithModuleName:moduleName initialProperties:initialProperties launchOptions:launchOptions];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (NSURL *)bundleURL
|
|
50
|
+
{
|
|
51
|
+
return [self.reactDelegate bundleURL] ?: [super bundleURL];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@end
|
|
@@ -12,25 +12,32 @@ public class ExpoReactDelegate: NSObject {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
@objc
|
|
15
|
-
public func
|
|
16
|
-
self.handlers.forEach { $0.bridgeWillCreate() }
|
|
17
|
-
let result = self.handlers.lazy
|
|
18
|
-
.compactMap { $0.createBridge(reactDelegate: self, bridgeDelegate: delegate, launchOptions: launchOptions) }
|
|
19
|
-
.first(where: { _ in true }) ?? RCTBridge(delegate: delegate, launchOptions: launchOptions)!
|
|
20
|
-
self.handlers.forEach { $0.bridgeDidCreate(bridge: result) }
|
|
21
|
-
return result
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@objc
|
|
25
|
-
public func createRootView(
|
|
26
|
-
bridge: RCTBridge,
|
|
15
|
+
public func createReactRootView(
|
|
27
16
|
moduleName: String,
|
|
28
17
|
initialProperties: [AnyHashable: Any]?,
|
|
29
|
-
|
|
18
|
+
launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
30
19
|
) -> UIView {
|
|
31
20
|
return self.handlers.lazy
|
|
32
|
-
.compactMap { $0.
|
|
33
|
-
.first(where: { _ in true })
|
|
21
|
+
.compactMap { $0.createReactRootView(reactDelegate: self, moduleName: moduleName, initialProperties: initialProperties, launchOptions: launchOptions) }
|
|
22
|
+
.first(where: { _ in true })
|
|
23
|
+
?? {
|
|
24
|
+
guard let rctAppDelegate = (UIApplication.shared.delegate as? RCTAppDelegate) else {
|
|
25
|
+
fatalError("The `UIApplication.shared.delegate` is not a `RCTAppDelegate` instance.")
|
|
26
|
+
}
|
|
27
|
+
return rctAppDelegate.recreateRootView(
|
|
28
|
+
withBundleURL: nil,
|
|
29
|
+
moduleName: moduleName,
|
|
30
|
+
initialProps: initialProperties,
|
|
31
|
+
launchOptions: launchOptions
|
|
32
|
+
)
|
|
33
|
+
}()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@objc
|
|
37
|
+
public func bundleURL() -> URL? {
|
|
38
|
+
return self.handlers.lazy
|
|
39
|
+
.compactMap { $0.bundleURL(reactDelegate: self) }
|
|
40
|
+
.first(where: { _ in true })
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
@objc
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
-
import React
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
The handler for `ExpoReactDelegate`. A module can implement a handler to process react instance creation.
|
|
7
5
|
*/
|
|
@@ -10,20 +8,25 @@ open class ExpoReactDelegateHandler: NSObject {
|
|
|
10
8
|
public override required init() {}
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
|
-
If this module wants to handle
|
|
11
|
+
If this module wants to handle React instance and the root view creation, it can return the instance.
|
|
14
12
|
Otherwise return nil.
|
|
15
13
|
*/
|
|
16
14
|
@objc
|
|
17
|
-
open func
|
|
15
|
+
open func createReactRootView(
|
|
16
|
+
reactDelegate: ExpoReactDelegate,
|
|
17
|
+
moduleName: String,
|
|
18
|
+
initialProperties: [AnyHashable: Any]?,
|
|
19
|
+
launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
|
20
|
+
) -> UIView? {
|
|
18
21
|
return nil
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
Clients could override this getter to serve the latest bundleURL for React instance.
|
|
26
|
+
For example, expo-updates uses this to serve the newer bundleURL from `Updates.reloadAsync()`.
|
|
24
27
|
*/
|
|
25
28
|
@objc
|
|
26
|
-
open func
|
|
29
|
+
open func bundleURL(reactDelegate: ExpoReactDelegate) -> URL? {
|
|
27
30
|
return nil
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -35,18 +38,4 @@ open class ExpoReactDelegateHandler: NSObject {
|
|
|
35
38
|
open func createRootViewController(reactDelegate: ExpoReactDelegate) -> UIViewController? {
|
|
36
39
|
return nil
|
|
37
40
|
}
|
|
38
|
-
|
|
39
|
-
// MARK: - event callbacks
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
Callback before bridge creation
|
|
43
|
-
*/
|
|
44
|
-
@objc
|
|
45
|
-
open func bridgeWillCreate() {}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
Callback after bridge creation
|
|
49
|
-
*/
|
|
50
|
-
@objc
|
|
51
|
-
open func bridgeDidCreate(bridge: RCTBridge) {}
|
|
52
41
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#if __has_include(<React-RCTAppDelegate/RCTAppDelegate.h>)
|
|
6
|
+
#import <React-RCTAppDelegate/RCTAppDelegate.h>
|
|
7
|
+
#elif __has_include(<React_RCTAppDelegate/RCTAppDelegate.h>)
|
|
8
|
+
// for importing the header from framework, the dash will be transformed to underscore
|
|
9
|
+
#import <React_RCTAppDelegate/RCTAppDelegate.h>
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@interface RCTAppDelegate (Recreate)
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
Recreates a root view bound with customized bundleURL, moduleName, initialProps, and launchOptions.
|
|
18
|
+
If any of these parameters is null, the method will use the original one from `RCTAppDelegate` or `RCTRootViewFactory`.
|
|
19
|
+
This method should be used with `EXReactRootViewFactory` that to recreate a root view.
|
|
20
|
+
*/
|
|
21
|
+
- (UIView *)recreateRootViewWithBundleURL:(nullable NSURL *)bundleURL
|
|
22
|
+
moduleName:(nullable NSString *)moduleName
|
|
23
|
+
initialProps:(nullable NSDictionary *)initialProps
|
|
24
|
+
launchOptions:(nullable NSDictionary *)launchOptions;
|
|
25
|
+
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#import <ExpoModulesCore/RCTAppDelegate+Recreate.h>
|
|
4
|
+
|
|
5
|
+
#import <ExpoModulesCore/EXReactRootViewFactory.h>
|
|
6
|
+
|
|
7
|
+
@implementation RCTAppDelegate (Recreate)
|
|
8
|
+
|
|
9
|
+
- (UIView *)recreateRootViewWithBundleURL:(nullable NSURL *)bundleURL
|
|
10
|
+
moduleName:(nullable NSString *)moduleName
|
|
11
|
+
initialProps:(nullable NSDictionary *)initialProps
|
|
12
|
+
launchOptions:(nullable NSDictionary *)launchOptions
|
|
13
|
+
{
|
|
14
|
+
if (self.bridgelessEnabled) {
|
|
15
|
+
id reactHost = [self.rootViewFactory valueForKey:@"_reactHost"];
|
|
16
|
+
RCTAssert(reactHost == nil, @"recreateRootViewWithBundleURL: does not support when react instance is created");
|
|
17
|
+
} else {
|
|
18
|
+
RCTAssert(self.rootViewFactory.bridge == nil, @"recreateRootViewWithBundleURL: does not support when react instance is created");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
RCTRootViewFactory *rootViewFactory = self.rootViewFactory;
|
|
22
|
+
RCTRootViewFactoryConfiguration *configuration = [rootViewFactory valueForKey:@"_configuration"];
|
|
23
|
+
if (bundleURL != nil) {
|
|
24
|
+
configuration.bundleURLBlock = ^{
|
|
25
|
+
return bundleURL;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (moduleName != nil) {
|
|
29
|
+
self.moduleName = moduleName;
|
|
30
|
+
}
|
|
31
|
+
if (initialProps != nil) {
|
|
32
|
+
self.initialProps = initialProps;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
UIView *rootView;
|
|
36
|
+
if ([rootViewFactory isKindOfClass:[EXReactRootViewFactory class]]) {
|
|
37
|
+
// When calling `recreateRootViewWithBundleURL:` from `EXReactRootViewFactory`,
|
|
38
|
+
// we don't want to loop the ReactDelegate again. Otherwise it will be infinite loop.
|
|
39
|
+
EXReactRootViewFactory *factory = (EXReactRootViewFactory *)rootViewFactory;
|
|
40
|
+
rootView = [factory superViewWithModuleName:self.moduleName initialProperties:self.initialProps launchOptions:launchOptions];
|
|
41
|
+
} else {
|
|
42
|
+
rootView = [rootViewFactory viewWithModuleName:self.moduleName initialProperties:self.initialProps launchOptions:launchOptions];
|
|
43
|
+
}
|
|
44
|
+
return rootView;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@end
|
|
@@ -2,12 +2,12 @@ import ExpoModulesTestCore
|
|
|
2
2
|
|
|
3
3
|
@testable import ExpoModulesCore
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ClassDefinitionSpec: ExpoSpec {
|
|
6
6
|
override class func spec() {
|
|
7
7
|
describe("basic") {
|
|
8
|
-
it("factory returns a
|
|
8
|
+
it("factory returns a definition") {
|
|
9
9
|
let klass = Class("") {}
|
|
10
|
-
expect(klass).to(beAnInstanceOf(
|
|
10
|
+
expect(klass).to(beAnInstanceOf(ClassDefinition.self))
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
it("has a name") {
|
|
@@ -121,15 +121,15 @@ class ClassComponentSpec: ExpoSpec {
|
|
|
121
121
|
}
|
|
122
122
|
it("creates shared object") {
|
|
123
123
|
let jsObject = try runtime.eval("new expo.modules.TestModule.Counter(0)").getObject()
|
|
124
|
-
let nativeObject =
|
|
124
|
+
let nativeObject = appContext.sharedObjectRegistry.toNativeObject(jsObject)
|
|
125
125
|
|
|
126
126
|
expect(nativeObject).notTo(beNil())
|
|
127
127
|
}
|
|
128
128
|
it("registers shared object") {
|
|
129
|
-
let oldSize =
|
|
129
|
+
let oldSize = appContext.sharedObjectRegistry.size
|
|
130
130
|
try runtime.eval("object = new expo.modules.TestModule.Counter(0)")
|
|
131
131
|
|
|
132
|
-
expect(
|
|
132
|
+
expect(appContext.sharedObjectRegistry.size) == oldSize + 1
|
|
133
133
|
}
|
|
134
134
|
it("calls function with owner") {
|
|
135
135
|
try runtime.eval([
|
|
@@ -408,7 +408,12 @@ class ConvertiblesSpec: ExpoSpec {
|
|
|
408
408
|
|
|
409
409
|
it("converts from `Date.now()` to Date") {
|
|
410
410
|
let date = try Date.convert(from: 1703718341639, appContext: appContext)
|
|
411
|
-
|
|
411
|
+
var components = Calendar.current.dateComponents([.day, .month], from: date)
|
|
412
|
+
|
|
413
|
+
// The current calendar uses the local timezone, so basically the `day` component
|
|
414
|
+
// could differ depending on the current timezone. Set it to GMT for correctness.
|
|
415
|
+
components.timeZone = TimeZone(abbreviation: "GMT")
|
|
416
|
+
|
|
412
417
|
expect(components.month) == 12
|
|
413
418
|
expect(components.day) == 27
|
|
414
419
|
}
|
|
@@ -14,10 +14,6 @@ final class CoreModuleSpec: ExpoSpec {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
describe("core object") {
|
|
17
|
-
it("is initialized") {
|
|
18
|
-
expect(runtime.coreObject).notTo(beNil())
|
|
19
|
-
}
|
|
20
|
-
|
|
21
17
|
it("is installed to global scope") {
|
|
22
18
|
let coreObjectValue = try runtime.eval("expo")
|
|
23
19
|
expect(coreObjectValue.kind) == .object
|
|
@@ -300,7 +300,7 @@ final class DynamicTypeSpec: ExpoSpec {
|
|
|
300
300
|
let nativeObject = TestSharedObject()
|
|
301
301
|
let jsObjectValue = try appContext.runtime.eval("({})")
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
appContext.sharedObjectRegistry.add(native: nativeObject, javaScript: try jsObjectValue.asObject())
|
|
304
304
|
|
|
305
305
|
// `DynamicSharedObjectType` only supports casting
|
|
306
306
|
// from `JavaScriptValue`, but not from `JavaScriptObject`.
|