expo-modules-core 0.6.4 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +1 -1
  3. package/android/ExpoModulesCorePlugin.gradle +15 -0
  4. package/android/build.gradle +46 -32
  5. package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +5 -5
  6. package/android/src/main/java/expo/modules/adapters/react/services/UIManagerModuleWrapper.java +13 -0
  7. package/android/src/main/java/expo/modules/core/ViewManager.java +9 -0
  8. package/android/src/main/java/expo/modules/core/interfaces/JavaScriptContextProvider.java +4 -0
  9. package/android/src/main/java/expo/modules/core/interfaces/ReactActivityHandler.java +37 -1
  10. package/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +19 -0
  11. package/android/src/main/java/expo/modules/core/interfaces/services/UIManager.java +2 -0
  12. package/android/src/main/java/expo/modules/kotlin/AppContext.kt +23 -5
  13. package/android/src/main/java/expo/modules/kotlin/DynamicExtenstions.kt +5 -3
  14. package/android/src/main/java/expo/modules/kotlin/KPromiseWrapper.kt +3 -8
  15. package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +24 -9
  16. package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +12 -7
  17. package/android/src/main/java/expo/modules/kotlin/ModuleRegistry.kt +23 -1
  18. package/android/src/main/java/expo/modules/kotlin/Promise.kt +1 -1
  19. package/android/src/main/java/expo/modules/kotlin/callbacks/Callback.kt +5 -0
  20. package/android/src/main/java/expo/modules/kotlin/callbacks/ViewCallback.kt +39 -0
  21. package/android/src/main/java/expo/modules/kotlin/callbacks/ViewCallbackDelegate.kt +27 -0
  22. package/android/src/main/java/expo/modules/kotlin/defaultmodules/ErrorManagerModule.kt +25 -0
  23. package/android/src/main/java/expo/modules/kotlin/events/EventEmitter.kt +13 -0
  24. package/android/src/main/java/expo/modules/kotlin/events/KModuleEventEmitterWrapper.kt +102 -0
  25. package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +93 -9
  26. package/android/src/main/java/expo/modules/kotlin/exception/ExceptionDecorator.kt +11 -0
  27. package/android/src/main/java/expo/modules/kotlin/{methods/AnyMethod.kt → functions/AnyFunction.kt} +18 -18
  28. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunction.kt +15 -0
  29. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +61 -0
  30. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionWithPromise.kt +15 -0
  31. package/android/src/main/java/expo/modules/kotlin/functions/AsyncSuspendFunction.kt +36 -0
  32. package/android/src/main/java/expo/modules/kotlin/modules/DefinitionMarker.kt +4 -0
  33. package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +17 -2
  34. package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +219 -30
  35. package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionData.kt +2 -2
  36. package/android/src/main/java/expo/modules/kotlin/records/FieldValidator.kt +139 -0
  37. package/android/src/main/java/expo/modules/kotlin/records/RecordTypeConverter.kt +71 -15
  38. package/android/src/main/java/expo/modules/kotlin/records/Required.kt +5 -0
  39. package/android/src/main/java/expo/modules/kotlin/records/ValidationBinder.kt +110 -0
  40. package/android/src/main/java/expo/modules/kotlin/records/Validators.kt +61 -0
  41. package/android/src/main/java/expo/modules/kotlin/types/ArrayTypeConverter.kt +11 -5
  42. package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverter.kt +35 -0
  43. package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverterHelper.kt +148 -0
  44. package/android/src/main/java/expo/modules/kotlin/types/ListTypeConverter.kt +10 -4
  45. package/android/src/main/java/expo/modules/kotlin/types/MapTypeConverter.kt +12 -6
  46. package/android/src/main/java/expo/modules/kotlin/types/PairTypeConverter.kt +29 -13
  47. package/android/src/main/java/expo/modules/kotlin/types/TypeConverter.kt +2 -1
  48. package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +9 -1
  49. package/android/src/main/java/expo/modules/kotlin/views/CallbacksDefinition.kt +3 -0
  50. package/android/src/main/java/expo/modules/kotlin/views/GroupViewManagerWrapper.kt +71 -0
  51. package/android/src/main/java/expo/modules/kotlin/views/SimpleViewManagerWrapper.kt +22 -0
  52. package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinition.kt +18 -0
  53. package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinitionBuilder.kt +64 -0
  54. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinition.kt +30 -2
  55. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +42 -1
  56. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerWrapperDelegate.kt +62 -2
  57. package/build/EventEmitter.d.ts +1 -0
  58. package/build/EventEmitter.d.ts.map +1 -0
  59. package/build/NativeModulesProxy.d.ts +1 -0
  60. package/build/NativeModulesProxy.d.ts.map +1 -0
  61. package/build/NativeModulesProxy.native.d.ts +1 -4
  62. package/build/NativeModulesProxy.native.d.ts.map +1 -0
  63. package/build/NativeModulesProxy.native.js +1 -14
  64. package/build/NativeModulesProxy.native.js.map +1 -1
  65. package/build/NativeModulesProxy.types.d.ts +1 -3
  66. package/build/NativeModulesProxy.types.d.ts.map +1 -0
  67. package/build/NativeModulesProxy.types.js.map +1 -1
  68. package/build/NativeViewManagerAdapter.d.ts +1 -0
  69. package/build/NativeViewManagerAdapter.d.ts.map +1 -0
  70. package/build/NativeViewManagerAdapter.native.d.ts +1 -0
  71. package/build/NativeViewManagerAdapter.native.d.ts.map +1 -0
  72. package/build/NativeViewManagerAdapter.native.js +9 -33
  73. package/build/NativeViewManagerAdapter.native.js.map +1 -1
  74. package/build/PermissionsHook.d.ts +1 -0
  75. package/build/PermissionsHook.d.ts.map +1 -0
  76. package/build/PermissionsInterface.d.ts +1 -0
  77. package/build/PermissionsInterface.d.ts.map +1 -0
  78. package/build/Platform.d.ts +1 -0
  79. package/build/Platform.d.ts.map +1 -0
  80. package/build/SyntheticPlatformEmitter.d.ts +1 -0
  81. package/build/SyntheticPlatformEmitter.d.ts.map +1 -0
  82. package/build/SyntheticPlatformEmitter.web.d.ts +1 -0
  83. package/build/SyntheticPlatformEmitter.web.d.ts.map +1 -0
  84. package/build/deprecate.d.ts +1 -0
  85. package/build/deprecate.d.ts.map +1 -0
  86. package/build/environment/browser.d.ts +1 -0
  87. package/build/environment/browser.d.ts.map +1 -0
  88. package/build/environment/browser.web.d.ts +1 -0
  89. package/build/environment/browser.web.d.ts.map +1 -0
  90. package/build/errors/CodedError.d.ts +1 -0
  91. package/build/errors/CodedError.d.ts.map +1 -0
  92. package/build/errors/UnavailabilityError.d.ts +1 -0
  93. package/build/errors/UnavailabilityError.d.ts.map +1 -0
  94. package/build/index.d.ts +3 -0
  95. package/build/index.d.ts.map +1 -0
  96. package/build/index.js +2 -0
  97. package/build/index.js.map +1 -1
  98. package/build/requireNativeModule.d.ts +16 -0
  99. package/build/requireNativeModule.d.ts.map +1 -0
  100. package/build/requireNativeModule.js +18 -0
  101. package/build/requireNativeModule.js.map +1 -0
  102. package/build/sweet/NativeErrorManager.d.ts +3 -0
  103. package/build/sweet/NativeErrorManager.d.ts.map +1 -0
  104. package/build/sweet/NativeErrorManager.js +3 -0
  105. package/build/sweet/NativeErrorManager.js.map +1 -0
  106. package/build/sweet/setUpErrorManager.fx.d.ts +2 -0
  107. package/build/sweet/setUpErrorManager.fx.d.ts.map +1 -0
  108. package/build/sweet/setUpErrorManager.fx.js +11 -0
  109. package/build/sweet/setUpErrorManager.fx.js.map +1 -0
  110. package/ios/AppDelegates/EXAppDelegatesLoader.m +4 -8
  111. package/ios/AppDelegates/ExpoAppDelegate.swift +22 -20
  112. package/ios/EXAppDefines.h +1 -0
  113. package/ios/EXAppDefines.m +6 -0
  114. package/ios/EXUtilities.h +2 -0
  115. package/ios/EXUtilities.m +12 -0
  116. package/ios/ExpoModulesCore.h +4 -0
  117. package/ios/ExpoModulesCore.podspec +4 -2
  118. package/ios/Interfaces/FileSystem/EXFileSystemInterface.h +1 -1
  119. package/ios/Interfaces/TaskManager/EXTaskServiceInterface.h +1 -0
  120. package/ios/JSI/{JSIConversions.h → EXJSIConversions.h} +5 -0
  121. package/ios/JSI/{JSIConversions.mm → EXJSIConversions.mm} +21 -1
  122. package/ios/JSI/{JSIInstaller.h → EXJSIInstaller.h} +10 -0
  123. package/ios/JSI/EXJSIInstaller.mm +17 -0
  124. package/ios/JSI/EXJSIUtils.h +19 -0
  125. package/ios/JSI/EXJSIUtils.mm +89 -0
  126. package/ios/JSI/EXJavaScriptObject.h +97 -0
  127. package/ios/JSI/EXJavaScriptObject.mm +121 -0
  128. package/ios/JSI/EXJavaScriptRuntime.h +73 -0
  129. package/ios/JSI/EXJavaScriptRuntime.mm +153 -0
  130. package/ios/JSI/EXJavaScriptValue.h +57 -0
  131. package/ios/JSI/EXJavaScriptValue.mm +166 -0
  132. package/ios/JSI/ExpoModulesHostObject.h +33 -0
  133. package/ios/JSI/ExpoModulesHostObject.mm +41 -0
  134. package/ios/JSI/JavaScriptRuntime.swift +32 -0
  135. package/ios/JSI/JavaScriptValue.swift +94 -0
  136. package/ios/ModuleRegistryAdapter/EXModuleRegistryAdapter.m +3 -23
  137. package/ios/NativeModulesProxy/EXNativeModulesProxy.h +2 -2
  138. package/ios/NativeModulesProxy/EXNativeModulesProxy.mm +101 -75
  139. package/ios/RCTComponentData+Privates.h +12 -0
  140. package/ios/ReactDelegates/EXReactCompatibleHelpers.h +18 -0
  141. package/ios/ReactDelegates/EXReactCompatibleHelpers.m +19 -0
  142. package/ios/ReactDelegates/ExpoReactDelegate.swift +3 -3
  143. package/ios/ReactDelegates/ExpoReactDelegateHandler.swift +4 -4
  144. package/ios/ReactDelegates/ModulePriorities.swift +1 -1
  145. package/ios/Swift/AppContext.swift +64 -4
  146. package/ios/Swift/Arguments/ArgumentType.swift +4 -0
  147. package/ios/Swift/Arguments/Convertibles.swift +13 -13
  148. package/ios/Swift/Arguments/Types/EnumArgumentType.swift +11 -17
  149. package/ios/Swift/Arguments/Types/PromiseArgumentType.swift +1 -1
  150. package/ios/Swift/Arguments/Types/RawArgumentType.swift +2 -2
  151. package/ios/Swift/Conversions.swift +51 -56
  152. package/ios/Swift/EventListener.swift +8 -10
  153. package/ios/Swift/Events/Callback.swift +66 -0
  154. package/ios/Swift/Events/Event.swift +43 -0
  155. package/ios/Swift/Exceptions/ChainableException.swift +51 -0
  156. package/ios/Swift/{CodedError.swift → Exceptions/CodedError.swift} +1 -12
  157. package/ios/Swift/Exceptions/Exception.swift +62 -0
  158. package/ios/Swift/Exceptions/ExceptionOrigin.swift +28 -0
  159. package/ios/Swift/Exceptions/GenericException.swift +20 -0
  160. package/ios/Swift/Exceptions/UnexpectedException.swift +16 -0
  161. package/ios/Swift/Functions/AnyFunction.swift +11 -1
  162. package/ios/Swift/Functions/AsyncFunction.swift +17 -0
  163. package/ios/Swift/Functions/ConcreteFunction.swift +43 -17
  164. package/ios/Swift/JavaScriptUtils.swift +54 -0
  165. package/ios/Swift/ModuleHolder.swift +66 -16
  166. package/ios/Swift/ModuleRegistry.swift +4 -1
  167. package/ios/Swift/Modules/AnyModule.swift +0 -1
  168. package/ios/Swift/Modules/ModuleDefinition.swift +4 -13
  169. package/ios/Swift/Modules/ModuleDefinitionBuilder.swift +0 -1
  170. package/ios/Swift/Modules/ModuleDefinitionComponents.swift +0 -188
  171. package/ios/Swift/ModulesProvider.swift +3 -11
  172. package/ios/Swift/Objects/ObjectDefinition.swift +30 -0
  173. package/ios/Swift/Objects/ObjectDefinitionComponents.swift +384 -0
  174. package/ios/Swift/Promise.swift +8 -3
  175. package/ios/Swift/Records/AnyField.swift +7 -0
  176. package/ios/Swift/Records/Field.swift +24 -19
  177. package/ios/Swift/Records/FieldOption.swift +1 -1
  178. package/ios/Swift/Records/Record.swift +12 -4
  179. package/ios/Swift/SwiftInteropBridge.swift +53 -15
  180. package/ios/Swift/Views/AnyViewProp.swift +1 -1
  181. package/ios/Swift/Views/ComponentData.swift +96 -0
  182. package/ios/Swift/Views/ConcreteViewProp.swift +6 -8
  183. package/ios/Swift/Views/ExpoView.swift +8 -0
  184. package/ios/Swift/Views/ViewFactory.swift +1 -1
  185. package/ios/Swift/Views/ViewManagerDefinition.swift +23 -2
  186. package/ios/Swift/Views/ViewManagerDefinitionBuilder.swift +0 -1
  187. package/ios/Swift/Views/ViewManagerDefinitionComponents.swift +26 -0
  188. package/ios/Swift/Views/ViewModuleWrapper.swift +5 -2
  189. package/ios/Swift.h +5 -0
  190. package/ios/Tests/ArgumentTypeSpec.swift +5 -7
  191. package/ios/Tests/ConstantsSpec.swift +6 -7
  192. package/ios/Tests/ConvertiblesSpec.swift +35 -36
  193. package/ios/Tests/ExceptionsSpec.swift +111 -0
  194. package/ios/Tests/ExpoModulesSpec.swift +76 -0
  195. package/ios/Tests/FunctionSpec.swift +22 -25
  196. package/ios/Tests/FunctionWithConvertiblesSpec.swift +4 -5
  197. package/ios/Tests/JavaScriptObjectSpec.swift +97 -0
  198. package/ios/Tests/JavaScriptRuntimeSpec.swift +94 -0
  199. package/ios/Tests/Mocks/ModuleMocks.swift +1 -1
  200. package/ios/Tests/Mocks/ModulesProviderMock.swift +0 -1
  201. package/ios/Tests/ModuleEventListenersSpec.swift +3 -4
  202. package/ios/Tests/ModuleRegistrySpec.swift +2 -3
  203. package/ios/Tests/RecordSpec.swift +9 -20
  204. package/package.json +3 -3
  205. package/src/NativeModulesProxy.native.ts +2 -22
  206. package/src/NativeModulesProxy.types.ts +0 -8
  207. package/src/NativeViewManagerAdapter.native.tsx +12 -28
  208. package/src/index.ts +4 -0
  209. package/src/requireNativeModule.ts +29 -0
  210. package/src/sweet/NativeErrorManager.ts +2 -0
  211. package/src/sweet/setUpErrorManager.fx.ts +12 -0
  212. package/android/src/main/java/expo/modules/kotlin/events/KEventEmitterWrapper.kt +0 -26
  213. package/android/src/main/java/expo/modules/kotlin/methods/Method.kt +0 -14
  214. package/android/src/main/java/expo/modules/kotlin/methods/PromiseMethod.kt +0 -15
  215. package/ios/JSI/ExpoModulesProxySpec.h +0 -24
  216. package/ios/JSI/ExpoModulesProxySpec.mm +0 -135
  217. package/ios/JSI/JSIInstaller.mm +0 -22
@@ -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,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE/F,gFAAgF;AAChF,0FAA0F;AAC1F,4CAA4C;AAC5C,EAAE;AACF,kGAAkG;AAClG,mGAAmG;AACnG,mGAAmG;AACnG,+DAA+D;AAE/D,kGAAkG;AAClG,+FAA+F;AAC/F,qCAAqC;AACrC,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAMrD;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAU,QAAgB;IAChE,IAAI,OAAO,EAAE;QACX,MAAM,EAAE,oBAAoB,EAAE,GAAG,aAAa,CAAC;QAC/C,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC9D,MAAM,wBAAwB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnF,OAAO,CAAC,IAAI,CACV,6CAA6C,QAAQ,8IAA8I,wBAAwB,IAAI,CAChO,CAAC;SACH;KACF;IAED,+FAA+F;IAC/F,UAAU;IACV,MAAM,mBAAmB,GAAG,sBAAsB,QAAQ,EAAE,CAAC;IAC7D,MAAM,oBAAoB,GACxB,sBAAsB,CAA2B,mBAAmB,CAAC,CAAC;IACxE,MAAM,0BAA0B,GAAG,CAAC,SAAS,CAAC,oBAAoB;QAChE,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,mBAAmB,CAAC;QACrD,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI;QACrC,WAAW,EAAE,EAAE;QACf,gBAAgB,EAAE,EAAE;KACrB,CAAC;IACF,MAAM,6BAA6B,GAAG;QACpC,UAAU;QACV,GAAG,iBAAiB;QACpB,GAAG,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,WAAW,CAAC;QACtD,GAAG,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,gBAAgB,CAAC;KAC5D,CAAC;IAEF,sFAAsF;IACtF,SAAS,sBAAsB,CAAC,KAAK,EAAE,GAAG;QACxC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE,6BAA6B,CAAC,CAAC;QAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,6BAA6B,CAAC,CAAC;QAChE,OAAO,oBAAC,oBAAoB,OAAK,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;IAC9F,CAAC;IACD,sBAAsB,CAAC,WAAW,GAAG,WAAW,QAAQ,GAAG,CAAC;IAC5D,OAAO,KAAK,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,IAAI,CAAC,KAA0B,EAAE,SAAmB;IAC3D,MAAM,MAAM,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAC5B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;QAChC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;KACzB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,IAAI,CAAC,KAA0B,EAAE,SAAmB;IAC3D,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACrC,IAAI,IAAI,IAAI,KAAK,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;SAC1B;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC","sourcesContent":["import React from 'react';\nimport { NativeModules, UIManager, ViewPropTypes, requireNativeComponent } from 'react-native';\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// NOTE: React Native is moving away from runtime PropTypes and may remove ViewPropTypes, in which\n// case we will need another way to separate standard React Native view props from other props,\n// which we proxy through the adapter\nconst ViewPropTypesKeys = Object.keys(ViewPropTypes);\n\ntype NativeExpoComponentProps = {\n proxiedProperties: object;\n};\n\n/**\n * A drop-in replacement for `requireNativeComponent`.\n */\nexport function requireNativeViewManager<P = any>(viewName: string): React.ComponentType<P> {\n if (__DEV__) {\n const { NativeUnimoduleProxy } = NativeModules;\n if (!NativeUnimoduleProxy.viewManagersNames.includes(viewName)) {\n const exportedViewManagerNames = NativeUnimoduleProxy.viewManagersNames.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\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 =\n requireNativeComponent<NativeExpoComponentProps>(reactNativeViewName);\n const reactNativeUIConfiguration = (UIManager.getViewManagerConfig\n ? UIManager.getViewManagerConfig(reactNativeViewName)\n : UIManager[reactNativeViewName]) || {\n NativeProps: {},\n directEventTypes: {},\n };\n const reactNativeComponentPropNames = [\n 'children',\n ...ViewPropTypesKeys,\n ...Object.keys(reactNativeUIConfiguration.NativeProps),\n ...Object.keys(reactNativeUIConfiguration.directEventTypes),\n ];\n\n // Define a component for universal-module authors to access their native view manager\n function NativeComponentAdapter(props, ref) {\n const nativeProps = pick(props, reactNativeComponentPropNames);\n const proxiedProps = omit(props, reactNativeComponentPropNames);\n return <ReactNativeComponent {...nativeProps} proxiedProperties={proxiedProps} ref={ref} />;\n }\n NativeComponentAdapter.displayName = `Adapter<${viewName}>`;\n return React.forwardRef(NativeComponentAdapter);\n}\n\nfunction omit(props: Record<string, any>, propNames: string[]) {\n const copied = { ...props };\n for (const propName of propNames) {\n delete copied[propName];\n }\n return copied;\n}\n\nfunction pick(props: Record<string, any>, propNames: string[]) {\n return propNames.reduce((prev, curr) => {\n if (curr in props) {\n prev[curr] = props[curr];\n }\n return prev;\n }, {});\n}\n"]}
1
+ {"version":3,"file":"NativeViewManagerAdapter.native.js","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAerE;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAU,QAAgB;IAChE,MAAM,EAAE,oBAAoB,EAAE,GAAG,aAAa,CAAC,oBAAoB,CAAC;IACpE,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC,QAAQ,CAAC,CAAC;IAE3D,IAAI,OAAO,IAAI,CAAC,iBAAiB,EAAE;QACjC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9E,OAAO,CAAC,IAAI,CACV,6CAA6C,QAAQ,8IAA8I,wBAAwB,IAAI,CAChO,CAAC;KACH;IAED,+FAA+F;IAC/F,UAAU;IACV,MAAM,mBAAmB,GAAG,sBAAsB,QAAQ,EAAE,CAAC;IAC7D,MAAM,oBAAoB,GACxB,sBAAsB,CAA2B,mBAAmB,CAAC,CAAC;IACxE,MAAM,iBAAiB,GAAG,iBAAiB,EAAE,UAAU,IAAI,EAAE,CAAC;IAE9D,sFAAsF;IACtF,SAAS,sBAAsB,CAAC,KAAK,EAAE,GAAG;QACxC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QACnD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QACpD,OAAO,oBAAC,oBAAoB,OAAK,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;IAC9F,CAAC;IACD,sBAAsB,CAAC,WAAW,GAAG,WAAW,QAAQ,GAAG,CAAC;IAC5D,OAAO,KAAK,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,IAAI,CAAC,KAA0B,EAAE,SAAmB;IAC3D,MAAM,MAAM,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAC5B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;QAChC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;KACzB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,IAAI,CAAC,KAA0B,EAAE,SAAmB;IAC3D,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACrC,IAAI,IAAI,IAAI,KAAK,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;SAC1B;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC","sourcesContent":["import React from 'react';\nimport { NativeModules, requireNativeComponent } from 'react-native';\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\ntype NativeExpoComponentProps = {\n proxiedProperties: object;\n};\n\n/**\n * A drop-in replacement for `requireNativeComponent`.\n */\nexport function requireNativeViewManager<P = any>(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 =\n requireNativeComponent<NativeExpoComponentProps>(reactNativeViewName);\n const proxiedPropsNames = viewManagerConfig?.propsNames ?? [];\n\n // Define a component for universal-module authors to access their native view manager\n function NativeComponentAdapter(props, ref) {\n const nativeProps = omit(props, proxiedPropsNames);\n const proxiedProps = pick(props, proxiedPropsNames);\n return <ReactNativeComponent {...nativeProps} proxiedProperties={proxiedProps} ref={ref} />;\n }\n NativeComponentAdapter.displayName = `Adapter<${viewName}>`;\n return React.forwardRef(NativeComponentAdapter);\n}\n\nfunction omit(props: Record<string, any>, propNames: string[]) {\n const copied = { ...props };\n for (const propName of propNames) {\n delete copied[propName];\n }\n return copied;\n}\n\nfunction pick(props: Record<string, any>, propNames: string[]) {\n return propNames.reduce((prev, curr) => {\n if (curr in props) {\n prev[curr] = props[curr];\n }\n return prev;\n }, {});\n}\n"]}
@@ -20,3 +20,4 @@ export declare type PermissionHookOptions<Options extends object> = PermissionHo
20
20
  */
21
21
  export declare function createPermissionHook<Permission extends PermissionResponse, Options extends object>(methods: PermissionHookMethods<Permission, Options>): (options?: PermissionHookOptions<Options> | undefined) => [Permission | null, RequestPermissionMethod<Permission>, GetPermissionMethod<Permission>];
22
22
  export {};
23
+ //# sourceMappingURL=PermissionsHook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PermissionsHook.d.ts","sourceRoot":"","sources":["../src/PermissionsHook.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,aAAK,uBAAuB,CAAC,UAAU,SAAS,kBAAkB,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;AAChG,aAAK,mBAAmB,CAAC,UAAU,SAAS,kBAAkB,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;AAE5F,UAAU,qBAAqB,CAAC,UAAU,SAAS,kBAAkB,EAAE,OAAO,GAAG,KAAK;IACpF,wEAAwE;IACxE,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,6EAA6E;IAC7E,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD;AAED,UAAU,sBAAsB;IAC9B,qGAAqG;IACrG,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,oBAAY,qBAAqB,CAAC,OAAO,SAAS,MAAM,IAAI,sBAAsB,GAAG,OAAO,CAAC;AAkD7F;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,SAAS,kBAAkB,EAAE,OAAO,SAAS,MAAM,EAChG,OAAO,EAAE,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC,uJAIpD"}
@@ -10,3 +10,4 @@ export interface PermissionResponse {
10
10
  granted: boolean;
11
11
  canAskAgain: boolean;
12
12
  }
13
+ //# sourceMappingURL=PermissionsInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PermissionsInterface.d.ts","sourceRoot":"","sources":["../src/PermissionsInterface.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,MAAM,WAAW;CAClB;AAED,oBAAY,oBAAoB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB"}
@@ -42,3 +42,4 @@ declare const Platform: {
42
42
  isAsyncDebugging: boolean;
43
43
  };
44
44
  export default Platform;
45
+ //# sourceMappingURL=Platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../src/Platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,cAAc,EAAE,MAAM,cAAc,CAAC;AAS/E,oBAAY,oBAAoB,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAEtF,oBAAY,cAAc,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE;KAAG,QAAQ,IAAI,oBAAoB,CAAC,CAAC,EAAE,CAAC;CAAE,KAAK,CAAC,CAAC;AAE7F,QAAA,MAAM,QAAQ;IACZ;;;OAGG;;IAEH;;;;;;;OAOG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;CAEJ,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -3,3 +3,4 @@
3
3
  * registered in the API layer with `NativeEventEmitter`.
4
4
  */
5
5
  export { default } from 'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter';
6
+ //# sourceMappingURL=SyntheticPlatformEmitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyntheticPlatformEmitter.d.ts","sourceRoot":"","sources":["../src/SyntheticPlatformEmitter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,2DAA2D,CAAC"}
@@ -3,3 +3,4 @@
3
3
  * registered in the API layer with `NativeEventEmitter`.
4
4
  */
5
5
  export { default } from 'react-native-web/dist/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter';
6
+ //# sourceMappingURL=SyntheticPlatformEmitter.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyntheticPlatformEmitter.web.d.ts","sourceRoot":"","sources":["../src/SyntheticPlatformEmitter.web.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,oFAAoF,CAAC"}
@@ -6,3 +6,4 @@ export default function deprecate(library: string, deprecatedAPI: string, option
6
6
  currentVersion?: string;
7
7
  versionToRemove?: string;
8
8
  }): void;
9
+ //# sourceMappingURL=deprecate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecate.d.ts","sourceRoot":"","sources":["../src/deprecate.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CACrB,GACL,IAAI,CAgCN"}
@@ -2,3 +2,4 @@ export declare const isDOMAvailable = false;
2
2
  export declare const canUseEventListeners = false;
3
3
  export declare const canUseViewport = false;
4
4
  export declare let isAsyncDebugging: boolean;
5
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/environment/browser.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAC1C,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC,eAAO,IAAI,gBAAgB,EAAE,OAAe,CAAC"}
@@ -7,3 +7,4 @@ export declare const isDOMAvailable: boolean;
7
7
  export declare const canUseEventListeners: boolean;
8
8
  export declare const canUseViewport: boolean;
9
9
  export declare const isAsyncDebugging = false;
10
+ //# sourceMappingURL=browser.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.web.d.ts","sourceRoot":"","sources":["../../src/environment/browser.web.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC;KAC9D;CACF;AAID,eAAO,MAAM,cAAc,SAAoE,CAAC;AAChG,eAAO,MAAM,oBAAoB,SACoC,CAAC;AACtE,eAAO,MAAM,cAAc,SAAoC,CAAC;AAChE,eAAO,MAAM,gBAAgB,QAAQ,CAAC"}
@@ -8,3 +8,4 @@ export declare class CodedError extends Error {
8
8
  info?: any;
9
9
  constructor(code: string, message: string);
10
10
  }
11
+ //# sourceMappingURL=CodedError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodedError.d.ts","sourceRoot":"","sources":["../../src/errors/CodedError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC;gBAEC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI1C"}
@@ -7,3 +7,4 @@ import { CodedError } from './CodedError';
7
7
  export declare class UnavailabilityError extends CodedError {
8
8
  constructor(moduleName: string, propertyName: string);
9
9
  }
10
+ //# sourceMappingURL=UnavailabilityError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnavailabilityError.d.ts","sourceRoot":"","sources":["../../src/errors/UnavailabilityError.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;CAMrD"}
package/build/index.d.ts CHANGED
@@ -7,11 +7,14 @@ import Platform from './Platform';
7
7
  import SyntheticPlatformEmitter from './SyntheticPlatformEmitter';
8
8
  import { CodedError } from './errors/CodedError';
9
9
  import { UnavailabilityError } from './errors/UnavailabilityError';
10
+ import './sweet/setUpErrorManager.fx';
10
11
  export { default as deprecate } from './deprecate';
11
12
  export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, ProxyNativeModule, Platform, Subscription, SyntheticPlatformEmitter, requireNativeViewManager, CodedError, UnavailabilityError, };
13
+ export * from './requireNativeModule';
12
14
  /**
13
15
  * @deprecated renamed to `DeviceEventEmitter`
14
16
  */
15
17
  export declare const RCTDeviceEventEmitter: import("react-native").DeviceEventEmitterStatic;
16
18
  export * from './PermissionsInterface';
17
19
  export * from './PermissionsHook';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EAExB,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF,cAAc,uBAAuB,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,qBAAqB,iDAAqB,CAAC;AAExD,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
package/build/index.js CHANGED
@@ -6,10 +6,12 @@ import Platform from './Platform';
6
6
  import SyntheticPlatformEmitter from './SyntheticPlatformEmitter';
7
7
  import { CodedError } from './errors/CodedError';
8
8
  import { UnavailabilityError } from './errors/UnavailabilityError';
9
+ import './sweet/setUpErrorManager.fx';
9
10
  export { default as deprecate } from './deprecate';
10
11
  export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, Platform, SyntheticPlatformEmitter, requireNativeViewManager,
11
12
  // Errors
12
13
  CodedError, UnavailabilityError, };
14
+ export * from './requireNativeModule';
13
15
  /**
14
16
  * @deprecated renamed to `DeviceEventEmitter`
15
17
  */
@@ -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,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAElB,QAAQ,EAER,wBAAwB,EACxB,wBAAwB;AACxB,SAAS;AACT,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC","sourcesContent":["import { DeviceEventEmitter } from 'react-native';\n\nimport { EventEmitter, Subscription } from './EventEmitter';\nimport NativeModulesProxy from './NativeModulesProxy';\nimport { ProxyNativeModule } from './NativeModulesProxy.types';\nimport { requireNativeViewManager } from './NativeViewManagerAdapter';\nimport Platform from './Platform';\nimport SyntheticPlatformEmitter from './SyntheticPlatformEmitter';\nimport { CodedError } from './errors/CodedError';\nimport { UnavailabilityError } from './errors/UnavailabilityError';\n\nexport { default as deprecate } from './deprecate';\n\nexport {\n DeviceEventEmitter,\n EventEmitter,\n NativeModulesProxy,\n ProxyNativeModule,\n Platform,\n Subscription,\n SyntheticPlatformEmitter,\n requireNativeViewManager,\n // Errors\n CodedError,\n UnavailabilityError,\n};\n\n/**\n * @deprecated renamed to `DeviceEventEmitter`\n */\nexport const RCTDeviceEventEmitter = DeviceEventEmitter;\n\nexport * from './PermissionsInterface';\nexport * from './PermissionsHook';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAElB,QAAQ,EAER,wBAAwB,EACxB,wBAAwB;AACxB,SAAS;AACT,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF,cAAc,uBAAuB,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC","sourcesContent":["import { DeviceEventEmitter } from 'react-native';\n\nimport { EventEmitter, Subscription } from './EventEmitter';\nimport NativeModulesProxy from './NativeModulesProxy';\nimport { ProxyNativeModule } from './NativeModulesProxy.types';\nimport { requireNativeViewManager } from './NativeViewManagerAdapter';\nimport Platform from './Platform';\nimport SyntheticPlatformEmitter from './SyntheticPlatformEmitter';\nimport { CodedError } from './errors/CodedError';\nimport { UnavailabilityError } from './errors/UnavailabilityError';\n\nimport './sweet/setUpErrorManager.fx';\n\nexport { default as deprecate } from './deprecate';\n\nexport {\n DeviceEventEmitter,\n EventEmitter,\n NativeModulesProxy,\n ProxyNativeModule,\n Platform,\n Subscription,\n SyntheticPlatformEmitter,\n requireNativeViewManager,\n // Errors\n CodedError,\n UnavailabilityError,\n};\n\nexport * from './requireNativeModule';\n\n/**\n * @deprecated renamed to `DeviceEventEmitter`\n */\nexport const RCTDeviceEventEmitter = DeviceEventEmitter;\n\nexport * from './PermissionsInterface';\nexport * from './PermissionsHook';\n"]}
@@ -0,0 +1,16 @@
1
+ declare global {
2
+ var ExpoModules: undefined | {
3
+ [key: string]: any;
4
+ };
5
+ }
6
+ /**
7
+ * Imports the native module registered with given name. In the first place it tries to load
8
+ * the module installed through the JSI host object and then falls back to the bridge proxy module.
9
+ * Notice that the modules loaded from the proxy may not support some features like synchronous functions.
10
+ *
11
+ * @param moduleName Name of the requested native module.
12
+ * @returns Object representing the native module.
13
+ * @throws Error when there is no native module with given name.
14
+ */
15
+ export declare function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType;
16
+ //# sourceMappingURL=requireNativeModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requireNativeModule.d.ts","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,WAAW,EACX,SAAS,GACT;QACE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACP;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAQpF"}
@@ -0,0 +1,18 @@
1
+ import NativeModulesProxy from './NativeModulesProxy';
2
+ /**
3
+ * Imports the native module registered with given name. In the first place it tries to load
4
+ * the module installed through the JSI host object and then falls back to the bridge proxy module.
5
+ * Notice that the modules loaded from the proxy may not support some features like synchronous functions.
6
+ *
7
+ * @param moduleName Name of the requested native module.
8
+ * @returns Object representing the native module.
9
+ * @throws Error when there is no native module with given name.
10
+ */
11
+ export function requireNativeModule(moduleName) {
12
+ const nativeModule = global.ExpoModules?.[moduleName] ?? NativeModulesProxy[moduleName];
13
+ if (!nativeModule) {
14
+ throw new Error(`Cannot find native module '${moduleName}'`);
15
+ }
16
+ return nativeModule;
17
+ }
18
+ //# sourceMappingURL=requireNativeModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requireNativeModule.js","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAWtD;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAmB,UAAkB;IACtE,MAAM,YAAY,GAChB,MAAM,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAErE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,UAAU,GAAG,CAAC,CAAC;KAC9D;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import NativeModulesProxy from './NativeModulesProxy';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var ExpoModules:\n | undefined\n | {\n [key: string]: any;\n };\n}\n\n/**\n * Imports the native module registered with given name. In the first place it tries to load\n * the module installed through the JSI host object and then falls back to the bridge proxy module.\n * Notice that the modules loaded from the proxy may not support some features like synchronous functions.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module.\n * @throws Error when there is no native module with given name.\n */\nexport function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType {\n const nativeModule: ModuleType =\n global.ExpoModules?.[moduleName] ?? NativeModulesProxy[moduleName];\n\n if (!nativeModule) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n }\n return nativeModule;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("..").ProxyNativeModule;
2
+ export default _default;
3
+ //# sourceMappingURL=NativeErrorManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeErrorManager.d.ts","sourceRoot":"","sources":["../../src/sweet/NativeErrorManager.ts"],"names":[],"mappings":";AACA,wBAA8D"}
@@ -0,0 +1,3 @@
1
+ import NativeModulesProxy from '../NativeModulesProxy';
2
+ export default NativeModulesProxy.ExpoModulesCoreErrorManager;
3
+ //# sourceMappingURL=NativeErrorManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeErrorManager.js","sourceRoot":"","sources":["../../src/sweet/NativeErrorManager.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,eAAe,kBAAkB,CAAC,2BAA2B,CAAC","sourcesContent":["import NativeModulesProxy from '../NativeModulesProxy';\nexport default NativeModulesProxy.ExpoModulesCoreErrorManager;\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=setUpErrorManager.fx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setUpErrorManager.fx.d.ts","sourceRoot":"","sources":["../../src/sweet/setUpErrorManager.fx.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { EventEmitter } from '../EventEmitter';
2
+ import Platform from '../Platform';
3
+ import NativeErrorManager from './NativeErrorManager';
4
+ if (__DEV__ && Platform.OS === 'android' && NativeErrorManager) {
5
+ const onNewException = 'ExpoModulesCoreErrorManager.onNewException';
6
+ const eventEmitter = new EventEmitter(NativeErrorManager);
7
+ eventEmitter.addListener(onNewException, ({ message }) => {
8
+ console.error(message);
9
+ });
10
+ }
11
+ //# sourceMappingURL=setUpErrorManager.fx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setUpErrorManager.fx.js","sourceRoot":"","sources":["../../src/sweet/setUpErrorManager.fx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,IAAI,OAAO,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,kBAAkB,EAAE;IAC9D,MAAM,cAAc,GAAG,4CAA4C,CAAC;IACpE,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAE1D,YAAY,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,EAAE,OAAO,EAAuB,EAAE,EAAE;QAC5E,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;CACJ","sourcesContent":["import { EventEmitter } from '../EventEmitter';\nimport Platform from '../Platform';\nimport NativeErrorManager from './NativeErrorManager';\n\nif (__DEV__ && Platform.OS === 'android' && NativeErrorManager) {\n const onNewException = 'ExpoModulesCoreErrorManager.onNewException';\n const eventEmitter = new EventEmitter(NativeErrorManager);\n\n eventEmitter.addListener(onNewException, ({ message }: { message: string }) => {\n console.error(message);\n });\n}\n"]}
@@ -1,14 +1,10 @@
1
1
  // Copyright 2018-present 650 Industries. All rights reserved.
2
2
 
3
+ #import <ExpoModulesCore/EXLegacyAppDelegateWrapper.h>
4
+
3
5
  #import <ExpoModulesCore/EXAppDelegatesLoader.h>
4
6
  #import <ExpoModulesCore/EXNativeModulesProxy.h>
5
-
6
- #if __has_include(<ExpoModulesCore/ExpoModulesCore-Swift.h>)
7
- // When `use_frameworks!` is used, the generated Swift header is inside ExpoModulesCore module.
8
- #import <ExpoModulesCore/ExpoModulesCore-Swift.h>
9
- #else
10
- #import "ExpoModulesCore-Swift.h"
11
- #endif
7
+ #import <ExpoModulesCore/Swift.h>
12
8
 
13
9
  // Make the legacy wrapper conform to the protocol for subscribers.
14
10
  @interface EXLegacyAppDelegateWrapper () <EXAppDelegateSubscriberProtocol>
@@ -21,7 +17,7 @@
21
17
  // and before any code is executed, so we switch back to Objective-C just to do this one thing.
22
18
  + (void)load
23
19
  {
24
- id<ModulesProviderObjCProtocol> modulesProvider = [EXNativeModulesProxy getExpoModulesProvider];
20
+ ModulesProvider *modulesProvider = [EXNativeModulesProxy getExpoModulesProvider];
25
21
  [EXExpoAppDelegate registerSubscriber:[[EXLegacyAppDelegateWrapper alloc] init]];
26
22
  [EXExpoAppDelegate registerSubscribersFromModulesProvider:modulesProvider];
27
23
  [EXExpoAppDelegate registerReactDelegateHandlersFromModulesProvider:modulesProvider];
@@ -20,24 +20,24 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
20
20
 
21
21
  // MARK: - Initializing the App
22
22
 
23
- open func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
23
+ open func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
24
24
  let parsedSubscribers = subscribers.filter {
25
25
  $0.responds(to: #selector(application(_:willFinishLaunchingWithOptions:)))
26
26
  }
27
-
27
+
28
28
  // If we can't find a subscriber that implements `willFinishLaunchingWithOptions`, we will delegate the decision if we can handel the passed URL to
29
29
  // the `didFinishLaunchingWithOptions` method by returning `true` here.
30
30
  // You can read more about how iOS handles deep links here: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623112-application#discussion
31
- if (parsedSubscribers.isEmpty) {
32
- return true;
31
+ if parsedSubscribers.isEmpty {
32
+ return true
33
33
  }
34
-
34
+
35
35
  return parsedSubscribers.reduce(false) { result, subscriber in
36
36
  return subscriber.application!(application, willFinishLaunchingWithOptions: launchOptions) || result
37
37
  }
38
38
  }
39
39
 
40
- open func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
40
+ open func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
41
41
  return subscribers.reduce(false) { result, subscriber in
42
42
  return subscriber.application?(application, didFinishLaunchingWithOptions: launchOptions) ?? false || result
43
43
  }
@@ -107,7 +107,11 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
107
107
  subscribers.forEach { $0.application?(application, didFailToRegisterForRemoteNotificationsWithError: error) }
108
108
  }
109
109
 
110
- open func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
110
+ open func application(
111
+ _ application: UIApplication,
112
+ didReceiveRemoteNotification userInfo: [AnyHashable: Any],
113
+ fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
114
+ ) {
111
115
  let selector = #selector(application(_:didReceiveRemoteNotification:fetchCompletionHandler:))
112
116
  let subs = subscribers.filter { $0.responds(to: selector) }
113
117
  var subscribersLeft = subs.count
@@ -143,7 +147,11 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
143
147
  }
144
148
  }
145
149
 
146
- open func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
150
+ open func application(
151
+ _ application: UIApplication,
152
+ continue userActivity: NSUserActivity,
153
+ restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
154
+ ) -> Bool {
147
155
  let selector = #selector(application(_:continue:restorationHandler:))
148
156
  let subs = subscribers.filter { $0.responds(to: selector) }
149
157
  var subscribersLeft = subs.count
@@ -238,7 +246,7 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
238
246
 
239
247
  // MARK: - Opening a URL-Specified Resource
240
248
 
241
- open func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
249
+ open func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
242
250
  return subscribers.contains { subscriber in
243
251
  return subscriber.application?(app, open: url, options: options) ?? false
244
252
  }
@@ -255,11 +263,8 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
255
263
  // MARK: - Statics
256
264
 
257
265
  @objc
258
- public static func registerSubscribersFrom(modulesProvider: ModulesProviderObjCProtocol) {
259
- guard let provider = modulesProvider as? ModulesProviderProtocol else {
260
- fatalError("Expo modules provider must implement `ModulesProviderProtocol`.")
261
- }
262
- provider.getAppDelegateSubscribers().forEach { subscriberType in
266
+ public static func registerSubscribersFrom(modulesProvider: ModulesProvider) {
267
+ modulesProvider.getAppDelegateSubscribers().forEach { subscriberType in
263
268
  registerSubscriber(subscriberType.init())
264
269
  }
265
270
  }
@@ -278,12 +283,9 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
278
283
  }
279
284
 
280
285
  @objc
281
- public static func registerReactDelegateHandlersFrom(modulesProvider: ModulesProviderObjCProtocol) {
282
- guard let provider = modulesProvider as? ModulesProviderProtocol else {
283
- fatalError("Expo modules provider must implement `ModulesProviderProtocol`.")
284
- }
285
- provider.getReactDelegateHandlers()
286
- .sorted { (tuple1, tuple2) -> Bool in
286
+ public static func registerReactDelegateHandlersFrom(modulesProvider: ModulesProvider) {
287
+ modulesProvider.getReactDelegateHandlers()
288
+ .sorted { tuple1, tuple2 -> Bool in
287
289
  return ModulePriorities.get(tuple1.packageName) > ModulePriorities.get(tuple2.packageName)
288
290
  }
289
291
  .forEach { handlerTuple in
@@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
16
16
  @property (class, nonatomic, assign, readonly) BOOL APP_DEBUG NS_SWIFT_NAME(APP_DEBUG);
17
17
  @property (class, nonatomic, assign, readonly) BOOL APP_RCT_DEBUG NS_SWIFT_NAME(APP_RCT_DEBUG);
18
18
  @property (class, nonatomic, assign, readonly) BOOL APP_RCT_DEV NS_SWIFT_NAME(APP_RCT_DEV);
19
+ @property (class, nonatomic, assign, readonly) BOOL APP_NEW_ARCH_ENABLED NS_SWIFT_NAME(APP_NEW_ARCH_ENABLED);
19
20
 
20
21
  + (NSDictionary *)getAllDefines;
21
22
 
@@ -26,6 +26,12 @@ static BOOL _loaded = NO;
26
26
  return [_storage[@"APP_RCT_DEV"] boolValue];
27
27
  }
28
28
 
29
+ + (BOOL)APP_NEW_ARCH_ENABLED
30
+ {
31
+ [self throwIfNotLoaded];
32
+ return [_storage[@"APP_NEW_ARCH_ENABLED"] boolValue];
33
+ }
34
+
29
35
  + (NSDictionary *)getAllDefines
30
36
  {
31
37
  return _storage;
package/ios/EXUtilities.h CHANGED
@@ -20,6 +20,8 @@ NS_ASSUME_NONNULL_BEGIN
20
20
  - (nullable UIViewController *)currentViewController;
21
21
  - (nullable NSDictionary *)launchOptions;
22
22
 
23
+ + (BOOL)catchException:(void(^)(void))tryBlock error:(__autoreleasing NSError **)error;
24
+
23
25
  @end
24
26
 
25
27
  NS_ASSUME_NONNULL_END
package/ios/EXUtilities.m CHANGED
@@ -206,6 +206,18 @@ EX_REGISTER_MODULE();
206
206
  }
207
207
  }
208
208
 
209
+ + (BOOL)catchException:(void(^)(void))tryBlock error:(__autoreleasing NSError **)error
210
+ {
211
+ @try {
212
+ tryBlock();
213
+ return YES;
214
+ }
215
+ @catch (NSException *exception) {
216
+ *error = [[NSError alloc] initWithDomain:exception.name code:0 userInfo:exception.userInfo];
217
+ return NO;
218
+ }
219
+ }
220
+
209
221
  @end
210
222
 
211
223
  UIApplication * EXSharedApplication(void)
@@ -1,5 +1,9 @@
1
1
  // Copyright 2015-present 650 Industries. All rights reserved.
2
2
 
3
+ // Some headers needs to be imported from Objective-C code too.
4
+ // Otherwise they won't be visible in `ExpoModulesCore-Swift.h`.
5
+ #import <React/RCTView.h>
6
+
3
7
  #if __has_include("ExpoModulesCore-umbrella.h")
4
8
  #import "ExpoModulesCore-umbrella.h"
5
9
  #endif
@@ -23,6 +23,9 @@ Pod::Spec.new do |s|
23
23
  'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
24
24
  'SWIFT_COMPILATION_MODE' => 'wholemodule',
25
25
  }
26
+ s.user_target_xcconfig = {
27
+ "HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/ExpoModulesCore/Swift Compatibility Header\"",
28
+ }
26
29
 
27
30
  s.dependency 'React-Core'
28
31
  s.dependency 'ReactCommon/turbomodule/core'
@@ -38,8 +41,7 @@ Pod::Spec.new do |s|
38
41
  s.private_header_files = ['**/*+Private.h', '**/Swift.h']
39
42
 
40
43
  s.test_spec 'Tests' do |test_spec|
41
- test_spec.dependency 'Quick'
42
- test_spec.dependency 'Nimble'
44
+ test_spec.dependency 'ExpoModulesTestCore'
43
45
 
44
46
  test_spec.source_files = 'Tests/**/*.{m,swift}'
45
47
  end
@@ -17,7 +17,7 @@ typedef NS_OPTIONS(unsigned int, EXFileSystemPermissionFlags) {
17
17
 
18
18
  // TODO: Move permissionsForURI to EXFileSystemManagerInterface
19
19
  - (EXFileSystemPermissionFlags)permissionsForURI:(NSURL *)uri;
20
- - (NSString *)generatePathInDirectory:(NSString *)directory withExtension:(NSString *)extension;
20
+ - (nonnull NSString *)generatePathInDirectory:(NSString *)directory withExtension:(NSString *)extension;
21
21
  - (BOOL)ensureDirExistsWithPath:(NSString *)path;
22
22
 
23
23
  @end
@@ -1,6 +1,7 @@
1
1
  // Copyright 2015-present 650 Industries. All rights reserved.
2
2
 
3
3
  #import <ExpoModulesCore/EXTaskInterface.h>
4
+ #import <ExpoModulesCore/EXTaskManagerInterface.h>
4
5
 
5
6
  @protocol EXTaskServiceInterface
6
7
 
@@ -11,6 +11,9 @@
11
11
  using namespace facebook;
12
12
  using namespace react;
13
13
 
14
+ @class EXJavaScriptValue;
15
+ @class EXJavaScriptRuntime;
16
+
14
17
  namespace expo {
15
18
 
16
19
  jsi::Value convertNSNumberToJSIBoolean(jsi::Runtime &runtime, NSNumber *value);
@@ -31,6 +34,8 @@ NSString *convertJSIStringToNSString(jsi::Runtime &runtime, const jsi::String &v
31
34
 
32
35
  NSArray *convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value, std::shared_ptr<CallInvoker> jsInvoker);
33
36
 
37
+ NSArray<EXJavaScriptValue *> *convertJSIValuesToNSArray(EXJavaScriptRuntime *runtime, const jsi::Value *values, size_t count);
38
+
34
39
  NSDictionary *convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value, std::shared_ptr<CallInvoker> jsInvoker);
35
40
 
36
41
  id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker);
@@ -1,7 +1,9 @@
1
1
  // Copyright 2018-present 650 Industries. All rights reserved.
2
2
 
3
3
  #import <ReactCommon/TurboModuleUtils.h>
4
- #import <ExpoModulesCore/JSIConversions.h>
4
+ #import <ExpoModulesCore/EXJSIConversions.h>
5
+ #import <ExpoModulesCore/EXJavaScriptValue.h>
6
+ #import <ExpoModulesCore/EXJavaScriptRuntime.h>
5
7
 
6
8
  namespace expo {
7
9
 
@@ -52,6 +54,12 @@ std::vector<jsi::Value> convertNSArrayToStdVector(jsi::Runtime &runtime, NSArray
52
54
 
53
55
  jsi::Value convertObjCObjectToJSIValue(jsi::Runtime &runtime, id value)
54
56
  {
57
+ if ([value isKindOfClass:[EXJavaScriptValue class]]) {
58
+ return jsi::Value(runtime, *[(EXJavaScriptValue *)value get]);
59
+ }
60
+ if ([value isKindOfClass:[EXJavaScriptObject class]]) {
61
+ return jsi::Value(runtime, *[(EXJavaScriptObject *)value get]);
62
+ }
55
63
  if ([value isKindOfClass:[NSString class]]) {
56
64
  return convertNSStringToJSIString(runtime, (NSString *)value);
57
65
  } else if ([value isKindOfClass:[NSNumber class]]) {
@@ -86,6 +94,18 @@ NSArray *convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value
86
94
  return [result copy];
87
95
  }
88
96
 
97
+ NSArray<EXJavaScriptValue *> *convertJSIValuesToNSArray(EXJavaScriptRuntime *runtime, const jsi::Value *values, size_t count)
98
+ {
99
+ NSMutableArray<EXJavaScriptValue *> *array = [NSMutableArray arrayWithCapacity:count];
100
+ jsi::Runtime *jsiRuntime = [runtime get];
101
+
102
+ for (int i = 0; i < count; i++) {
103
+ std::shared_ptr<jsi::Value> value = std::make_shared<jsi::Value>(*jsiRuntime, values[i]);
104
+ array[i] = [[EXJavaScriptValue alloc] initWithRuntime:runtime value:value];
105
+ }
106
+ return array;
107
+ }
108
+
89
109
  NSDictionary *convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value, std::shared_ptr<CallInvoker> jsInvoker)
90
110
  {
91
111
  jsi::Array propertyNames = value.getPropertyNames(runtime);
@@ -17,3 +17,13 @@ void installRuntimeObjects(jsi::Runtime &runtime, std::shared_ptr<CallInvoker> c
17
17
  } // namespace expo
18
18
 
19
19
  #endif
20
+
21
+ #import <ExpoModulesCore/EXJavaScriptRuntime.h>
22
+
23
+ @class SwiftInteropBridge;
24
+
25
+ @interface EXJavaScriptRuntimeManager : NSObject
26
+
27
+ + (void)installExpoModulesToRuntime:(nonnull EXJavaScriptRuntime *)runtime withSwiftInterop:(nonnull SwiftInteropBridge *)swiftInterop;
28
+
29
+ @end
@@ -0,0 +1,17 @@
1
+ // Copyright 2018-present 650 Industries. All rights reserved.
2
+
3
+ #import <ExpoModulesCore/EXJSIInstaller.h>
4
+ #import <ExpoModulesCore/ExpoModulesHostObject.h>
5
+ #import <ExpoModulesCore/Swift.h>
6
+
7
+ @implementation EXJavaScriptRuntimeManager
8
+
9
+ + (void)installExpoModulesToRuntime:(nonnull EXJavaScriptRuntime *)runtime withSwiftInterop:(nonnull SwiftInteropBridge *)swiftInterop
10
+ {
11
+ std::shared_ptr<expo::ExpoModulesHostObject> hostObjectPtr = std::make_shared<expo::ExpoModulesHostObject>(swiftInterop);
12
+ EXJavaScriptObject *global = [runtime global];
13
+
14
+ [global setProperty:@"ExpoModules" value:[runtime createHostObject:hostObjectPtr]];
15
+ }
16
+
17
+ @end
@@ -0,0 +1,19 @@
1
+ // Copyright 2018-present 650 Industries. All rights reserved.
2
+
3
+ #ifdef __cplusplus
4
+
5
+ #import <jsi/jsi.h>
6
+ #import <ReactCommon/RCTTurboModule.h>
7
+
8
+ using namespace facebook;
9
+ using namespace react;
10
+
11
+ namespace expo {
12
+
13
+ using PromiseInvocationBlock = void (^)(RCTPromiseResolveBlock resolveWrapper, RCTPromiseRejectBlock rejectWrapper);
14
+
15
+ void callPromiseSetupWithBlock(jsi::Runtime &runtime, std::shared_ptr<CallInvoker> jsInvoker, std::shared_ptr<Promise> promise, PromiseInvocationBlock setupBlock);
16
+
17
+ } // namespace expo
18
+
19
+ #endif