haya-select 1.0.62 → 1.0.64

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/.eslintrc.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['universe/native', 'universe/web'],
4
+ ignorePatterns: ['build'],
5
+ };
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # haya-select
2
+
3
+ Just another select component for React Native + Web.
4
+
5
+ # API documentation
6
+
7
+ - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/haya-select/)
8
+ - [Documentation for the main branch](https://docs.expo.dev/versions/unversioned/sdk/haya-select/)
9
+
10
+ # Installation in managed Expo projects
11
+
12
+ For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
13
+
14
+ # Installation in bare React Native projects
15
+
16
+ For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
17
+
18
+ ### Add the package to your npm dependencies
19
+
20
+ ```
21
+ npm install haya-select
22
+ ```
23
+
24
+ ### Configure for Android
25
+
26
+
27
+
28
+
29
+ ### Configure for iOS
30
+
31
+ Run `npx pod-install` after installing the npm package.
32
+
33
+ # Contributing
34
+
35
+ Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).
@@ -0,0 +1,43 @@
1
+ apply plugin: 'com.android.library'
2
+
3
+ group = 'expo.modules.hayaselect'
4
+ version = '0.1.0'
5
+
6
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
+ apply from: expoModulesCorePlugin
8
+ applyKotlinExpoModulesCorePlugin()
9
+ useCoreDependencies()
10
+ useExpoPublishing()
11
+
12
+ // If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
13
+ // The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
14
+ // Most of the time, you may like to manage the Android SDK versions yourself.
15
+ def useManagedAndroidSdkVersions = false
16
+ if (useManagedAndroidSdkVersions) {
17
+ useDefaultAndroidSdkVersions()
18
+ } else {
19
+ buildscript {
20
+ // Simple helper that allows the root project to override versions declared by this library.
21
+ ext.safeExtGet = { prop, fallback ->
22
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
+ }
24
+ }
25
+ project.android {
26
+ compileSdkVersion safeExtGet("compileSdkVersion", 34)
27
+ defaultConfig {
28
+ minSdkVersion safeExtGet("minSdkVersion", 21)
29
+ targetSdkVersion safeExtGet("targetSdkVersion", 34)
30
+ }
31
+ }
32
+ }
33
+
34
+ android {
35
+ namespace "expo.modules.hayaselect"
36
+ defaultConfig {
37
+ versionCode 1
38
+ versionName "0.1.0"
39
+ }
40
+ lintOptions {
41
+ abortOnError false
42
+ }
43
+ }
@@ -0,0 +1,2 @@
1
+ <manifest>
2
+ </manifest>
@@ -0,0 +1,50 @@
1
+ package expo.modules.hayaselect
2
+
3
+ import expo.modules.kotlin.modules.Module
4
+ import expo.modules.kotlin.modules.ModuleDefinition
5
+ import java.net.URL
6
+
7
+ class HayaSelectModule : 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
+ 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('HayaSelect')` in JavaScript.
15
+ Name("HayaSelect")
16
+
17
+ // Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
18
+ Constants(
19
+ "PI" to 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(HayaSelectView::class) {
42
+ // Defines a setter for the `url` prop.
43
+ Prop("url") { view: HayaSelectView, 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
+ }
50
+ }
@@ -0,0 +1,30 @@
1
+ package expo.modules.hayaselect
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 HayaSelectView(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
+ }
@@ -0,0 +1,8 @@
1
+ export default configuration;
2
+ declare const configuration: HayaSelectConfiguration;
3
+ declare class HayaSelectConfiguration {
4
+ getBodyPortal(): any;
5
+ setBodyPortal(newBodyPortal: any): void;
6
+ _bodyPortal: any;
7
+ }
8
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.js"],"names":[],"mappings":";AAYA,qDAAmD;AAZnD;IACE,qBAIC;IAED,wCAEC;IADC,iBAAgC;CAEnC"}
@@ -0,0 +1,13 @@
1
+ class HayaSelectConfiguration {
2
+ getBodyPortal() {
3
+ if (!this._bodyPortal)
4
+ throw new Error("bodyPortal wasn't set");
5
+ return this._bodyPortal;
6
+ }
7
+ setBodyPortal(newBodyPortal) {
8
+ this._bodyPortal = newBodyPortal;
9
+ }
10
+ }
11
+ const configuration = new HayaSelectConfiguration();
12
+ export default configuration;
13
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.js"],"names":[],"mappings":"AAAA,MAAM,uBAAuB;IAC3B,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;QAE/D,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED,aAAa,CAAC,aAAa;QACzB,IAAI,CAAC,WAAW,GAAG,aAAa,CAAA;IAClC,CAAC;CACF;AAED,MAAM,aAAa,GAAG,IAAI,uBAAuB,EAAE,CAAA;AAEnD,eAAe,aAAa,CAAA","sourcesContent":["class HayaSelectConfiguration {\n getBodyPortal() {\n if (!this._bodyPortal) throw new Error(\"bodyPortal wasn't set\")\n\n return this._bodyPortal\n }\n\n setBodyPortal(newBodyPortal) {\n this._bodyPortal = newBodyPortal\n }\n}\n\nconst configuration = new HayaSelectConfiguration()\n\nexport default configuration\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("react").MemoExoticComponent<any>;
2
+ export default _default;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/select/index.jsx"],"names":[],"mappings":""}