expo-modules-core 0.8.0 → 0.9.2
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 +22 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +11 -0
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +127 -18
- package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +210 -26
- package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinitionBuilder.kt +55 -5
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +43 -5
- package/ios/NativeModulesProxy/EXNativeModulesProxy.mm +3 -0
- package/ios/Swift/AppContext.swift +1 -8
- package/ios/Swift/Arguments/AnyArgumentType.swift +1 -1
- package/ios/Swift/Functions/AnyFunction.swift +5 -0
- package/ios/Swift/Functions/AsyncFunctionComponent.swift +182 -0
- package/ios/Swift/Functions/ConcreteFunction.swift +34 -67
- package/ios/Swift/Functions/SyncFunctionComponent.swift +181 -0
- package/ios/Swift/JavaScriptUtils.swift +51 -6
- package/ios/Swift/ModuleHolder.swift +11 -10
- package/ios/Swift/Modules/ModuleDefinitionComponents.swift +66 -44
- package/ios/Swift/Objects/ObjectDefinitionComponents.swift +45 -172
- package/ios/Swift/Views/ViewManagerDefinitionComponents.swift +23 -0
- package/ios/Tests/ConstantsSpec.swift +4 -4
- package/ios/Tests/ExpoModulesSpec.swift +3 -4
- package/ios/Tests/FunctionSpec.swift +11 -12
- package/ios/Tests/FunctionWithConvertiblesSpec.swift +2 -2
- package/ios/Tests/ModuleEventListenersSpec.swift +13 -13
- package/package.json +2 -2
- package/ios/Swift/Functions/AsyncFunction.swift +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,28 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.9.2 — 2022-05-09
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fix view props weren't recognized in the bare workflow on iOS. ([#17411](https://github.com/expo/expo/pull/17411) by [@lukmccall](https://github.com/lukmccall))
|
|
18
|
+
|
|
19
|
+
## 0.9.1 — 2022-05-05
|
|
20
|
+
|
|
21
|
+
### 🐛 Bug fixes
|
|
22
|
+
|
|
23
|
+
- Fix modules have not been deallocated during the application reload on iOS. ([#17285](https://github.com/expo/expo/pull/17285) by [@lukmccall](https://github.com/lukmccall))
|
|
24
|
+
|
|
25
|
+
## 0.9.0 — 2022-04-21
|
|
26
|
+
|
|
27
|
+
### ⚠️ Notices
|
|
28
|
+
|
|
29
|
+
- Renamed all definition components to start with the uppercase letter. The old names will be removed in the next minor release. ([#17153](https://github.com/expo/expo/pull/17153) by [@lukmccall](https://github.com/lukmccall), [#17098](https://github.com/expo/expo/pull/17098) by [@tsapeta](https://github.com/tsapeta))
|
|
30
|
+
|
|
31
|
+
### 🎉 New features
|
|
32
|
+
|
|
33
|
+
- Add `ReactNativeHostHandler.getUseDeveloperSupport()` to allow `expo-dev-launcher` to override this value at runtime. ([#17069](https://github.com/expo/expo/pull/17069) by [@esamelson](https://github.com/esamelson))
|
|
34
|
+
|
|
13
35
|
## 0.8.0 — 2022-04-18
|
|
14
36
|
|
|
15
37
|
### 🛠 Breaking changes
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '0.
|
|
6
|
+
version = '0.9.2'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -75,7 +75,7 @@ android {
|
|
|
75
75
|
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
76
76
|
consumerProguardFiles 'proguard-rules.pro'
|
|
77
77
|
versionCode 1
|
|
78
|
-
versionName "0.
|
|
78
|
+
versionName "0.9.2"
|
|
79
79
|
}
|
|
80
80
|
lintOptions {
|
|
81
81
|
abortOnError false
|
|
@@ -43,6 +43,17 @@ public interface ReactNativeHostHandler {
|
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Give modules a chance to override the value for useDeveloperSupport,
|
|
48
|
+
* e.g. for expo-dev-launcher
|
|
49
|
+
*
|
|
50
|
+
* @return value for useDeveloperSupport, or null if not to override
|
|
51
|
+
*/
|
|
52
|
+
@Nullable
|
|
53
|
+
default Boolean getUseDeveloperSupport() {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
/**
|
|
47
58
|
* Given chance for modules to override react dev support manager factory.
|
|
48
59
|
* e.g. for expo-dev-client
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@file:OptIn(ExperimentalStdlibApi::class)
|
|
2
|
+
@file:Suppress("FunctionName")
|
|
2
3
|
|
|
3
4
|
package expo.modules.kotlin.functions
|
|
4
5
|
|
|
@@ -9,39 +10,93 @@ class AsyncFunctionBuilder(val name: String) {
|
|
|
9
10
|
@PublishedApi
|
|
10
11
|
internal var function: AnyFunction? = null
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
@Deprecated(
|
|
14
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
15
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
16
|
+
)
|
|
17
|
+
inline fun <reified R> suspendBody(crossinline block: suspend () -> R) = SuspendBody(block)
|
|
18
|
+
|
|
19
|
+
inline fun <reified R> SuspendBody(crossinline block: suspend () -> R) {
|
|
13
20
|
function = AsyncSuspendFunction(name, arrayOf()) { block() }
|
|
14
21
|
}
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
@Deprecated(
|
|
24
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
25
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
26
|
+
)
|
|
27
|
+
inline fun <reified R, reified P0> suspendBody(crossinline block: suspend (p0: P0) -> R) = SuspendBody(block)
|
|
28
|
+
|
|
29
|
+
inline fun <reified R, reified P0> SuspendBody(crossinline block: suspend (p0: P0) -> R) {
|
|
17
30
|
function = AsyncSuspendFunction(name, arrayOf(typeOf<P0>().toAnyType())) { block(it[0] as P0) }
|
|
18
31
|
}
|
|
19
32
|
|
|
20
|
-
|
|
33
|
+
@Deprecated(
|
|
34
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
35
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
36
|
+
)
|
|
37
|
+
inline fun <reified R, reified P0, reified P1> suspendBody(crossinline block: suspend (p0: P0, p1: P1) -> R) = SuspendBody(block)
|
|
38
|
+
|
|
39
|
+
inline fun <reified R, reified P0, reified P1> SuspendBody(crossinline block: suspend (p0: P0, p1: P1) -> R) {
|
|
21
40
|
function = AsyncSuspendFunction(name, arrayOf(typeOf<P0>().toAnyType())) { block(it[0] as P0, it[0] as P1) }
|
|
22
41
|
}
|
|
23
42
|
|
|
24
|
-
|
|
43
|
+
@Deprecated(
|
|
44
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
45
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
46
|
+
)
|
|
47
|
+
inline fun <reified R, reified P0, reified P1, reified P2> suspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2) -> R) = SuspendBody(block)
|
|
48
|
+
|
|
49
|
+
inline fun <reified R, reified P0, reified P1, reified P2> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2) -> R) {
|
|
25
50
|
function = AsyncSuspendFunction(name, arrayOf(typeOf<P0>().toAnyType())) { block(it[0] as P0, it[1] as P1, it[2] as P2) }
|
|
26
51
|
}
|
|
27
52
|
|
|
28
|
-
|
|
53
|
+
@Deprecated(
|
|
54
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
55
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
56
|
+
)
|
|
57
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> suspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3) -> R) = SuspendBody(block)
|
|
58
|
+
|
|
59
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3) -> R) {
|
|
29
60
|
function = AsyncSuspendFunction(name, arrayOf(typeOf<P0>().toAnyType())) { block(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3) }
|
|
30
61
|
}
|
|
31
62
|
|
|
32
|
-
|
|
63
|
+
@Deprecated(
|
|
64
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
65
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
66
|
+
)
|
|
67
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> suspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R) = SuspendBody(block)
|
|
68
|
+
|
|
69
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R) {
|
|
33
70
|
function = AsyncSuspendFunction(name, arrayOf(typeOf<P0>().toAnyType())) { block(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4) }
|
|
34
71
|
}
|
|
35
72
|
|
|
36
|
-
|
|
73
|
+
@Deprecated(
|
|
74
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
75
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
76
|
+
)
|
|
77
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> suspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R) = SuspendBody(block)
|
|
78
|
+
|
|
79
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R) {
|
|
37
80
|
function = AsyncSuspendFunction(name, arrayOf(typeOf<P0>().toAnyType())) { block(it[0] as P0, it[1] as P1, it[2] as P2, it[3] as P3, it[4] as P4, it[5] as P5) }
|
|
38
81
|
}
|
|
39
82
|
|
|
40
|
-
|
|
83
|
+
@Deprecated(
|
|
84
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
85
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
86
|
+
)
|
|
87
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> suspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R) = SuspendBody(block)
|
|
88
|
+
|
|
89
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R) {
|
|
41
90
|
function = AsyncSuspendFunction(name, arrayOf(typeOf<P0>().toAnyType())) { block(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) }
|
|
42
91
|
}
|
|
43
92
|
|
|
44
|
-
|
|
93
|
+
@Deprecated(
|
|
94
|
+
message = "The 'suspendBody' component was renamed to 'SuspendBody'.",
|
|
95
|
+
replaceWith = ReplaceWith("SuspendBody(block)")
|
|
96
|
+
)
|
|
97
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> suspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R) = SuspendBody(block)
|
|
98
|
+
|
|
99
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R) {
|
|
45
100
|
function = AsyncSuspendFunction(name, arrayOf(typeOf<P0>().toAnyType())) { block(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) }
|
|
46
101
|
}
|
|
47
102
|
|
|
@@ -50,12 +105,66 @@ class AsyncFunctionBuilder(val name: String) {
|
|
|
50
105
|
}
|
|
51
106
|
}
|
|
52
107
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
inline infix fun <reified R
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
108
|
+
@Deprecated(
|
|
109
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
110
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
111
|
+
)
|
|
112
|
+
inline infix fun <reified R> AsyncFunctionBuilder.coroutine(crossinline block: suspend () -> R) = Coroutine(block)
|
|
113
|
+
|
|
114
|
+
@Deprecated(
|
|
115
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
116
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
117
|
+
)
|
|
118
|
+
inline infix fun <reified R, reified P0> AsyncFunctionBuilder.coroutine(crossinline block: suspend (P0) -> R) = Coroutine(block)
|
|
119
|
+
|
|
120
|
+
@Deprecated(
|
|
121
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
122
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
123
|
+
)
|
|
124
|
+
inline infix fun <reified R, reified P0, reified P1> AsyncFunctionBuilder.coroutine(crossinline block: suspend (P0, P1) -> R) = Coroutine(block)
|
|
125
|
+
|
|
126
|
+
@Deprecated(
|
|
127
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
128
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
129
|
+
)
|
|
130
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2> AsyncFunctionBuilder.coroutine(crossinline block: suspend (P0, P1, P2) -> R) = Coroutine(block)
|
|
131
|
+
|
|
132
|
+
@Deprecated(
|
|
133
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
134
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
135
|
+
)
|
|
136
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3> AsyncFunctionBuilder.coroutine(crossinline block: suspend (P0, P1, P2, P3) -> R) = Coroutine(block)
|
|
137
|
+
|
|
138
|
+
@Deprecated(
|
|
139
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
140
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
141
|
+
)
|
|
142
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> AsyncFunctionBuilder.coroutine(crossinline block: suspend (P0, P1, P2, P3, P4) -> R) = Coroutine(block)
|
|
143
|
+
|
|
144
|
+
@Deprecated(
|
|
145
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
146
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
147
|
+
)
|
|
148
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> AsyncFunctionBuilder.coroutine(crossinline block: suspend (P0, P1, P2, P3, P4, P5) -> R) = Coroutine(block)
|
|
149
|
+
|
|
150
|
+
@Deprecated(
|
|
151
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
152
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
153
|
+
)
|
|
154
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> AsyncFunctionBuilder.coroutine(crossinline block: suspend (P0, P1, P2, P3, P4, P5, P6) -> R) = Coroutine(block)
|
|
155
|
+
|
|
156
|
+
@Deprecated(
|
|
157
|
+
message = "The 'coroutine' component was renamed to 'Coroutine'.",
|
|
158
|
+
replaceWith = ReplaceWith("Coroutine(block)")
|
|
159
|
+
)
|
|
160
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> AsyncFunctionBuilder.coroutine(crossinline block: suspend (P0, P1, P2, P3, P4, P5, P6, P7) -> R) = Coroutine(block)
|
|
161
|
+
|
|
162
|
+
inline infix fun <reified R> AsyncFunctionBuilder.Coroutine(crossinline block: suspend () -> R) = SuspendBody(block)
|
|
163
|
+
inline infix fun <reified R, reified P0> AsyncFunctionBuilder.Coroutine(crossinline block: suspend (P0) -> R) = SuspendBody(block)
|
|
164
|
+
inline infix fun <reified R, reified P0, reified P1> AsyncFunctionBuilder.Coroutine(crossinline block: suspend (P0, P1) -> R) = SuspendBody(block)
|
|
165
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2> AsyncFunctionBuilder.Coroutine(crossinline block: suspend (P0, P1, P2) -> R) = SuspendBody(block)
|
|
166
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3> AsyncFunctionBuilder.Coroutine(crossinline block: suspend (P0, P1, P2, P3) -> R) = SuspendBody(block)
|
|
167
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> AsyncFunctionBuilder.Coroutine(crossinline block: suspend (P0, P1, P2, P3, P4) -> R) = SuspendBody(block)
|
|
168
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> AsyncFunctionBuilder.Coroutine(crossinline block: suspend (P0, P1, P2, P3, P4, P5) -> R) = SuspendBody(block)
|
|
169
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> AsyncFunctionBuilder.Coroutine(crossinline block: suspend (P0, P1, P2, P3, P4, P5, P6) -> R) = SuspendBody(block)
|
|
170
|
+
inline infix fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> AsyncFunctionBuilder.Coroutine(crossinline block: suspend (P0, P1, P2, P3, P4, P5, P6, P7) -> R) = SuspendBody(block)
|