haya-select 1.0.78 → 1.0.80

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.
@@ -1,48 +0,0 @@
1
- import ExpoModulesCore
2
-
3
- public class HayaSelectModule: Module {
4
- // Each module class must implement the definition function. The definition consists of components
5
- // that describes the module's functionality and behavior.
6
- // See https://docs.expo.dev/modules/module-api for more details about available components.
7
- public func definition() -> ModuleDefinition {
8
- // Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
9
- // Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
10
- // The module will be accessible from `requireNativeModule('HayaSelect')` in JavaScript.
11
- Name("HayaSelect")
12
-
13
- // Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
14
- Constants([
15
- "PI": Double.pi
16
- ])
17
-
18
- // Defines event names that the module can send to JavaScript.
19
- Events("onChange")
20
-
21
- // Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
22
- Function("hello") {
23
- return "Hello world! 👋"
24
- }
25
-
26
- // Defines a JavaScript function that always returns a Promise and whose native code
27
- // is by default dispatched on the different thread than the JavaScript runtime runs on.
28
- AsyncFunction("setValueAsync") { (value: String) in
29
- // Send an event to JavaScript.
30
- self.sendEvent("onChange", [
31
- "value": value
32
- ])
33
- }
34
-
35
- // Enables the module to be used as a native view. Definition components that are accepted as part of the
36
- // view definition: Prop, Events.
37
- View(HayaSelectView.self) {
38
- // Defines a setter for the `url` prop.
39
- Prop("url") { (view: HayaSelectView, url: URL) in
40
- if view.webView.url != url {
41
- view.webView.load(URLRequest(url: url))
42
- }
43
- }
44
-
45
- Events("onLoad")
46
- }
47
- }
48
- }
@@ -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 HayaSelectView: 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
- }
package/src/config.js DELETED
@@ -1,40 +0,0 @@
1
- const shared = {}
2
-
3
- const t = (msgID) => {
4
- if (!shared._translateWarning) {
5
- shared._translateWarning = true
6
- console.log("HayaSelect: Translate method not set")
7
- }
8
-
9
- return msgID
10
- }
11
-
12
- const useTranslateFallback = () => ({t})
13
-
14
- class HayaSelectConfiguration {
15
- _useTranslate = useTranslateFallback
16
-
17
- getBodyPortal() {
18
- if (!this._bodyPortal) throw new Error("bodyPortal wasn't set")
19
-
20
- return this._bodyPortal
21
- }
22
-
23
- getUseTranslate() {
24
- return this._useTranslate
25
- }
26
-
27
- setBodyPortal(newBodyPortal) {
28
- this._bodyPortal = newBodyPortal
29
- }
30
-
31
- setUseTranslate(callback) {
32
- this._useTranslate = callback
33
- }
34
- }
35
-
36
- if (!globalThis.hayaSelectConfig) {
37
- globalThis.hayaSelectConfig = new HayaSelectConfiguration()
38
- }
39
-
40
- export default globalThis.hayaSelectConfig