expo-modules-core 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -6
- package/ExpoModulesCore.podspec +38 -4
- package/android/CMakeLists.txt +21 -71
- package/android/ExpoModulesCorePlugin.gradle +200 -0
- package/android/build.gradle +42 -205
- package/android/legacy/CMakeLists.txt +194 -0
- package/android/{src → legacy}/fabric/Android-prebuilt.cmake +2 -0
- package/android/legacy/fabric/CMakeLists.txt +40 -0
- package/android/proguard-rules.pro +13 -0
- package/android/src/fabric/CMakeLists.txt +23 -16
- package/android/src/main/java/expo/modules/kotlin/AppContext.kt +7 -0
- package/android/src/main/java/expo/modules/kotlin/exception/CommonExceptions.kt +5 -0
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +44 -0
- package/android/src/main/java/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +9 -1
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +46 -0
- package/build/EventEmitter.d.ts +2 -2
- package/build/EventEmitter.d.ts.map +1 -1
- package/build/NativeModulesProxy.types.d.ts +1 -1
- package/build/NativeModulesProxy.types.d.ts.map +1 -1
- package/build/NativeViewManagerAdapter.native.d.ts +1 -1
- package/build/NativeViewManagerAdapter.native.d.ts.map +1 -1
- package/build/NativeViewManagerAdapter.native.js +3 -3
- package/build/NativeViewManagerAdapter.native.js.map +1 -1
- package/build/PermissionsHook.d.ts +4 -4
- package/build/PermissionsHook.d.ts.map +1 -1
- package/build/PermissionsInterface.d.ts +1 -1
- package/build/PermissionsInterface.d.ts.map +1 -1
- package/build/Platform.d.ts +2 -2
- package/build/Platform.d.ts.map +1 -1
- package/build/TypedArrays.types.d.ts +9 -0
- package/build/TypedArrays.types.d.ts.map +1 -0
- package/build/TypedArrays.types.js +2 -0
- package/build/TypedArrays.types.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/requireNativeModule.d.ts +1 -1
- package/build/requireNativeModule.d.ts.map +1 -1
- package/common/cpp/fabric/ExpoViewProps.cpp +2 -0
- package/ios/AppDelegates/EXAppDelegateWrapper.h +22 -0
- package/ios/AppDelegates/EXAppDelegateWrapper.mm +100 -0
- package/ios/JSI/EXJavaScriptRuntime.mm +5 -5
- package/ios/ReactDelegates/EXReactCompatibleHelpers.h +1 -1
- package/ios/ReactDelegates/EXReactCompatibleHelpers.m +8 -2
- package/ios/ReactDelegates/EXReactDelegateWrapper.h +5 -0
- package/ios/ReactDelegates/EXReactDelegateWrapper.m +14 -1
- package/ios/ReactDelegates/ExpoReactDelegate.swift +7 -2
- package/ios/Swift/AppContext.swift +9 -0
- package/ios/Swift/Arguments/Enumerable.swift +2 -16
- package/ios/Swift/Classes/ClassComponentElement.swift +1 -1
- package/ios/Swift/Convertibles/Either.swift +5 -14
- package/ios/Swift/DynamicTypes/DynamicEnumType.swift +1 -1
- package/ios/Swift/DynamicTypes/DynamicSharedObjectType.swift +4 -0
- package/ios/Swift/DynamicTypes/DynamicType.swift +1 -1
- package/ios/Swift/Functions/AnyFunction.swift +18 -0
- package/ios/Swift/JavaScriptUtils.swift +25 -8
- package/ios/Swift/Objects/ObjectDefinition.swift +4 -4
- package/ios/Swift/Objects/ObjectDefinitionComponents.swift +7 -0
- package/ios/Swift/Objects/PropertyComponent.swift +138 -48
- package/ios/Swift/SharedObjects/SharedObject.swift +5 -0
- package/ios/Tests/ClassComponentSpec.swift +15 -0
- package/ios/Tests/EitherSpec.swift +28 -0
- package/ios/Tests/FunctionSpec.swift +31 -0
- package/ios/Tests/PropertyComponentSpec.swift +131 -33
- package/package.json +2 -2
- package/src/NativeViewManagerAdapter.native.tsx +4 -4
- package/src/TypedArrays.types.ts +11 -0
- package/src/index.ts +1 -0
- package/ios/AppDelegates/EXAppDelegateWrapper.m +0 -45
|
@@ -130,6 +130,24 @@ open class ObjectDefinitionBuilder {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> Function(
|
|
134
|
+
name: String,
|
|
135
|
+
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3) -> R
|
|
136
|
+
): SyncFunctionComponent {
|
|
137
|
+
return SyncFunctionComponent(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3) }.also {
|
|
138
|
+
syncFunctions[name] = it
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> Function(
|
|
143
|
+
name: String,
|
|
144
|
+
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R
|
|
145
|
+
): SyncFunctionComponent {
|
|
146
|
+
return SyncFunctionComponent(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4) }.also {
|
|
147
|
+
syncFunctions[name] = it
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
133
151
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> Function(
|
|
134
152
|
name: String,
|
|
135
153
|
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R
|
|
@@ -139,6 +157,24 @@ open class ObjectDefinitionBuilder {
|
|
|
139
157
|
}
|
|
140
158
|
}
|
|
141
159
|
|
|
160
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> Function(
|
|
161
|
+
name: String,
|
|
162
|
+
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R
|
|
163
|
+
): SyncFunctionComponent {
|
|
164
|
+
return SyncFunctionComponent(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType(), typeOf<P6>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5, it[6] as P6) }.also {
|
|
165
|
+
syncFunctions[name] = it
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> Function(
|
|
170
|
+
name: String,
|
|
171
|
+
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R
|
|
172
|
+
): SyncFunctionComponent {
|
|
173
|
+
return SyncFunctionComponent(name, arrayOf(typeOf<P0>().toAnyType(), typeOf<P1>().toAnyType(), typeOf<P2>().toAnyType(), typeOf<P3>().toAnyType(), typeOf<P4>().toAnyType(), typeOf<P5>().toAnyType(), typeOf<P6>().toAnyType(), typeOf<P7>().toAnyType())) { body(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5, it[6] as P6, it[7] as P7) }.also {
|
|
174
|
+
syncFunctions[name] = it
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
142
178
|
@JvmName("AsyncFunctionWithoutArgs")
|
|
143
179
|
inline fun AsyncFunction(
|
|
144
180
|
name: String,
|
|
@@ -273,6 +309,14 @@ open class ObjectDefinitionBuilder {
|
|
|
273
309
|
eventsDefinition = EventsDefinition(events)
|
|
274
310
|
}
|
|
275
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Defines event names that this module can send to JavaScript.
|
|
314
|
+
*/
|
|
315
|
+
@JvmName("EventsWithArray")
|
|
316
|
+
fun Events(events: Array<String>) {
|
|
317
|
+
eventsDefinition = EventsDefinition(events)
|
|
318
|
+
}
|
|
319
|
+
|
|
276
320
|
/**
|
|
277
321
|
* Creates module's lifecycle listener that is called right after the first event listener is added.
|
|
278
322
|
*/
|
|
@@ -73,6 +73,14 @@ class ViewDefinitionBuilder<T : View>(private val viewType: KClass<T>) {
|
|
|
73
73
|
callbacksDefinition = CallbacksDefinition(callbacks)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Defines prop names that should be treated as callbacks.
|
|
78
|
+
*/
|
|
79
|
+
@JvmName("EventsWithArray")
|
|
80
|
+
fun Events(callbacks: Array<String>) {
|
|
81
|
+
callbacksDefinition = CallbacksDefinition(callbacks)
|
|
82
|
+
}
|
|
83
|
+
|
|
76
84
|
/**
|
|
77
85
|
* Creates the group view definition that scopes group view-related definitions.
|
|
78
86
|
*/
|
|
@@ -85,7 +93,7 @@ class ViewDefinitionBuilder<T : View>(private val viewType: KClass<T>) {
|
|
|
85
93
|
}
|
|
86
94
|
|
|
87
95
|
private fun createViewFactory(): (Context, AppContext) -> View = viewFactory@{ context: Context, appContext: AppContext ->
|
|
88
|
-
val primaryConstructor = requireNotNull(viewType.primaryConstructor)
|
|
96
|
+
val primaryConstructor = requireNotNull(viewType.primaryConstructor) { "$viewType doesn't have a primary constructor" }
|
|
89
97
|
val args = primaryConstructor.parameters
|
|
90
98
|
|
|
91
99
|
if (args.isEmpty()) {
|
|
@@ -66,6 +66,52 @@ class ViewManagerDefinitionBuilder {
|
|
|
66
66
|
)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Creates a view prop group that defines its name and setter.
|
|
71
|
+
*/
|
|
72
|
+
inline fun <reified ViewType : View, reified PropType> PropGroup(
|
|
73
|
+
vararg names: String,
|
|
74
|
+
noinline body: (view: ViewType, name: String, prop: PropType) -> Unit
|
|
75
|
+
) {
|
|
76
|
+
for (name in names) {
|
|
77
|
+
props[name] = ConcreteViewProp<ViewType, PropType>(
|
|
78
|
+
name,
|
|
79
|
+
typeOf<PropType>().toAnyType()
|
|
80
|
+
) { view, prop -> body(view, name, prop) }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a view prop group that defines its name and setter with the custom mapping.
|
|
86
|
+
*/
|
|
87
|
+
inline fun <reified ViewType : View, reified PropType, reified CustomValue> PropGroup(
|
|
88
|
+
vararg propInfo: Pair<String, CustomValue>,
|
|
89
|
+
noinline body: (view: ViewType, value: CustomValue, prop: PropType) -> Unit
|
|
90
|
+
) {
|
|
91
|
+
for ((name, value) in propInfo) {
|
|
92
|
+
props[name] = ConcreteViewProp<ViewType, PropType>(
|
|
93
|
+
name,
|
|
94
|
+
typeOf<PropType>().toAnyType()
|
|
95
|
+
) { view, prop -> body(view, value, prop) }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Creates a view prop group that defines its name and setter with the index mapping.
|
|
101
|
+
*/
|
|
102
|
+
@JvmName("PropGroupIndexed")
|
|
103
|
+
inline fun <reified ViewType : View, reified PropType> PropGroup(
|
|
104
|
+
vararg names: String,
|
|
105
|
+
noinline body: (view: ViewType, value: Int, prop: PropType) -> Unit
|
|
106
|
+
) {
|
|
107
|
+
names.forEachIndexed { index, name ->
|
|
108
|
+
props[name] = ConcreteViewProp<ViewType, PropType>(
|
|
109
|
+
name,
|
|
110
|
+
typeOf<PropType>().toAnyType()
|
|
111
|
+
) { view, prop -> body(view, index, prop) }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
69
115
|
/**
|
|
70
116
|
* Defines prop names that should be treated as callbacks.
|
|
71
117
|
*/
|
package/build/EventEmitter.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { NativeEventEmitter } from 'react-native';
|
|
2
|
-
|
|
2
|
+
type NativeModule = {
|
|
3
3
|
__expo_module_name__?: string;
|
|
4
4
|
startObserving?: () => void;
|
|
5
5
|
stopObserving?: () => void;
|
|
6
6
|
addListener: (eventName: string) => void;
|
|
7
7
|
removeListeners: (count: number) => void;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type Subscription = {
|
|
10
10
|
/**
|
|
11
11
|
* A method to unsubscribe the listener.
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../src/EventEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,cAAc,CAAC;AAI3E,
|
|
1
|
+
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../src/EventEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,cAAc,CAAC;AAI3E,KAAK,YAAY,GAAG;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,qBAAa,YAAY;IACvB,cAAc,SAAK;IACnB,aAAa,EAAE,YAAY,CAAC;IAC5B,aAAa,EAAE,kBAAkB,CAAC;gBAEtB,YAAY,EAAE,YAAY;IAqBtC,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;IA0BpD,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;CAGhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeModulesProxy.types.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.types.ts"],"names":[],"mappings":"AAAA,
|
|
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;IACzC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,CAAC"}
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* A drop-in replacement for `requireNativeComponent`.
|
|
4
4
|
*/
|
|
5
|
-
export declare function requireNativeViewManager<P
|
|
5
|
+
export declare function requireNativeViewManager<P>(viewName: string): React.ComponentType<P>;
|
|
6
6
|
//# sourceMappingURL=NativeViewManagerAdapter.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeViewManagerAdapter.native.d.ts","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"NativeViewManagerAdapter.native.d.ts","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CA0BpF"}
|
|
@@ -16,13 +16,13 @@ export function requireNativeViewManager(viewName) {
|
|
|
16
16
|
const ReactNativeComponent = requireNativeComponent(reactNativeViewName);
|
|
17
17
|
const proxiedPropsNames = viewManagerConfig?.propsNames ?? [];
|
|
18
18
|
// Define a component for universal-module authors to access their native view manager
|
|
19
|
-
|
|
19
|
+
const NativeComponentAdapter = React.forwardRef((props, ref) => {
|
|
20
20
|
const nativeProps = omit(props, proxiedPropsNames);
|
|
21
21
|
const proxiedProps = pick(props, proxiedPropsNames);
|
|
22
22
|
return React.createElement(ReactNativeComponent, { ...nativeProps, proxiedProperties: proxiedProps, ref: ref });
|
|
23
|
-
}
|
|
23
|
+
});
|
|
24
24
|
NativeComponentAdapter.displayName = `Adapter<${viewName}>`;
|
|
25
|
-
return
|
|
25
|
+
return NativeComponentAdapter;
|
|
26
26
|
}
|
|
27
27
|
function omit(props, propNames) {
|
|
28
28
|
const copied = { ...props };
|
|
@@ -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,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAerE;;GAEG;AACH,MAAM,UAAU,wBAAwB,
|
|
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,CAAI,QAAgB;IAC1D,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,MAAM,sBAAsB,GAAG,KAAK,CAAC,UAAU,CAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAClE,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,CAA2B,CAAC;IAC7B,sBAAsB,CAAC,WAAW,GAAG,WAAW,QAAQ,GAAG,CAAC;IAC5D,OAAO,sBAAsB,CAAC;AAChC,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>(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 const NativeComponentAdapter = React.forwardRef<any>((props, ref) => {\n const nativeProps = omit(props, proxiedPropsNames);\n const proxiedProps = pick(props, proxiedPropsNames);\n return <ReactNativeComponent {...nativeProps} proxiedProperties={proxiedProps} ref={ref} />;\n }) as React.ComponentType<P>;\n NativeComponentAdapter.displayName = `Adapter<${viewName}>`;\n return 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,6 +1,6 @@
|
|
|
1
1
|
import { PermissionResponse } from './PermissionsInterface';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type RequestPermissionMethod<Permission extends PermissionResponse> = () => Promise<Permission>;
|
|
3
|
+
type GetPermissionMethod<Permission extends PermissionResponse> = () => Promise<Permission>;
|
|
4
4
|
interface PermissionHookMethods<Permission extends PermissionResponse, Options = never> {
|
|
5
5
|
/** The permission method that requests the user to grant permission. */
|
|
6
6
|
requestMethod: (options?: Options) => Promise<Permission>;
|
|
@@ -13,11 +13,11 @@ interface PermissionHookBehavior {
|
|
|
13
13
|
/** If the hook should automatically request the user to grant permission. */
|
|
14
14
|
request?: boolean;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export type PermissionHookOptions<Options extends object> = PermissionHookBehavior & Options;
|
|
17
17
|
/**
|
|
18
18
|
* Create a new permission hook with the permission methods built-in.
|
|
19
19
|
* This can be used to quickly create specific permission hooks in every module.
|
|
20
20
|
*/
|
|
21
|
-
export declare function createPermissionHook<Permission extends PermissionResponse, Options extends object>(methods: PermissionHookMethods<Permission, Options>): (options?: PermissionHookOptions<Options>
|
|
21
|
+
export declare function createPermissionHook<Permission extends PermissionResponse, Options extends object>(methods: PermissionHookMethods<Permission, Options>): (options?: PermissionHookOptions<Options>) => [Permission | null, RequestPermissionMethod<Permission>, GetPermissionMethod<Permission>];
|
|
22
22
|
export {};
|
|
23
23
|
//# sourceMappingURL=PermissionsHook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionsHook.d.ts","sourceRoot":"","sources":["../src/PermissionsHook.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,
|
|
1
|
+
{"version":3,"file":"PermissionsHook.d.ts","sourceRoot":"","sources":["../src/PermissionsHook.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,KAAK,uBAAuB,CAAC,UAAU,SAAS,kBAAkB,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;AAChG,KAAK,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,MAAM,MAAM,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,cAEjC,sBAAsB,OAAO,CAAC,+FAEjD"}
|
|
@@ -15,7 +15,7 @@ export declare enum PermissionStatus {
|
|
|
15
15
|
/**
|
|
16
16
|
* Permission expiration time. Currently, all permissions are granted permanently.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export type PermissionExpiration = 'never' | number;
|
|
19
19
|
/**
|
|
20
20
|
* An object obtained by permissions get and request functions.
|
|
21
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionsInterface.d.ts","sourceRoot":"","sources":["../src/PermissionsInterface.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,YAAY,iBAAiB;IAC7B;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"PermissionsInterface.d.ts","sourceRoot":"","sources":["../src/PermissionsInterface.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,YAAY,iBAAiB;IAC7B;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
package/build/Platform.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PlatformOSType } from 'react-native';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type PlatformSelectOSType = PlatformOSType | 'native' | 'electron' | 'default';
|
|
3
|
+
export type PlatformSelect = <T>(specifics: {
|
|
4
4
|
[platform in PlatformSelectOSType]?: T;
|
|
5
5
|
}) => T;
|
|
6
6
|
declare const Platform: {
|
package/build/Platform.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../src/Platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,cAAc,EAAE,MAAM,cAAc,CAAC;AAS/E,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAEtF,MAAM,MAAM,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A union type for all integer based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */
|
|
2
|
+
export type IntBasedTypedArray = Int8Array | Int16Array | Int32Array;
|
|
3
|
+
/** A union type for all unsigned integer based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */
|
|
4
|
+
export type UintBasedTypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
|
|
5
|
+
/** A union type for all floating point based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */
|
|
6
|
+
export type FloatBasedTypedArray = Float32Array | Float64Array;
|
|
7
|
+
/** A [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) describes an array-like view of an underlying binary data buffer. */
|
|
8
|
+
export type TypedArray = IntBasedTypedArray | UintBasedTypedArray | FloatBasedTypedArray;
|
|
9
|
+
//# sourceMappingURL=TypedArrays.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedArrays.types.d.ts","sourceRoot":"","sources":["../src/TypedArrays.types.ts"],"names":[],"mappings":"AAAA,iLAAiL;AACjL,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,0LAA0L;AAC1L,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,iBAAiB,GAAG,WAAW,GAAG,WAAW,CAAC;AAE7F,wLAAwL;AACxL,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,YAAY,CAAC;AAE/D,sLAAsL;AACtL,MAAM,MAAM,UAAU,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedArrays.types.js","sourceRoot":"","sources":["../src/TypedArrays.types.ts"],"names":[],"mappings":"","sourcesContent":["/** A union type for all integer based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */\nexport type IntBasedTypedArray = Int8Array | Int16Array | Int32Array;\n\n/** A union type for all unsigned integer based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */\nexport type UintBasedTypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;\n\n/** A union type for all floating point based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */\nexport type FloatBasedTypedArray = Float32Array | Float64Array;\n\n/** A [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) describes an array-like view of an underlying binary data buffer. */\nexport type TypedArray = IntBasedTypedArray | UintBasedTypedArray | FloatBasedTypedArray;\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import './sweet/setUpErrorManager.fx';
|
|
|
11
11
|
export { default as deprecate } from './deprecate';
|
|
12
12
|
export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, ProxyNativeModule, Platform, Subscription, SyntheticPlatformEmitter, requireNativeViewManager, CodedError, UnavailabilityError, };
|
|
13
13
|
export * from './requireNativeModule';
|
|
14
|
+
export * from './TypedArrays.types';
|
|
14
15
|
/**
|
|
15
16
|
* @deprecated renamed to `DeviceEventEmitter`
|
|
16
17
|
*/
|
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,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;
|
|
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;AACtC,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,qBAAqB,iDAAqB,CAAC;AAExD,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, Platform, Synthet
|
|
|
12
12
|
// Errors
|
|
13
13
|
CodedError, UnavailabilityError, };
|
|
14
14
|
export * from './requireNativeModule';
|
|
15
|
+
export * from './TypedArrays.types';
|
|
15
16
|
/**
|
|
16
17
|
* @deprecated renamed to `DeviceEventEmitter`
|
|
17
18
|
*/
|
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,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;
|
|
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;AACtC,cAAc,qBAAqB,CAAC;AAEpC;;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';\nexport * from './TypedArrays.types';\n\n/**\n * @deprecated renamed to `DeviceEventEmitter`\n */\nexport const RCTDeviceEventEmitter = DeviceEventEmitter;\n\nexport * from './PermissionsInterface';\nexport * from './PermissionsHook';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireNativeModule.d.ts","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"requireNativeModule.d.ts","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,OAAO,EACH,SAAS,GACT;QACE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACP,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAEjC;;OAEG;IAEH,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,CAUpF"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
+
#if __cplusplus
|
|
4
|
+
|
|
3
5
|
#import <UIKit/UIKit.h>
|
|
4
6
|
#import <ExpoModulesCore/EXReactDelegateWrapper.h>
|
|
5
7
|
|
|
8
|
+
#if __has_include(<React-RCTAppDelegate/RCTAppDelegate.h>)
|
|
9
|
+
#import <React-RCTAppDelegate/RCTAppDelegate.h>
|
|
10
|
+
#elif __has_include(<React_RCTAppDelegate/RCTAppDelegate.h>)
|
|
11
|
+
// for importing the header from framework, the dash will be transformed to underscore
|
|
12
|
+
#import <React_RCTAppDelegate/RCTAppDelegate.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
6
15
|
NS_ASSUME_NONNULL_BEGIN
|
|
7
16
|
|
|
8
17
|
/**
|
|
@@ -10,10 +19,23 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
10
19
|
written in Objective-C and that forwards all messages to the new `ExpoAppDelegate`.
|
|
11
20
|
If your `AppDelegate` is in Swift, it should inherit from `ExpoAppDelegate` class instead.
|
|
12
21
|
*/
|
|
22
|
+
#if __has_include(<React-RCTAppDelegate/RCTAppDelegate.h>) || __has_include(<React_RCTAppDelegate/RCTAppDelegate.h>)
|
|
23
|
+
@interface EXAppDelegateWrapper : RCTAppDelegate
|
|
24
|
+
#else
|
|
13
25
|
@interface EXAppDelegateWrapper : UIResponder <UIApplicationDelegate>
|
|
26
|
+
#endif
|
|
14
27
|
|
|
15
28
|
@property (nonatomic, strong, readonly) EXReactDelegateWrapper *reactDelegate;
|
|
16
29
|
|
|
17
30
|
@end
|
|
18
31
|
|
|
19
32
|
NS_ASSUME_NONNULL_END
|
|
33
|
+
|
|
34
|
+
#else
|
|
35
|
+
|
|
36
|
+
// Workaround the main.m build error when running with new architecture mode
|
|
37
|
+
// Context: https://github.com/facebook/react-native/pull/35661
|
|
38
|
+
@interface EXAppDelegateWrapper : UIResponder
|
|
39
|
+
@end
|
|
40
|
+
|
|
41
|
+
#endif
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
#import <ExpoModulesCore/EXAppDelegateWrapper.h>
|
|
4
|
+
#import <ExpoModulesCore/EXReactDelegateWrapper+Private.h>
|
|
5
|
+
#import <ExpoModulesCore/Swift.h>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@interface EXAppDelegateWrapper()
|
|
9
|
+
|
|
10
|
+
@property (nonatomic, strong) EXReactDelegateWrapper *reactDelegate;
|
|
11
|
+
|
|
12
|
+
@end
|
|
13
|
+
|
|
14
|
+
@implementation EXAppDelegateWrapper {
|
|
15
|
+
EXExpoAppDelegate *_expoAppDelegate;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Synthesize window, so the AppDelegate can synthesize it too.
|
|
19
|
+
@synthesize window = _window;
|
|
20
|
+
|
|
21
|
+
- (instancetype)init
|
|
22
|
+
{
|
|
23
|
+
if (self = [super init]) {
|
|
24
|
+
_expoAppDelegate = [[EXExpoAppDelegate alloc] init];
|
|
25
|
+
_reactDelegate = [[EXReactDelegateWrapper alloc] initWithExpoReactDelegate:_expoAppDelegate.reactDelegate];
|
|
26
|
+
}
|
|
27
|
+
return self;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// This needs to be implemented, otherwise forwarding won't be called.
|
|
31
|
+
// When the app starts, `UIApplication` uses it to check beforehand
|
|
32
|
+
// which `UIApplicationDelegate` selectors are implemented.
|
|
33
|
+
- (BOOL)respondsToSelector:(SEL)selector
|
|
34
|
+
{
|
|
35
|
+
return [super respondsToSelector:selector]
|
|
36
|
+
|| [_expoAppDelegate respondsToSelector:selector];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Forwards all invocations to `ExpoAppDelegate` object.
|
|
40
|
+
- (id)forwardingTargetForSelector:(SEL)selector
|
|
41
|
+
{
|
|
42
|
+
return _expoAppDelegate;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#if __has_include(<React-RCTAppDelegate/RCTAppDelegate.h>)
|
|
46
|
+
|
|
47
|
+
- (UIView *)findRootView:(UIApplication *)application
|
|
48
|
+
{
|
|
49
|
+
UIWindow *mainWindow = application.delegate.window;
|
|
50
|
+
if (mainWindow == nil) {
|
|
51
|
+
return nil;
|
|
52
|
+
}
|
|
53
|
+
UIViewController *rootViewController = mainWindow.rootViewController;
|
|
54
|
+
if (rootViewController == nil) {
|
|
55
|
+
return nil;
|
|
56
|
+
}
|
|
57
|
+
UIView *rootView = rootViewController.view;
|
|
58
|
+
return rootView;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
62
|
+
{
|
|
63
|
+
UIView *rootView = [self findRootView:application];
|
|
64
|
+
// Backward compatible with react-native 0.71 running with legacy template,
|
|
65
|
+
// i.e. still creating bridge, rootView in AppDelegate.mm.
|
|
66
|
+
// In this case, we don't go through RCTAppDelegate's setup.
|
|
67
|
+
if (rootView == nil || ![rootView isKindOfClass:[RCTRootView class]]) {
|
|
68
|
+
[super application:application didFinishLaunchingWithOptions:launchOptions];
|
|
69
|
+
[_expoAppDelegate application:application didFinishLaunchingWithOptions:launchOptions];
|
|
70
|
+
}
|
|
71
|
+
return YES;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions
|
|
75
|
+
{
|
|
76
|
+
return [self.reactDelegate createBridgeWithDelegate:delegate launchOptions:launchOptions];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
|
|
80
|
+
moduleName:(NSString *)moduleName
|
|
81
|
+
initProps:(NSDictionary *)initProps
|
|
82
|
+
{
|
|
83
|
+
BOOL enableFabric = NO;
|
|
84
|
+
#if RN_FABRIC_ENABLED
|
|
85
|
+
enableFabric = self.fabricEnabled;
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
return [self.reactDelegate createRootViewWithBridge:bridge
|
|
89
|
+
moduleName:moduleName
|
|
90
|
+
initialProperties:initProps
|
|
91
|
+
fabricEnabled:enableFabric];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
- (UIViewController *)createRootViewController
|
|
95
|
+
{
|
|
96
|
+
return [self.reactDelegate createRootViewController];
|
|
97
|
+
}
|
|
98
|
+
#endif // __has_include(<React-RCTAppDelegate/RCTAppDelegate.h>)
|
|
99
|
+
|
|
100
|
+
@end
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
|
6
6
|
#import <reacthermes/HermesExecutorFactory.h>
|
|
7
|
-
#elif __has_include(<
|
|
8
|
-
|
|
7
|
+
#elif __has_include(<React-jsc/JSCRuntime.h>)
|
|
8
|
+
// react-native@>=0.71 has a specific React-jsc pod
|
|
9
|
+
#import <React-jsc/JSCRuntime.h>
|
|
9
10
|
#else
|
|
10
11
|
#import <jsi/JSCRuntime.h>
|
|
11
12
|
#endif
|
|
@@ -16,7 +17,6 @@
|
|
|
16
17
|
#import <ExpoModulesCore/EXJSIConversions.h>
|
|
17
18
|
#import <ExpoModulesCore/Swift.h>
|
|
18
19
|
|
|
19
|
-
using namespace facebook;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
Property name of the main object in the Expo JS runtime.
|
|
@@ -37,8 +37,8 @@ static NSString *mainObjectPropertyName = @"expo";
|
|
|
37
37
|
- (nonnull instancetype)init
|
|
38
38
|
{
|
|
39
39
|
if (self = [super init]) {
|
|
40
|
-
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
|
41
|
-
_runtime = hermes::makeHermesRuntime();
|
|
40
|
+
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
|
41
|
+
_runtime = facebook::hermes::makeHermesRuntime();
|
|
42
42
|
#else
|
|
43
43
|
_runtime = jsc::makeJSCRuntime();
|
|
44
44
|
#endif
|
|
@@ -13,6 +13,6 @@ EX_EXTERN_C_BEGIN
|
|
|
13
13
|
*
|
|
14
14
|
* `RCTAppSetupDefaultRootView` is introduced in react-native 0.68. To make `expo-modules-core` compatible with older react-native, introduces this compatible helper.
|
|
15
15
|
*/
|
|
16
|
-
UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties);
|
|
16
|
+
UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties, BOOL fabricEnabled);
|
|
17
17
|
|
|
18
18
|
EX_EXTERN_C_END
|
|
@@ -8,12 +8,18 @@
|
|
|
8
8
|
#import <React/RCTAppSetupUtils.h>
|
|
9
9
|
#endif
|
|
10
10
|
|
|
11
|
-
UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties)
|
|
11
|
+
UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties, BOOL fabricEnabled)
|
|
12
12
|
{
|
|
13
13
|
#if __has_include(<React/RCTAppSetupUtils.h>)
|
|
14
|
+
|
|
15
|
+
#if REACT_NATIVE_MINOR_VERSION >= 71
|
|
16
|
+
return RCTAppSetupDefaultRootView(bridge, moduleName, initialProperties, fabricEnabled);
|
|
17
|
+
#else
|
|
14
18
|
return RCTAppSetupDefaultRootView(bridge, moduleName, initialProperties);
|
|
19
|
+
#endif // REACT_NATIVE_MINOR_VERSION >= 71
|
|
20
|
+
|
|
15
21
|
#else
|
|
16
22
|
return [[RCTRootView alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
|
|
17
|
-
#endif
|
|
23
|
+
#endif // __has_include(<React/RCTAppSetupUtils.h>)
|
|
18
24
|
}
|
|
19
25
|
|
|
@@ -18,6 +18,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
18
18
|
moduleName:(NSString *)moduleName
|
|
19
19
|
initialProperties:(nullable NSDictionary *)initialProperties;
|
|
20
20
|
|
|
21
|
+
- (RCTRootView *)createRootViewWithBridge:(RCTBridge *)bridge
|
|
22
|
+
moduleName:(NSString *)moduleName
|
|
23
|
+
initialProperties:(nullable NSDictionary *)initialProperties
|
|
24
|
+
fabricEnabled:(BOOL)fabricEnabled;
|
|
25
|
+
|
|
21
26
|
- (UIViewController *)createRootViewController;
|
|
22
27
|
|
|
23
28
|
@end
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
3
|
#import <ExpoModulesCore/EXReactDelegateWrapper.h>
|
|
4
|
+
|
|
5
|
+
#import <ExpoModulesCore/EXAppDefines.h>
|
|
4
6
|
#import <ExpoModulesCore/EXReactDelegateWrapper+Private.h>
|
|
5
7
|
|
|
6
8
|
@interface EXReactDelegateWrapper()
|
|
@@ -29,7 +31,18 @@
|
|
|
29
31
|
moduleName:(NSString *)moduleName
|
|
30
32
|
initialProperties:(nullable NSDictionary *)initialProperties
|
|
31
33
|
{
|
|
32
|
-
return [_expoReactDelegate createRootViewWithBridge:bridge
|
|
34
|
+
return [_expoReactDelegate createRootViewWithBridge:bridge
|
|
35
|
+
moduleName:moduleName
|
|
36
|
+
initialProperties:initialProperties
|
|
37
|
+
fabricEnabled:EXAppDefines.APP_NEW_ARCH_ENABLED];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
- (RCTRootView *)createRootViewWithBridge:(RCTBridge *)bridge
|
|
41
|
+
moduleName:(NSString *)moduleName
|
|
42
|
+
initialProperties:(nullable NSDictionary *)initialProperties
|
|
43
|
+
fabricEnabled:(BOOL)fabricEnabled
|
|
44
|
+
{
|
|
45
|
+
return [_expoReactDelegate createRootViewWithBridge:bridge moduleName:moduleName initialProperties:initialProperties fabricEnabled:fabricEnabled];
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
- (UIViewController *)createRootViewController
|