@10play/expo-air 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/expo/modules/expoair/ExpoAirModule.kt +0 -40
- package/build/ExpoAir.types.d.ts +0 -11
- package/build/ExpoAir.types.d.ts.map +1 -1
- package/build/ExpoAir.types.js.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/ios/ExpoAirModule.swift +0 -9
- package/ios/WidgetBridge.mm +1 -6
- package/package.json +1 -1
- package/android/src/main/java/expo/modules/expoair/ExpoAirView.kt +0 -30
- package/build/ExpoAirView.d.ts +0 -4
- package/build/ExpoAirView.d.ts.map +0 -1
- package/build/ExpoAirView.js +0 -7
- package/build/ExpoAirView.js.map +0 -1
- package/build/ExpoAirView.web.d.ts +0 -4
- package/build/ExpoAirView.web.d.ts.map +0 -1
- package/build/ExpoAirView.web.js +0 -7
- package/build/ExpoAirView.web.js.map +0 -1
- package/ios/ExpoAirView.swift +0 -38
|
@@ -2,49 +2,9 @@ package expo.modules.expoair
|
|
|
2
2
|
|
|
3
3
|
import expo.modules.kotlin.modules.Module
|
|
4
4
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
-
import java.net.URL
|
|
6
5
|
|
|
7
6
|
class ExpoAirModule : Module() {
|
|
8
|
-
// Each module class must implement the definition function. The definition consists of components
|
|
9
|
-
// that describes the module's functionality and behavior.
|
|
10
|
-
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
11
7
|
override fun definition() = ModuleDefinition {
|
|
12
|
-
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
|
|
13
|
-
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
|
|
14
|
-
// The module will be accessible from `requireNativeModule('ExpoAir')` in JavaScript.
|
|
15
8
|
Name("ExpoAir")
|
|
16
|
-
|
|
17
|
-
// Defines constant property on the module.
|
|
18
|
-
Constant("PI") {
|
|
19
|
-
Math.PI
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Defines event names that the module can send to JavaScript.
|
|
23
|
-
Events("onChange")
|
|
24
|
-
|
|
25
|
-
// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
|
|
26
|
-
Function("hello") {
|
|
27
|
-
"Hello world! 👋"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Defines a JavaScript function that always returns a Promise and whose native code
|
|
31
|
-
// is by default dispatched on the different thread than the JavaScript runtime runs on.
|
|
32
|
-
AsyncFunction("setValueAsync") { value: String ->
|
|
33
|
-
// Send an event to JavaScript.
|
|
34
|
-
sendEvent("onChange", mapOf(
|
|
35
|
-
"value" to value
|
|
36
|
-
))
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Enables the module to be used as a native view. Definition components that are accepted as part of
|
|
40
|
-
// the view definition: Prop, Events.
|
|
41
|
-
View(ExpoAirView::class) {
|
|
42
|
-
// Defines a setter for the `url` prop.
|
|
43
|
-
Prop("url") { view: ExpoAirView, url: URL ->
|
|
44
|
-
view.webView.loadUrl(url.toString())
|
|
45
|
-
}
|
|
46
|
-
// Defines an event that the view can send to JavaScript.
|
|
47
|
-
Events("onLoad")
|
|
48
|
-
}
|
|
49
9
|
}
|
|
50
10
|
}
|
package/build/ExpoAir.types.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { StyleProp, ViewStyle } from "react-native";
|
|
2
|
-
export type OnLoadEventPayload = {
|
|
3
|
-
url: string;
|
|
4
|
-
};
|
|
5
1
|
export type ExpoAirModuleEvents = {
|
|
6
2
|
onChange: (params: ChangeEventPayload) => void;
|
|
7
3
|
onPress: () => void;
|
|
@@ -15,11 +11,4 @@ export type ExpoAirModuleEvents = {
|
|
|
15
11
|
export type ChangeEventPayload = {
|
|
16
12
|
value: string;
|
|
17
13
|
};
|
|
18
|
-
export type ExpoAirViewProps = {
|
|
19
|
-
url: string;
|
|
20
|
-
onLoad: (event: {
|
|
21
|
-
nativeEvent: OnLoadEventPayload;
|
|
22
|
-
}) => void;
|
|
23
|
-
style?: StyleProp<ViewStyle>;
|
|
24
|
-
};
|
|
25
14
|
//# sourceMappingURL=ExpoAir.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAir.types.d.ts","sourceRoot":"","sources":["../src/ExpoAir.types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ExpoAir.types.d.ts","sourceRoot":"","sources":["../src/ExpoAir.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,EAAE,CAAC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAir.types.js","sourceRoot":"","sources":["../src/ExpoAir.types.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"ExpoAir.types.js","sourceRoot":"","sources":["../src/ExpoAir.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ExpoAirModuleEvents = {\n onChange: (params: ChangeEventPayload) => void;\n onPress: () => void;\n onExpand: () => void;\n onCollapse: () => void;\n onDragEnd: (params: { x: number; y: number }) => void;\n};\n\nexport type ChangeEventPayload = {\n value: string;\n};\n"]}
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,cAAc,iBAAiB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Reexport the native module. On web, it will be resolved to ExpoAirModule.web.ts
|
|
2
2
|
// and on native platforms to ExpoAirModule.ts
|
|
3
3
|
export { default } from "./ExpoAirModule";
|
|
4
|
-
export { default as ExpoAirView } from "./ExpoAirView";
|
|
5
4
|
export * from "./ExpoAir.types";
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,8CAA8C;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,8CAA8C;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,cAAc,iBAAiB,CAAC","sourcesContent":["// Reexport the native module. On web, it will be resolved to ExpoAirModule.web.ts\n// and on native platforms to ExpoAirModule.ts\nexport { default } from \"./ExpoAirModule\";\nexport * from \"./ExpoAir.types\";\n"]}
|
package/ios/ExpoAirModule.swift
CHANGED
|
@@ -109,14 +109,5 @@ public class ExpoAirModule: Module {
|
|
|
109
109
|
#endif
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
View(ExpoAirView.self) {
|
|
113
|
-
Prop("url") { (view: ExpoAirView, url: URL) in
|
|
114
|
-
if view.webView.url != url {
|
|
115
|
-
view.webView.load(URLRequest(url: url))
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
Events("onLoad")
|
|
120
|
-
}
|
|
121
112
|
}
|
|
122
113
|
}
|
package/ios/WidgetBridge.mm
CHANGED
|
@@ -172,12 +172,7 @@ RCT_EXPORT_METHOD(requestPushToken:(RCTPromiseResolveBlock)resolve
|
|
|
172
172
|
NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier];
|
|
173
173
|
|
|
174
174
|
// Get EAS project ID from expo config (stored in Info.plist by expo prebuild)
|
|
175
|
-
NSString *projectId =
|
|
176
|
-
NSDictionary *expoConfig = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"EXUpdatesRuntimeVersion"];
|
|
177
|
-
if (!projectId) {
|
|
178
|
-
// Try getting from EASProjectId
|
|
179
|
-
projectId = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"EASProjectID"];
|
|
180
|
-
}
|
|
175
|
+
NSString *projectId = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"EASProjectID"];
|
|
181
176
|
if (!projectId) {
|
|
182
177
|
// Fallback: use bundle ID as experience ID format
|
|
183
178
|
projectId = bundleId;
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
package expo.modules.expoair
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import android.webkit.WebView
|
|
5
|
-
import android.webkit.WebViewClient
|
|
6
|
-
import expo.modules.kotlin.AppContext
|
|
7
|
-
import expo.modules.kotlin.viewevent.EventDispatcher
|
|
8
|
-
import expo.modules.kotlin.views.ExpoView
|
|
9
|
-
|
|
10
|
-
class ExpoAirView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
|
|
11
|
-
// Creates and initializes an event dispatcher for the `onLoad` event.
|
|
12
|
-
// The name of the event is inferred from the value and needs to match the event name defined in the module.
|
|
13
|
-
private val onLoad by EventDispatcher()
|
|
14
|
-
|
|
15
|
-
// Defines a WebView that will be used as the root subview.
|
|
16
|
-
internal val webView = WebView(context).apply {
|
|
17
|
-
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
|
18
|
-
webViewClient = object : WebViewClient() {
|
|
19
|
-
override fun onPageFinished(view: WebView, url: String) {
|
|
20
|
-
// Sends an event to JavaScript. Triggers a callback defined on the view component in JavaScript.
|
|
21
|
-
onLoad(mapOf("url" to url))
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
init {
|
|
27
|
-
// Adds the WebView to the view hierarchy.
|
|
28
|
-
addView(webView)
|
|
29
|
-
}
|
|
30
|
-
}
|
package/build/ExpoAirView.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAirView.d.ts","sourceRoot":"","sources":["../src/ExpoAirView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAKnD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,EAAE,gBAAgB,qBAE1D"}
|
package/build/ExpoAirView.js
DELETED
package/build/ExpoAirView.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAirView.js","sourceRoot":"","sources":["../src/ExpoAirView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,UAAU,GACd,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAuB;IACzD,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC","sourcesContent":["import { requireNativeView } from \"expo\";\nimport * as React from \"react\";\n\nimport { ExpoAirViewProps } from \"./ExpoAir.types\";\n\nconst NativeView: React.ComponentType<ExpoAirViewProps> =\n requireNativeView(\"ExpoAir\");\n\nexport default function ExpoAirView(props: ExpoAirViewProps) {\n return <NativeView {...props} />;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAirView.web.d.ts","sourceRoot":"","sources":["../src/ExpoAirView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,EAAE,gBAAgB,qBAU1D"}
|
package/build/ExpoAirView.web.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
export default function ExpoAirView(props) {
|
|
3
|
-
return (<div>
|
|
4
|
-
<iframe style={{ flex: 1 }} src={props.url} onLoad={() => props.onLoad({ nativeEvent: { url: props.url } })}/>
|
|
5
|
-
</div>);
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=ExpoAirView.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAirView.web.js","sourceRoot":"","sources":["../src/ExpoAirView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAuB;IACzD,OAAO,CACL,CAAC,GAAG,CACF;MAAA,CAAC,MAAM,CACL,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CACnB,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CACf,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAEpE;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"react\";\n\nimport { ExpoAirViewProps } from \"./ExpoAir.types\";\n\nexport default function ExpoAirView(props: ExpoAirViewProps) {\n return (\n <div>\n <iframe\n style={{ flex: 1 }}\n src={props.url}\n onLoad={() => props.onLoad({ nativeEvent: { url: props.url } })}\n />\n </div>\n );\n}\n"]}
|
package/ios/ExpoAirView.swift
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import ExpoModulesCore
|
|
2
|
-
import WebKit
|
|
3
|
-
|
|
4
|
-
// This view will be used as a native component. Make sure to inherit from `ExpoView`
|
|
5
|
-
// to apply the proper styling (e.g. border radius and shadows).
|
|
6
|
-
class ExpoAirView: ExpoView {
|
|
7
|
-
let webView = WKWebView()
|
|
8
|
-
let onLoad = EventDispatcher()
|
|
9
|
-
var delegate: WebViewDelegate?
|
|
10
|
-
|
|
11
|
-
required init(appContext: AppContext? = nil) {
|
|
12
|
-
super.init(appContext: appContext)
|
|
13
|
-
clipsToBounds = true
|
|
14
|
-
delegate = WebViewDelegate { url in
|
|
15
|
-
self.onLoad(["url": url])
|
|
16
|
-
}
|
|
17
|
-
webView.navigationDelegate = delegate
|
|
18
|
-
addSubview(webView)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
override func layoutSubviews() {
|
|
22
|
-
webView.frame = bounds
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
class WebViewDelegate: NSObject, WKNavigationDelegate {
|
|
27
|
-
let onUrlChange: (String) -> Void
|
|
28
|
-
|
|
29
|
-
init(onUrlChange: @escaping (String) -> Void) {
|
|
30
|
-
self.onUrlChange = onUrlChange
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) {
|
|
34
|
-
if let url = webView.url {
|
|
35
|
-
onUrlChange(url.absoluteString)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|