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,10 +4,10 @@ import android.content.Context
|
|
|
4
4
|
import android.view.View
|
|
5
5
|
import android.view.ViewGroup
|
|
6
6
|
import com.facebook.react.bridge.ReactContext
|
|
7
|
-
import expo.modules.adapters.react.NativeModulesProxy
|
|
8
7
|
import expo.modules.kotlin.AppContext
|
|
9
8
|
import expo.modules.kotlin.exception.CodedException
|
|
10
9
|
import expo.modules.kotlin.functions.BaseAsyncFunctionComponent
|
|
10
|
+
import expo.modules.kotlin.getUnimoduleProxy
|
|
11
11
|
|
|
12
12
|
class ViewManagerDefinition(
|
|
13
13
|
private val viewFactory: (Context, AppContext) -> View,
|
|
@@ -34,10 +34,7 @@ class ViewManagerDefinition(
|
|
|
34
34
|
|
|
35
35
|
fun handleException(view: View, exception: CodedException) {
|
|
36
36
|
val reactContext = (view.context as? ReactContext) ?: return
|
|
37
|
-
val nativeModulesProxy = reactContext
|
|
38
|
-
.catalystInstance
|
|
39
|
-
?.getNativeModule("NativeUnimoduleProxy") as? NativeModulesProxy
|
|
40
|
-
?: return
|
|
37
|
+
val nativeModulesProxy = reactContext.getUnimoduleProxy() ?: return
|
|
41
38
|
val appContext = nativeModulesProxy.kotlinInteropModuleRegistry.appContext
|
|
42
39
|
|
|
43
40
|
appContext.errorManager?.reportExceptionToLogBox(exception)
|
package/build/EventEmitter.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ type NativeModule = {
|
|
|
3
3
|
__expo_module_name__?: string;
|
|
4
4
|
startObserving?: () => void;
|
|
5
5
|
stopObserving?: () => void;
|
|
6
|
-
addListener
|
|
7
|
-
removeListeners
|
|
6
|
+
addListener?: any;
|
|
7
|
+
removeListeners?: any;
|
|
8
8
|
};
|
|
9
9
|
export type Subscription = {
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../src/EventEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../src/EventEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAY,MAAM,cAAc,CAAC;AAI5D,KAAK,YAAY,GAAG;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAI3B,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,eAAe,CAAC,EAAE,GAAG,CAAC;CACvB,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,qBAAa,YAAY;IACvB,cAAc,SAAK;IAGnB,aAAa,EAAE,YAAY,CAAC;IAG5B,aAAa,EAAE,kBAAkB,CAAC;gBAEtB,YAAY,EAAE,YAAY;IAWtC,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,YAAY;IAgB7E,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAmB3C,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAuBpD,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;CAGhD"}
|
package/build/EventEmitter.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import invariant from 'invariant';
|
|
2
|
-
import { NativeEventEmitter,
|
|
2
|
+
import { NativeEventEmitter, Platform } from 'react-native';
|
|
3
3
|
const nativeEmitterSubscriptionKey = '@@nativeEmitterSubscription@@';
|
|
4
4
|
export class EventEmitter {
|
|
5
5
|
_listenerCount = 0;
|
|
6
|
+
// @ts-expect-error
|
|
6
7
|
_nativeModule;
|
|
8
|
+
// @ts-expect-error
|
|
7
9
|
_eventEmitter;
|
|
8
10
|
constructor(nativeModule) {
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
nativeModule.addListener = (...args) => NativeModules.EXReactNativeEventEmitter.addProxiedListener(nativeModule.__expo_module_name__, ...args);
|
|
15
|
-
nativeModule.removeListeners = (...args) => NativeModules.EXReactNativeEventEmitter.removeProxiedListeners(nativeModule.__expo_module_name__, ...args);
|
|
11
|
+
// If the native module is a new module, just return it back as it's already an event emitter.
|
|
12
|
+
// This is for backwards compatibility until we stop using this legacy class in other packages.
|
|
13
|
+
if (nativeModule.__expo_module_name__) {
|
|
14
|
+
// @ts-expect-error
|
|
15
|
+
return nativeModule;
|
|
16
16
|
}
|
|
17
17
|
this._nativeModule = nativeModule;
|
|
18
18
|
this._eventEmitter = new NativeEventEmitter(nativeModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.js","sourceRoot":"","sources":["../src/EventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"EventEmitter.js","sourceRoot":"","sources":["../src/EventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,4BAA4B,GAAG,+BAA+B,CAAC;AAqBrE,MAAM,OAAO,YAAY;IACvB,cAAc,GAAG,CAAC,CAAC;IAEnB,mBAAmB;IACnB,aAAa,CAAe;IAE5B,mBAAmB;IACnB,aAAa,CAAqB;IAElC,YAAY,YAA0B;QACpC,8FAA8F;QAC9F,+FAA+F;QAC/F,IAAI,YAAY,CAAC,oBAAoB,EAAE;YACrC,mBA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AAK,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;YACrF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;SACpC;IACH,CAAC;IAED,kBAAkB,CAAC,YAA0B;QAC3C,MAAM,yBAAyB,GAAG,YAAY,CAAC,4BAA4B,CAAC,CAAC;QAC7E,IAAI,CAAC,yBAAyB,EAAE;YAC9B,OAAO;SACR;QAED,IAAI,QAAQ,IAAI,yBAAyB,EAAE;YACzC,yBAAyB,CAAC,MAAM,EAAE,CAAC;SACpC;QACD,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,2FAA2F;QAC3F,0CAA0C;QAC1C,OAAO,YAAY,CAAC,4BAA4B,CAAC,CAAC;QAElD,gDAAgD;QAChD,YAAY,CAAC,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QAE/B,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;YACrF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;SACpC;IACH,CAAC;IAED,IAAI,CAAC,SAAiB,EAAE,GAAG,MAAa;QACtC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,CAAC;IAChD,CAAC;CACF","sourcesContent":["import invariant from 'invariant';\nimport { NativeEventEmitter, Platform } from 'react-native';\n\nconst nativeEmitterSubscriptionKey = '@@nativeEmitterSubscription@@';\n\ntype NativeModule = {\n __expo_module_name__?: string;\n startObserving?: () => void;\n stopObserving?: () => void;\n\n // Erase these types as they would conflict with the new NativeModule type.\n // This EventEmitter is deprecated anyway.\n addListener?: any;\n removeListeners?: any;\n};\n\n// @needsAudit\nexport type Subscription = {\n /**\n * A method to unsubscribe the listener.\n */\n remove: () => void;\n};\n\nexport class EventEmitter {\n _listenerCount = 0;\n\n // @ts-expect-error\n _nativeModule: NativeModule;\n\n // @ts-expect-error\n _eventEmitter: NativeEventEmitter;\n\n constructor(nativeModule: NativeModule) {\n // If the native module is a new module, just return it back as it's already an event emitter.\n // This is for backwards compatibility until we stop using this legacy class in other packages.\n if (nativeModule.__expo_module_name__) {\n // @ts-expect-error\n return nativeModule;\n }\n this._nativeModule = nativeModule;\n this._eventEmitter = new NativeEventEmitter(nativeModule as any);\n }\n\n addListener<T>(eventName: string, listener: (event: T) => void): Subscription {\n if (!this._listenerCount && Platform.OS !== 'ios' && this._nativeModule.startObserving) {\n this._nativeModule.startObserving();\n }\n\n this._listenerCount++;\n const nativeEmitterSubscription = this._eventEmitter.addListener(eventName, listener);\n const subscription = {\n [nativeEmitterSubscriptionKey]: nativeEmitterSubscription,\n remove: () => {\n this.removeSubscription(subscription);\n },\n };\n return subscription;\n }\n\n removeAllListeners(eventName: string): void {\n // @ts-ignore: the EventEmitter interface has been changed in react-native@0.64.0\n const removedListenerCount = this._eventEmitter.listenerCount\n ? // @ts-ignore: this is available since 0.64\n this._eventEmitter.listenerCount(eventName)\n : // @ts-ignore: this is available in older versions\n this._eventEmitter.listeners(eventName).length;\n this._eventEmitter.removeAllListeners(eventName);\n this._listenerCount -= removedListenerCount;\n invariant(\n this._listenerCount >= 0,\n `EventEmitter must have a non-negative number of listeners`\n );\n\n if (!this._listenerCount && Platform.OS !== 'ios' && this._nativeModule.stopObserving) {\n this._nativeModule.stopObserving();\n }\n }\n\n removeSubscription(subscription: Subscription): void {\n const nativeEmitterSubscription = subscription[nativeEmitterSubscriptionKey];\n if (!nativeEmitterSubscription) {\n return;\n }\n\n if ('remove' in nativeEmitterSubscription) {\n nativeEmitterSubscription.remove();\n }\n this._listenerCount--;\n\n // Ensure that the emitter's internal state remains correct even if `removeSubscription` is\n // called again with the same subscription\n delete subscription[nativeEmitterSubscriptionKey];\n\n // Release closed-over references to the emitter\n subscription.remove = () => {};\n\n if (!this._listenerCount && Platform.OS !== 'ios' && this._nativeModule.stopObserving) {\n this._nativeModule.stopObserving();\n }\n }\n\n emit(eventName: string, ...params: any[]): void {\n this._eventEmitter.emit(eventName, ...params);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeModule.d.ts","sourceRoot":"","sources":["../src/NativeModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;;AAInE,wBAAmE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeModule.js","sourceRoot":"","sources":["../src/NativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAGpF,+BAA+B,EAAE,CAAC;AAElC,eAAe,UAAU,CAAC,IAAI,CAAC,YAAmC,CAAC","sourcesContent":["import { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';\nimport type { NativeModule } from './ts-declarations/NativeModule';\n\nensureNativeModulesAreInstalled();\n\nexport default globalThis.expo.NativeModule as typeof NativeModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeModulesProxy.native.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.native.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NativeModulesProxy.native.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.native.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAU/D,QAAA,MAAM,kBAAkB,EAAE;IAAE,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAO,CAAC;AA+D3E,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// Copyright © 2024 650 Industries.
|
|
2
|
+
// NOTE: Forcing this to be a client boundary so the errors are a bit clearer. In the future we can
|
|
3
|
+
// make this a shim on the server by ignoring the globals that are missing in React Server contexts (Node.js).
|
|
4
|
+
'use client';
|
|
1
5
|
import { NativeModules } from 'react-native';
|
|
2
6
|
const LegacyNativeProxy = NativeModules.NativeUnimoduleProxy;
|
|
3
7
|
// Fixes `cannot find name 'global'.` in tests
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeModulesProxy.native.js","sourceRoot":"","sources":["../src/NativeModulesProxy.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,iBAAiB,GAAG,aAAa,CAAC,oBAAoB,CAAC;AAC7D,8CAA8C;AAC9C,aAAa;AACb,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,kBAAkB,CAAC;AAEjE,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAC/C,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAE7C,MAAM,kBAAkB,GAAgD,EAAE,CAAC;AAE3E,IAAI,iBAAiB,EAAE;IACrB,0DAA0D;IAC1D,MAAM,WAAW,GAAG,eAAe,IAAI,iBAAiB,CAAC;IAEzD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QAClE,iBAAiB;QACjB,kBAAkB,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,mBAAmB,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAEpF,eAAe;QACf,WAAW,CAAC,kBAAkB,CAAC,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACjE,kBAAkB,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAe,EAAgB,EAAE;gBACrF,oEAAoE;gBACpE,IAAI,eAAe,EAAE,UAAU,EAAE;oBAC/B,OAAO,eAAe,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBACtE;gBAED,2CAA2C;gB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GAAG,EAAE,GAAE,CAAC,CAAC;SAC3D;IACH,CAAC,CAAC,CAAC;CACJ;KAAM;IACL,OAAO,CAAC,IAAI,CACV,gJAAgJ,CACjJ,CAAC;CACH;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright © 2024 650 Industries.\n// NOTE: Forcing this to be a client boundary so the errors are a bit clearer. In the future we can\n// make this a shim on the server by ignoring the globals that are missing in React Server contexts (Node.js).\n'use client';\n\nimport { NativeModules } from 'react-native';\n\nimport { ProxyNativeModule } from './NativeModulesProxy.types';\n\nconst LegacyNativeProxy = NativeModules.NativeUnimoduleProxy;\n// Fixes `cannot find name 'global'.` in tests\n// @ts-ignore\nconst ExpoNativeProxy = global.expo?.modules?.NativeModulesProxy;\n\nconst modulesConstantsKey = 'modulesConstants';\nconst exportedMethodsKey = 'exportedMethods';\n\nconst NativeModulesProxy: { [moduleName: string]: ProxyNativeModule } = {};\n\nif (LegacyNativeProxy) {\n // use JSI proxy if available, fallback to legacy RN proxy\n const NativeProxy = ExpoNativeProxy ?? LegacyNativeProxy;\n\n Object.keys(NativeProxy[exportedMethodsKey]).forEach((moduleName) => {\n // copy constants\n NativeModulesProxy[moduleName] = NativeProxy[modulesConstantsKey][moduleName] || {};\n\n // copy methods\n NativeProxy[exportedMethodsKey][moduleName].forEach((methodInfo) => {\n NativeModulesProxy[moduleName][methodInfo.name] = (...args: unknown[]): Promise<any> => {\n // Use the new proxy to call methods on legacy modules, if possible.\n if (ExpoNativeProxy?.callMethod) {\n return ExpoNativeProxy.callMethod(moduleName, methodInfo.name, args);\n }\n\n // Otherwise fall back to the legacy proxy.\n // This is deprecated and might be removed in SDK47 or later.\n const { key, argumentsCount } = methodInfo;\n if (argumentsCount !== args.length) {\n return Promise.reject(\n new Error(\n `Native method ${moduleName}.${methodInfo.name} expects ${argumentsCount} ${\n argumentsCount === 1 ? 'argument' : 'arguments'\n } but received ${args.length}`\n )\n );\n }\n return LegacyNativeProxy.callMethod(moduleName, key, args);\n };\n });\n\n // These are called by EventEmitter (which is a wrapper for NativeEventEmitter)\n // only on iOS and they use iOS-specific native module, EXReactNativeEventEmitter.\n //\n // On Android only {start,stop}Observing are called on the native module\n // and these should be exported as Expo methods.\n //\n // Before the RN 65, addListener/removeListeners weren't called on Android. However, it no longer stays true.\n // See https://github.com/facebook/react-native/commit/f5502fbda9fe271ff6e1d0da773a3a8ee206a453.\n // That's why, we check if the `EXReactNativeEventEmitter` exists and only if yes, we use it in the listener implementation.\n // Otherwise, those methods are NOOP.\n if (NativeModules.EXReactNativeEventEmitter) {\n NativeModulesProxy[moduleName].addListener = (...args) =>\n NativeModules.EXReactNativeEventEmitter.addProxiedListener(moduleName, ...args);\n NativeModulesProxy[moduleName].removeListeners = (...args) =>\n NativeModules.EXReactNativeEventEmitter.removeProxiedListeners(moduleName, ...args);\n } else {\n // Fixes on Android:\n // WARN `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.\n // WARN `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.\n NativeModulesProxy[moduleName].addListener = () => {};\n NativeModulesProxy[moduleName].removeListeners = () => {};\n }\n });\n} else {\n console.warn(\n `The \"EXNativeModulesProxy\" native module is not exported through NativeModules; verify that expo-modules-core's native code is linked properly`\n );\n}\n\nexport default NativeModulesProxy;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type ProxyNativeModule = {
|
|
2
2
|
[propertyName: string]: any;
|
|
3
|
-
addListener
|
|
4
|
-
removeListeners
|
|
3
|
+
addListener?: (eventName: string) => void;
|
|
4
|
+
removeListeners?: (count: number) => void;
|
|
5
5
|
};
|
|
6
6
|
//# sourceMappingURL=NativeModulesProxy.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeModulesProxy.types.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,YAAY,EAAE,MAAM,GAAG,GAAG,CAAC;IAC5B,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeModulesProxy.types.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,YAAY,EAAE,MAAM,GAAG,GAAG,CAAC;IAC5B,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeModulesProxy.types.js","sourceRoot":"","sources":["../src/NativeModulesProxy.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ProxyNativeModule = {\n [propertyName: string]: any;\n addListener
|
|
1
|
+
{"version":3,"file":"NativeModulesProxy.types.js","sourceRoot":"","sources":["../src/NativeModulesProxy.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ProxyNativeModule = {\n [propertyName: string]: any;\n addListener?: (eventName: string) => void;\n removeListeners?: (count: number) => void;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeViewManagerAdapter.native.d.ts","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.native.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NativeViewManagerAdapter.native.d.ts","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.native.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAuD1B;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAiDpF"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
// Copyright © 2024 650 Industries.
|
|
2
|
+
'use client';
|
|
1
3
|
import React from 'react';
|
|
2
|
-
import { findNodeHandle, NativeModules
|
|
4
|
+
import { findNodeHandle, NativeModules } from 'react-native';
|
|
5
|
+
import * as NativeComponentRegistry from 'react-native/Libraries/NativeComponent/NativeComponentRegistry';
|
|
3
6
|
import { requireNativeModule } from './requireNativeModule';
|
|
4
7
|
// To make the transition from React Native's `requireNativeComponent` to Expo's
|
|
5
8
|
// `requireNativeViewManager` as easy as possible, `requireNativeViewManager` is a drop-in
|
|
@@ -13,6 +16,22 @@ import { requireNativeModule } from './requireNativeModule';
|
|
|
13
16
|
* A map that caches registered native components.
|
|
14
17
|
*/
|
|
15
18
|
const nativeComponentsCache = new Map();
|
|
19
|
+
/**
|
|
20
|
+
* Requires a React Native component using the static view config from an Expo module.
|
|
21
|
+
*/
|
|
22
|
+
function requireNativeComponent(viewName) {
|
|
23
|
+
return NativeComponentRegistry.get(viewName, () => {
|
|
24
|
+
const viewModuleName = viewName.replace('ViewManagerAdapter_', '');
|
|
25
|
+
const expoViewConfig = globalThis.expo?.getViewConfig(viewModuleName);
|
|
26
|
+
if (!expoViewConfig) {
|
|
27
|
+
console.warn('Unable to get the view config for %s', viewModuleName);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
uiViewClassName: viewName,
|
|
31
|
+
...expoViewConfig,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
16
35
|
/**
|
|
17
36
|
* Requires a React Native component from cache if possible. This prevents
|
|
18
37
|
* "Tried to register two views with the same name" errors on fast refresh, but
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeViewManagerAdapter.native.js","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"NativeViewManagerAdapter.native.js","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.native.tsx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QAChE,gIAAgI;KACjI;IAED,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright © 2024 650 Industries.\n\n'use client';\n\nimport React from 'react';\nimport { findNodeHandle, NativeModules, HostComponent } from 'react-native';\nimport * as NativeComponentRegistry from 'react-native/Libraries/NativeComponent/NativeComponentRegistry';\n\nimport { requireNativeModule } from './requireNativeModule';\n\n// To make the transition from React Native's `requireNativeComponent` to Expo's\n// `requireNativeViewManager` as easy as possible, `requireNativeViewManager` is a drop-in\n// replacement for `requireNativeComponent`.\n//\n// For each view manager, we create a wrapper component that accepts all of the props available to\n// the author of the universal module. This wrapper component splits the props into two sets: props\n// passed to React Native's View (ex: style, testID) and custom view props, which are passed to the\n// adapter view component in a prop called `proxiedProperties`.\n\n/**\n * A map that caches registered native components.\n */\nconst nativeComponentsCache = new Map<string, HostComponent<any>>();\n\n/**\n * Requires a React Native component using the static view config from an Expo module.\n */\nfunction requireNativeComponent<Props>(viewName: string): HostComponent<Props> {\n return NativeComponentRegistry.get<Props>(viewName, () => {\n const viewModuleName = viewName.replace('ViewManagerAdapter_', '');\n const expoViewConfig = globalThis.expo?.getViewConfig(viewModuleName);\n\n if (!expoViewConfig) {\n console.warn('Unable to get the view config for %s', viewModuleName);\n }\n\n return {\n uiViewClassName: viewName,\n ...expoViewConfig,\n };\n });\n}\n\n/**\n * Requires a React Native component from cache if possible. This prevents\n * \"Tried to register two views with the same name\" errors on fast refresh, but\n * also when there are multiple versions of the same package with native component.\n */\nfunction requireCachedNativeComponent<Props>(viewName: string): HostComponent<Props> {\n const cachedNativeComponent = nativeComponentsCache.get(viewName);\n\n if (!cachedNativeComponent) {\n const nativeComponent = requireNativeComponent<Props>(viewName);\n nativeComponentsCache.set(viewName, nativeComponent);\n return nativeComponent;\n }\n return cachedNativeComponent;\n}\n\n/**\n * A drop-in replacement for `requireNativeComponent`.\n */\nexport function requireNativeViewManager<P>(viewName: string): React.ComponentType<P> {\n const { viewManagersMetadata } = NativeModules.NativeUnimoduleProxy;\n const viewManagerConfig = viewManagersMetadata?.[viewName];\n\n if (__DEV__ && !viewManagerConfig) {\n const exportedViewManagerNames = Object.keys(viewManagersMetadata).join(', ');\n console.warn(\n `The native view manager required by name (${viewName}) from NativeViewManagerAdapter isn't exported by expo-modules-core. Views of this type may not render correctly. Exported view managers: [${exportedViewManagerNames}].`\n );\n }\n\n // Set up the React Native native component, which is an adapter to the universal module's view\n // manager\n const reactNativeViewName = `ViewManagerAdapter_${viewName}`;\n const ReactNativeComponent = requireCachedNativeComponent(reactNativeViewName);\n\n class NativeComponent extends React.PureComponent<P> {\n static displayName = viewName;\n\n // This will be accessed from native when the prototype functions are called,\n // in order to find the associated native view.\n nativeTag: number | null = null;\n\n componentDidMount(): void {\n this.nativeTag = findNodeHandle(this);\n }\n\n render(): React.ReactNode {\n return <ReactNativeComponent {...this.props} />;\n }\n }\n\n try {\n const nativeModule = requireNativeModule(viewName);\n const nativeViewPrototype = nativeModule.ViewPrototype;\n\n if (nativeViewPrototype) {\n // Assign native view functions to the component prototype so they can be accessed from the ref.\n Object.assign(NativeComponent.prototype, nativeViewPrototype);\n }\n } catch {\n // `requireNativeModule` may throw an error when the native module cannot be found.\n // In some tests we don't mock the entire modules, but we do want to mock native views. For now,\n // until we still have to support the legacy modules proxy and don't have better ways to mock,\n // let's just gracefully skip assigning the prototype functions.\n // See: https://github.com/expo/expo/blob/main/packages/expo-modules-core/src/__tests__/NativeViewManagerAdapter-test.native.tsx\n }\n\n return NativeComponent;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionsHook.d.ts","sourceRoot":"","sources":["../src/PermissionsHook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PermissionsHook.d.ts","sourceRoot":"","sources":["../src/PermissionsHook.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,KAAK,uBAAuB,CAAC,UAAU,SAAS,kBAAk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MAAM,iBAAiB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC/C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,aAAa,CAC1C,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAE,iBAA6B,CAAC,CAAC,CAAC,SAAS,CACvF,CAAC;QACF,IAAI,SAAS,CAAC,OAAO;YAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC3C,OAAO,QAAQ,CAAC;IAClB,CAAC,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IAE5B,SAAS,CACP,SAAS,UAAU;QACjB,IAAI,OAAO;YAAE,iBAAiB,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,IAAI,GAAG;YAAE,aAAa,EAAE,CAAC;IACvC,CAAC,EACD,CAAC,GAAG,EAAE,OAAO,EAAE,iBAAiB,EAAE,aAAa,CAAC,CACjD,CAAC;IAEF,+DAA+D;IAC/D,SAAS,CAAC,SAAS,QAAQ;QACzB,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QACzB,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAmD;IAEnD,OAAO,CAAC,OAAwC,EAAE,EAAE,CAClD,aAAa,CAAsB,OAAO,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC","sourcesContent":["// Copyright © 2024 650 Industries.\n\n'use client';\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { PermissionResponse } from './PermissionsInterface';\n\n// These types are identical, but improves the readability for suggestions in editors\ntype RequestPermissionMethod<Permission extends PermissionResponse> = () => Promise<Permission>;\ntype GetPermissionMethod<Permission extends PermissionResponse> = () => Promise<Permission>;\n\ninterface PermissionHookMethods<Permission extends PermissionResponse, Options = never> {\n /** The permission method that requests the user to grant permission. */\n requestMethod: (options?: Options) => Promise<Permission>;\n /** The permission method that only fetches the current permission status. */\n getMethod: (options?: Options) => Promise<Permission>;\n}\n\ninterface PermissionHookBehavior {\n /** If the hook should automatically fetch the current permission status, without asking the user. */\n get?: boolean;\n /** If the hook should automatically request the user to grant permission. */\n request?: boolean;\n}\n\nexport type PermissionHookOptions<Options extends object> = PermissionHookBehavior & Options;\n\n/**\n * Get or request permission for protected functionality within the app.\n * It uses separate permission requesters to interact with a single permission.\n * By default, the hook will only retrieve the permission status.\n */\nfunction usePermission<Permission extends PermissionResponse, Options extends object>(\n methods: PermissionHookMethods<Permission, Options>,\n options?: PermissionHookOptions<Options>\n): [Permission | null, RequestPermissionMethod<Permission>, GetPermissionMethod<Permission>] {\n const isMounted = useRef(true);\n const [status, setStatus] = useState<Permission | null>(null);\n const { get = true, request = false, ...permissionOptions } = options || {};\n\n const getPermission = useCallback(async () => {\n const response = await methods.getMethod(\n Object.keys(permissionOptions).length > 0 ? (permissionOptions as Options) : undefined\n );\n if (isMounted.current) setStatus(response);\n return response;\n }, [methods.getMethod]);\n\n const requestPermission = useCallback(async () => {\n const response = await methods.requestMethod(\n Object.keys(permissionOptions).length > 0 ? (permissionOptions as Options) : undefined\n );\n if (isMounted.current) setStatus(response);\n return response;\n }, [methods.requestMethod]);\n\n useEffect(\n function runMethods() {\n if (request) requestPermission();\n if (!request && get) getPermission();\n },\n [get, request, requestPermission, getPermission]\n );\n\n // Workaround for unmounting components receiving state updates\n useEffect(function didMount() {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n return [status, requestPermission, getPermission];\n}\n\n/**\n * Create a new permission hook with the permission methods built-in.\n * This can be used to quickly create specific permission hooks in every module.\n */\nexport function createPermissionHook<Permission extends PermissionResponse, Options extends object>(\n methods: PermissionHookMethods<Permission, Options>\n) {\n return (options?: PermissionHookOptions<Options>) =>\n usePermission<Permission, Options>(methods, options);\n}\n"]}
|
package/build/Refs.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Create a React ref object that is friendly for snapshots.
|
|
4
|
+
* It will be represented as `[React.ref]` in snapshots.
|
|
5
|
+
* @returns a React ref object.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createSnapshotFriendlyRef<T>(): React.RefObject<T>;
|
|
8
|
+
//# sourceMappingURL=Refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Refs.d.ts","sourceRoot":"","sources":["../src/Refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAEjE"}
|
package/build/Refs.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Create a React ref object that is friendly for snapshots.
|
|
4
|
+
* It will be represented as `[React.ref]` in snapshots.
|
|
5
|
+
* @returns a React ref object.
|
|
6
|
+
*/
|
|
7
|
+
export function createSnapshotFriendlyRef() {
|
|
8
|
+
return React.createRef();
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Refs.js","sourceRoot":"","sources":["../src/Refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,KAAK,CAAC,SAAS,EAAK,CAAC;AAC9B,CAAC","sourcesContent":["import React from 'react';\n\n/**\n * Create a React ref object that is friendly for snapshots.\n * It will be represented as `[React.ref]` in snapshots.\n * @returns a React ref object.\n */\nexport function createSnapshotFriendlyRef<T>(): React.RefObject<T> {\n return React.createRef<T>();\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedObject.d.ts","sourceRoot":"","sources":["../src/SharedObject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;;AAInE,wBAAmE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedObject.js","sourceRoot":"","sources":["../src/SharedObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAGpF,+BAA+B,EAAE,CAAC;AAElC,eAAe,UAAU,CAAC,IAAI,CAAC,YAAmC,CAAC","sourcesContent":["import { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';\nimport type { SharedObject } from './ts-declarations/SharedObject';\n\nensureNativeModulesAreInstalled();\n\nexport default globalThis.expo.SharedObject as typeof SharedObject;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createWebModule.d.ts","sourceRoot":"","sources":["../src/createWebModule.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,UAAU,GAAG,GAAG,EAAE,oBAAoB,EAAE,UAAU,GAAG,UAAU,CAE9F"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// It is a no-op function that returns the module implementation without importing CoreModule.
|
|
2
|
+
// Actual implementation is located in `createWebModule.web.ts`.
|
|
3
|
+
export function createWebModule(moduleImplementation) {
|
|
4
|
+
return moduleImplementation;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=createWebModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createWebModule.js","sourceRoot":"","sources":["../src/createWebModule.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,gEAAgE;AAChE,MAAM,UAAU,eAAe,CAAmB,oBAAgC;IAChF,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["// It is a no-op function that returns the module implementation without importing CoreModule.\n// Actual implementation is located in `createWebModule.web.ts`.\nexport function createWebModule<ModuleType = any>(moduleImplementation: ModuleType): ModuleType {\n return moduleImplementation;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createWebModule.web.d.ts","sourceRoot":"","sources":["../src/createWebModule.web.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,UAAU,GAAG,GAAG,EAAE,oBAAoB,EAAE,UAAU,GAAG,UAAU,CAG9F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createWebModule.web.js","sourceRoot":"","sources":["../src/createWebModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,UAAU,eAAe,CAAmB,oBAAgC;IAChF,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { NativeModule } from './web/CoreModule';\n\nexport function createWebModule<ModuleType = any>(moduleImplementation: ModuleType): ModuleType {\n const module = new NativeModule();\n return Object.assign(module, moduleImplementation);\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures that the native modules are installed in the current runtime.
|
|
3
|
+
* Otherwise, it synchronously calls a native function that installs them.
|
|
4
|
+
*/
|
|
5
|
+
export declare function ensureNativeModulesAreInstalled(): void;
|
|
6
|
+
//# sourceMappingURL=ensureNativeModulesAreInstalled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureNativeModulesAreInstalled.d.ts","sourceRoot":"","sources":["../src/ensureNativeModulesAreInstalled.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CAiBtD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Ensures that the native modules are installed in the current runtime.
|
|
4
|
+
* Otherwise, it synchronously calls a native function that installs them.
|
|
5
|
+
*/
|
|
6
|
+
export function ensureNativeModulesAreInstalled() {
|
|
7
|
+
if (globalThis.expo) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
if (Platform.OS === 'web') {
|
|
12
|
+
// Requiring web folder sets up the `globalThis.expo` object.
|
|
13
|
+
require('./web');
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
// TODO: ExpoModulesCore shouldn't be optional here,
|
|
17
|
+
// but to keep backwards compatibility let's just ignore it in SDK 50.
|
|
18
|
+
// In most cases the modules were already installed from the native side.
|
|
19
|
+
NativeModules.ExpoModulesCore?.installModules();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error(`Unable to install Expo modules: ${error}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ensureNativeModulesAreInstalled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureNativeModulesAreInstalled.js","sourceRoot":"","sources":["../src/ensureNativeModulesAreInstalled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,+BAA+B;IAC7C,IAAI,UAAU,CAAC,IAAI,EAAE;QACnB,OAAO;KACR;IACD,IAAI;QACF,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;YACzB,6DAA6D;YAC7D,OAAO,CAAC,OAAO,CAAC,CAAC;SAClB;aAAM;YACL,oDAAoD;YACpD,sEAAsE;YACtE,yEAAyE;YACzE,aAAa,CAAC,eAAe,EAAE,cAAc,EAAE,CAAC;SACjD;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC;KAC3D;AACH,CAAC","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\n/**\n * Ensures that the native modules are installed in the current runtime.\n * Otherwise, it synchronously calls a native function that installs them.\n */\nexport function ensureNativeModulesAreInstalled(): void {\n if (globalThis.expo) {\n return;\n }\n try {\n if (Platform.OS === 'web') {\n // Requiring web folder sets up the `globalThis.expo` object.\n require('./web');\n } else {\n // TODO: ExpoModulesCore shouldn't be optional here,\n // but to keep backwards compatibility let's just ignore it in SDK 50.\n // In most cases the modules were already installed from the native side.\n NativeModules.ExpoModulesCore?.installModules();\n }\n } catch (error) {\n console.error(`Unable to install Expo modules: ${error}`);\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DependencyList } from 'react';
|
|
2
|
+
import type { SharedObject } from '../ts-declarations/SharedObject';
|
|
3
|
+
/**
|
|
4
|
+
* Returns a shared object, which is automatically cleaned up when the component is unmounted.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useReleasingSharedObject<TSharedObject extends SharedObject>(factory: () => TSharedObject, dependencies: DependencyList): TSharedObject;
|
|
7
|
+
//# sourceMappingURL=useReleasingSharedObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReleasingSharedObject.d.ts","sourceRoot":"","sources":["../../src/hooks/useReleasingSharedObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8B,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,SAAS,YAAY,EACzE,OAAO,EAAE,MAAM,aAAa,EAC5B,YAAY,EAAE,cAAc,GAC3B,aAAa,CAwCf"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useRef, useMemo, useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a shared object, which is automatically cleaned up when the component is unmounted.
|
|
4
|
+
*/
|
|
5
|
+
export function useReleasingSharedObject(factory, dependencies) {
|
|
6
|
+
const objectRef = useRef(null);
|
|
7
|
+
const isFastRefresh = useRef(false);
|
|
8
|
+
const previousDependencies = useRef(dependencies);
|
|
9
|
+
if (objectRef.current == null) {
|
|
10
|
+
objectRef.current = factory();
|
|
11
|
+
}
|
|
12
|
+
const object = useMemo(() => {
|
|
13
|
+
let newObject = objectRef.current;
|
|
14
|
+
const dependenciesAreEqual = previousDependencies.current?.length === dependencies.length &&
|
|
15
|
+
dependencies.every((value, index) => value === previousDependencies.current[index]);
|
|
16
|
+
// If the dependencies have changed, release the previous object and create a new one, otherwise this has been called
|
|
17
|
+
// because of a fast refresh, and we don't want to release the object.
|
|
18
|
+
if (!newObject || !dependenciesAreEqual) {
|
|
19
|
+
objectRef.current?.release();
|
|
20
|
+
newObject = factory();
|
|
21
|
+
objectRef.current = newObject;
|
|
22
|
+
previousDependencies.current = dependencies;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
isFastRefresh.current = true;
|
|
26
|
+
}
|
|
27
|
+
return newObject;
|
|
28
|
+
}, dependencies);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
isFastRefresh.current = false;
|
|
31
|
+
return () => {
|
|
32
|
+
// This will be called on every fast refresh and on unmount, but we only want to release the object on unmount.
|
|
33
|
+
if (!isFastRefresh.current && objectRef.current) {
|
|
34
|
+
objectRef.current.release();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
return object;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=useReleasingSharedObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReleasingSharedObject.js","sourceRoot":"","sources":["../../src/hooks/useReleasingSharedObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB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IAAI,SAAS,CAAC,OAAO,EAAE;gBAC/C,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;aAC7B;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { DependencyList, useRef, useMemo, useEffect } from 'react';\n\nimport type { SharedObject } from '../ts-declarations/SharedObject';\n\n/**\n * Returns a shared object, which is automatically cleaned up when the component is unmounted.\n */\nexport function useReleasingSharedObject<TSharedObject extends SharedObject>(\n factory: () => TSharedObject,\n dependencies: DependencyList\n): TSharedObject {\n const objectRef = useRef<TSharedObject | null>(null);\n const isFastRefresh = useRef(false);\n const previousDependencies = useRef<DependencyList>(dependencies);\n\n if (objectRef.current == null) {\n objectRef.current = factory();\n }\n\n const object = useMemo(() => {\n let newObject = objectRef.current;\n const dependenciesAreEqual =\n previousDependencies.current?.length === dependencies.length &&\n dependencies.every((value, index) => value === previousDependencies.current[index]);\n\n // If the dependencies have changed, release the previous object and create a new one, otherwise this has been called\n // because of a fast refresh, and we don't want to release the object.\n if (!newObject || !dependenciesAreEqual) {\n objectRef.current?.release();\n newObject = factory();\n objectRef.current = newObject;\n previousDependencies.current = dependencies;\n } else {\n isFastRefresh.current = true;\n }\n return newObject;\n }, dependencies);\n\n useEffect(() => {\n isFastRefresh.current = false;\n\n return () => {\n // This will be called on every fast refresh and on unmount, but we only want to release the object on unmount.\n if (!isFastRefresh.current && objectRef.current) {\n objectRef.current.release();\n }\n };\n }, []);\n\n return object;\n}\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { DeviceEventEmitter } from 'react-native';
|
|
2
2
|
import { EventEmitter, Subscription } from './EventEmitter';
|
|
3
|
+
import NativeModule from './NativeModule';
|
|
3
4
|
import NativeModulesProxy from './NativeModulesProxy';
|
|
4
5
|
import { ProxyNativeModule } from './NativeModulesProxy.types';
|
|
5
6
|
import { requireNativeViewManager } from './NativeViewManagerAdapter';
|
|
6
7
|
import Platform from './Platform';
|
|
8
|
+
import SharedObject from './SharedObject';
|
|
7
9
|
import { CodedError } from './errors/CodedError';
|
|
8
10
|
import { UnavailabilityError } from './errors/UnavailabilityError';
|
|
9
11
|
import './sweet/setUpErrorManager.fx';
|
|
12
|
+
import './web/index';
|
|
13
|
+
export type * from './ts-declarations/global';
|
|
10
14
|
export { default as uuid } from './uuid';
|
|
11
|
-
export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, ProxyNativeModule, Platform, Subscription, requireNativeViewManager, CodedError, UnavailabilityError, };
|
|
15
|
+
export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, ProxyNativeModule, Platform, Subscription, requireNativeViewManager, SharedObject, NativeModule, CodedError, UnavailabilityError, };
|
|
12
16
|
export * from './requireNativeModule';
|
|
17
|
+
export * from './createWebModule';
|
|
13
18
|
export * from './TypedArrays.types';
|
|
14
19
|
/**
|
|
15
20
|
* @deprecated renamed to `DeviceEventEmitter`
|
|
@@ -17,4 +22,6 @@ export * from './TypedArrays.types';
|
|
|
17
22
|
export declare const SyntheticPlatformEmitter: import("react-native").DeviceEventEmitterStatic;
|
|
18
23
|
export * from './PermissionsInterface';
|
|
19
24
|
export * from './PermissionsHook';
|
|
25
|
+
export * from './Refs';
|
|
26
|
+
export * from './hooks/useReleasingSharedObject';
|
|
20
27
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,E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c,mBAAmB,CAAC;AAElC,cAAc,QAAQ,CAAC;AAEvB,cAAc,kCAAkC,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { DeviceEventEmitter } from 'react-native';
|
|
2
2
|
import { EventEmitter } from './EventEmitter';
|
|
3
|
+
import NativeModule from './NativeModule';
|
|
3
4
|
import NativeModulesProxy from './NativeModulesProxy';
|
|
4
5
|
import { requireNativeViewManager } from './NativeViewManagerAdapter';
|
|
5
6
|
import Platform from './Platform';
|
|
7
|
+
import SharedObject from './SharedObject';
|
|
6
8
|
import { CodedError } from './errors/CodedError';
|
|
7
9
|
import { UnavailabilityError } from './errors/UnavailabilityError';
|
|
8
10
|
import './sweet/setUpErrorManager.fx';
|
|
11
|
+
import './web/index';
|
|
9
12
|
export { default as uuid } from './uuid';
|
|
10
13
|
export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, Platform, requireNativeViewManager,
|
|
14
|
+
// Globals
|
|
15
|
+
SharedObject, NativeModule,
|
|
11
16
|
// Errors
|
|
12
17
|
CodedError, UnavailabilityError, };
|
|
13
18
|
export * from './requireNativeModule';
|
|
19
|
+
export * from './createWebModule';
|
|
14
20
|
export * from './TypedArrays.types';
|
|
15
21
|
/**
|
|
16
22
|
* @deprecated renamed to `DeviceEventEmitter`
|
|
@@ -18,4 +24,6 @@ export * from './TypedArrays.types';
|
|
|
18
24
|
export const SyntheticPlatformEmitter = DeviceEventEmitter;
|
|
19
25
|
export * from './PermissionsInterface';
|
|
20
26
|
export * from './PermissionsHook';
|
|
27
|
+
export * from './Refs';
|
|
28
|
+
export * from './hooks/useReleasingSharedObject';
|
|
21
29
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAA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,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAElC,cAAc,QAAQ,CAAC;AAEvB,cAAc,kCAAkC,CAAC","sourcesContent":["import { DeviceEventEmitter } from 'react-native';\n\nimport { EventEmitter, Subscription } from './EventEmitter';\nimport NativeModule from './NativeModule';\nimport NativeModulesProxy from './NativeModulesProxy';\nimport { ProxyNativeModule } from './NativeModulesProxy.types';\nimport { requireNativeViewManager } from './NativeViewManagerAdapter';\nimport Platform from './Platform';\nimport SharedObject from './SharedObject';\nimport { CodedError } from './errors/CodedError';\nimport { UnavailabilityError } from './errors/UnavailabilityError';\n\nimport './sweet/setUpErrorManager.fx';\nimport './web/index';\n\nexport type * from './ts-declarations/global';\n\nexport { default as uuid } from './uuid';\n\nexport {\n DeviceEventEmitter,\n EventEmitter,\n NativeModulesProxy,\n ProxyNativeModule,\n Platform,\n Subscription,\n requireNativeViewManager,\n // Globals\n SharedObject,\n NativeModule,\n // Errors\n CodedError,\n UnavailabilityError,\n};\n\nexport * from './requireNativeModule';\nexport * from './createWebModule';\nexport * from './TypedArrays.types';\n\n/**\n * @deprecated renamed to `DeviceEventEmitter`\n */\nexport const SyntheticPlatformEmitter = DeviceEventEmitter;\n\nexport * from './PermissionsInterface';\nexport * from './PermissionsHook';\n\nexport * from './Refs';\n\nexport * from './hooks/useReleasingSharedObject';\n"]}
|