react-native-nitro-country-picker 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -61,6 +61,12 @@ or
61
61
  yarn add react-native-nitro-country-picker react-native-nitro-modules
62
62
  ```
63
63
 
64
+ or
65
+
66
+ ```bash
67
+ pnpm add react-native-nitro-country-picker react-native-nitro-modules
68
+ ```
69
+
64
70
  ### iOS Setup
65
71
 
66
72
  ```bash
@@ -183,10 +189,10 @@ To run the included example app:
183
189
 
184
190
  ```bash
185
191
  cd example
186
- yarn install
187
- yarn ios
192
+ pnpm install
193
+ pnpm ios
188
194
  # or
189
- yarn android
195
+ pnpm android
190
196
  ```
191
197
 
192
198
  ---
@@ -10,7 +10,7 @@ buildscript {
10
10
  }
11
11
 
12
12
  dependencies {
13
- classpath "com.android.tools.build:gradle:8.7.2"
13
+ classpath "com.android.tools.build:gradle:8.12.0"
14
14
  // noinspection DifferentKotlinGradleVersion
15
15
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
16
16
  classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
@@ -36,11 +36,11 @@ def getExtOrIntegerDefault(name) {
36
36
  android {
37
37
  namespace "com.margelo.nitro.nitrocountrypicker"
38
38
 
39
- compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
39
+ compileSdk getExtOrIntegerDefault("compileSdkVersion")
40
40
 
41
41
  defaultConfig {
42
- minSdkVersion getExtOrIntegerDefault("minSdkVersion")
43
- targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
42
+ minSdk getExtOrIntegerDefault("minSdkVersion")
43
+ targetSdk getExtOrIntegerDefault("targetSdkVersion")
44
44
 
45
45
  externalNativeBuild {
46
46
  cmake {
@@ -66,25 +66,27 @@ android {
66
66
  }
67
67
  }
68
68
 
69
- packagingOptions {
70
- excludes = [
71
- "META-INF",
72
- "META-INF/**",
73
- "**/libc++_shared.so",
74
- "**/libfbjni.so",
75
- "**/libjsi.so",
76
- "**/libfolly_json.so",
77
- "**/libfolly_runtime.so",
78
- "**/libglog.so",
79
- "**/libhermes.so",
80
- "**/libhermes-executor-debug.so",
81
- "**/libhermes_executor.so",
82
- "**/libreactnative.so",
83
- "**/libreactnativejni.so",
84
- "**/libturbomodulejsijni.so",
85
- "**/libreact_nativemodule_core.so",
86
- "**/libjscexecutor.so"
87
- ]
69
+ packaging {
70
+ resources {
71
+ excludes += [
72
+ "META-INF",
73
+ "META-INF/**",
74
+ "**/libc++_shared.so",
75
+ "**/libfbjni.so",
76
+ "**/libjsi.so",
77
+ "**/libfolly_json.so",
78
+ "**/libfolly_runtime.so",
79
+ "**/libglog.so",
80
+ "**/libhermes.so",
81
+ "**/libhermes-executor-debug.so",
82
+ "**/libhermes_executor.so",
83
+ "**/libreactnative.so",
84
+ "**/libreactnativejni.so",
85
+ "**/libturbomodulejsijni.so",
86
+ "**/libreact_nativemodule_core.so",
87
+ "**/libjscexecutor.so"
88
+ ]
89
+ }
88
90
  }
89
91
 
90
92
  buildFeatures {
@@ -99,7 +101,7 @@ android {
99
101
  }
100
102
  }
101
103
 
102
- lintOptions {
104
+ lint {
103
105
  disable "GradleCompatible"
104
106
  }
105
107
 
@@ -1,5 +1,5 @@
1
- NitroCountryPicker_kotlinVersion=2.0.21
1
+ NitroCountryPicker_kotlinVersion=2.1.20
2
2
  NitroCountryPicker_minSdkVersion=24
3
- NitroCountryPicker_targetSdkVersion=34
3
+ NitroCountryPicker_targetSdkVersion=36
4
4
  NitroCountryPicker_compileSdkVersion=36
5
5
  NitroCountryPicker_ndkVersion=27.1.12297006
@@ -1,4 +1,4 @@
1
- import type { IPickedCountry, PickCountryOptions } from './NitroCountryPicker.nitro';
1
+ import type { IPickedCountry, PickCountryOptions } from './NitroCountryPicker.nitro.js';
2
2
  export declare function pickCountry(options?: PickCountryOptions): Promise<IPickedCountry | null>;
3
3
  export declare function getLastPickedCountry(): IPickedCountry | null;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAKpC,wBAAgB,WAAW,CACzB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAEhC;AAED,wBAAgB,oBAAoB,IAAI,cAAc,GAAG,IAAI,CAE5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EACnB,MAAM,+BAA4B,CAAC;AAKpC,wBAAgB,WAAW,CACzB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAEhC;AAED,wBAAgB,oBAAoB,IAAI,cAAc,GAAG,IAAI,CAE5D"}
@@ -17,7 +17,7 @@ namespace margelo::nitro::nitrocountrypicker {
17
17
  using namespace facebook;
18
18
 
19
19
  /**
20
- * The C++ JNI bridge between the C++ struct "IPickedCountry" and the the Kotlin data class "IPickedCountry".
20
+ * The C++ JNI bridge between the C++ struct "IPickedCountry" and the Kotlin data class "IPickedCountry".
21
21
  */
22
22
  struct JIPickedCountry final: public jni::JavaClass<JIPickedCountry> {
23
23
  public:
@@ -18,7 +18,7 @@ namespace margelo::nitro::nitrocountrypicker {
18
18
  using namespace facebook;
19
19
 
20
20
  /**
21
- * The C++ JNI bridge between the C++ struct "PickCountryOptions" and the the Kotlin data class "PickCountryOptions".
21
+ * The C++ JNI bridge between the C++ struct "PickCountryOptions" and the Kotlin data class "PickCountryOptions".
22
22
  */
23
23
  struct JPickCountryOptions final: public jni::JavaClass<JPickCountryOptions> {
24
24
  public:
@@ -9,6 +9,7 @@ package com.margelo.nitro.nitrocountrypicker
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -29,6 +30,22 @@ data class IPickedCountry(
29
30
  ) {
30
31
  /* primary constructor */
31
32
 
33
+ override fun equals(other: Any?): Boolean {
34
+ if (this === other) return true
35
+ if (other !is IPickedCountry) return false
36
+ return Objects.deepEquals(this.name, other.name)
37
+ && Objects.deepEquals(this.dialCode, other.dialCode)
38
+ && Objects.deepEquals(this.code, other.code)
39
+ }
40
+
41
+ override fun hashCode(): Int {
42
+ return arrayOf<Any?>(
43
+ name,
44
+ dialCode,
45
+ code
46
+ ).contentDeepHashCode()
47
+ }
48
+
32
49
  companion object {
33
50
  /**
34
51
  * Constructor called from C++
@@ -9,6 +9,7 @@ package com.margelo.nitro.nitrocountrypicker
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -23,6 +24,18 @@ data class PickCountryOptions(
23
24
  ) {
24
25
  /* primary constructor */
25
26
 
27
+ override fun equals(other: Any?): Boolean {
28
+ if (this === other) return true
29
+ if (other !is PickCountryOptions) return false
30
+ return Objects.deepEquals(this.headerTitle, other.headerTitle)
31
+ }
32
+
33
+ override fun hashCode(): Int {
34
+ return arrayOf<Any?>(
35
+ headerTitle
36
+ ).contentDeepHashCode()
37
+ }
38
+
26
39
  companion object {
27
40
  /**
28
41
  * Constructor called from C++
@@ -21,6 +21,22 @@ sealed class Variant_NullType_IPickedCountry {
21
21
  @DoNotStrip
22
22
  data class Second(@DoNotStrip val value: IPickedCountry): Variant_NullType_IPickedCountry()
23
23
 
24
+ inline fun <reified T> asType(): T? {
25
+ return when (this) {
26
+ is First -> (value) as? T
27
+ is Second -> (value) as? T
28
+ }
29
+ }
30
+ inline fun <reified T> isType(): Boolean {
31
+ return asType<T>() != null
32
+ }
33
+ inline fun <R> match(first: (NullType) -> R, second: (IPickedCountry) -> R): R {
34
+ return when (this) {
35
+ is First -> first(value)
36
+ is Second -> second(value)
37
+ }
38
+ }
39
+
24
40
  val isFirst: Boolean
25
41
  get() = this is First
26
42
  val isSecond: Boolean
@@ -35,13 +51,6 @@ sealed class Variant_NullType_IPickedCountry {
35
51
  return value
36
52
  }
37
53
 
38
- inline fun <R> match(first: (NullType) -> R, second: (IPickedCountry) -> R): R {
39
- return when (this) {
40
- is First -> first(value)
41
- is Second -> second(value)
42
- }
43
- }
44
-
45
54
  companion object {
46
55
  @JvmStatic
47
56
  @DoNotStrip
@@ -56,5 +56,7 @@ def add_nitrogen_files(spec)
56
56
  "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
57
  # Enables stricter modular headers
58
58
  "DEFINES_MODULE" => "YES",
59
+ # Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
60
+ "SWIFT_INSTALL_OBJC_HEADER" => "NO",
59
61
  })
60
62
  end
@@ -16,3 +16,15 @@ public indirect enum Variant_NullType_IPickedCountry {
16
16
  case first(NullType)
17
17
  case second(IPickedCountry)
18
18
  }
19
+
20
+ public extension Variant_NullType_IPickedCountry {
21
+ func asType<T>(_ type: T.Type = T.self) -> T? {
22
+ switch self {
23
+ case .first(let value): return value as? T
24
+ case .second(let value): return value as? T
25
+ }
26
+ }
27
+ func isType<T>(_ type: T.Type = T.self) -> Bool {
28
+ return self.asType(type) != nil
29
+ }
30
+ }
package/package.json CHANGED
@@ -1,16 +1,21 @@
1
1
  {
2
2
  "name": "react-native-nitro-country-picker",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Native country picker module, powered by NitroModules",
5
- "main": "./lib/module/index.js",
6
- "types": "./lib/typescript/src/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "source": "./src/index.tsx",
10
- "types": "./lib/typescript/src/index.d.ts",
11
- "default": "./lib/module/index.js"
12
- },
13
- "./package.json": "./package.json"
5
+ "keywords": [
6
+ "android",
7
+ "ios",
8
+ "react-native"
9
+ ],
10
+ "homepage": "https://github.com/Doko-Demo-Doa/react-native-nitro-country-picker#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/Doko-Demo-Doa/react-native-nitro-country-picker/issues"
13
+ },
14
+ "license": "MIT",
15
+ "author": "Quan Pham <doraemonfanclub@gmail.com> (https://github.com/Doko-Demo-Doa)",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Doko-Demo-Doa/react-native-nitro-country-picker.git"
14
19
  },
15
20
  "files": [
16
21
  "src",
@@ -33,108 +38,94 @@
33
38
  "!**/__mocks__",
34
39
  "!**/.*"
35
40
  ],
41
+ "main": "./lib/module/index.js",
42
+ "types": "./lib/typescript/src/index.d.ts",
43
+ "exports": {
44
+ ".": {
45
+ "react-native-nitro-country-picker-source": "./src/index.tsx",
46
+ "types": "./lib/typescript/src/index.d.ts",
47
+ "default": "./lib/module/index.js"
48
+ },
49
+ "./package.json": "./package.json"
50
+ },
51
+ "publishConfig": {
52
+ "registry": "https://registry.npmjs.org/"
53
+ },
36
54
  "scripts": {
37
- "example": "yarn workspace react-native-nitro-country-picker-example",
38
- "test": "jest",
39
- "typecheck": "tsc",
40
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
55
+ "example": "pnpm --filter react-native-nitro-country-picker-example",
41
56
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
57
+ "postinstall": "node scripts/link-android-deps.js",
42
58
  "prepare": "bob build",
43
59
  "nitrogen": "nitrogen",
60
+ "typecheck": "tsc",
61
+ "lint": "oxlint",
62
+ "lint:fix": "oxlint --fix",
63
+ "format": "oxfmt",
64
+ "format:check": "oxfmt --check",
65
+ "test": "jest",
44
66
  "release": "release-it --only-version"
45
67
  },
46
- "keywords": [
47
- "react-native",
48
- "ios",
49
- "android"
50
- ],
51
- "repository": {
52
- "type": "git",
53
- "url": "git+https://github.com/Doko-Demo-Doa/react-native-nitro-country-picker.git"
54
- },
55
- "author": "Quan Pham <doraemonfanclub@gmail.com> (https://github.com/Doko-Demo-Doa)",
56
- "license": "MIT",
57
- "bugs": {
58
- "url": "https://github.com/Doko-Demo-Doa/react-native-nitro-country-picker/issues"
59
- },
60
- "homepage": "https://github.com/Doko-Demo-Doa/react-native-nitro-country-picker#readme",
61
- "publishConfig": {
62
- "registry": "https://registry.npmjs.org/"
63
- },
64
68
  "devDependencies": {
65
- "@commitlint/config-conventional": "^20.5.0",
66
- "@eslint/compat": "^2.0.3",
67
- "@eslint/eslintrc": "^3.3.5",
68
- "@eslint/js": "^10.0.1",
69
- "@evilmartians/lefthook": "^2.1.4",
70
- "@react-native/babel-preset": "0.84.1",
71
- "@react-native/eslint-config": "^0.84.1",
72
- "@release-it/conventional-changelog": "^10.0.6",
73
- "@types/jest": "30.0.0",
74
- "@types/react": "^19.1.8",
75
- "commitlint": "^20.5.0",
69
+ "@commitlint/config-conventional": "^21.2.0",
70
+ "@jest/globals": "^29.7.0",
71
+ "@react-native/babel-preset": "0.86.0",
72
+ "@react-native/eslint-plugin": "0.86.0",
73
+ "@react-native/jest-preset": "0.86.0",
74
+ "@release-it/conventional-changelog": "^11.0.1",
75
+ "@types/react": "^19.2.17",
76
+ "commitlint": "^21.2.1",
76
77
  "del-cli": "^7.0.0",
77
- "eslint": "^9.32.0",
78
- "eslint-config-prettier": "^10.1.8",
78
+ "eslint-plugin-eslint-comments": "^3.2.0",
79
79
  "eslint-plugin-ft-flow": "^3.0.11",
80
- "eslint-plugin-prettier": "^5.5.5",
81
- "jest": "^30.3.0",
82
- "nitrogen": "^0.35.3",
83
- "prettier": "^3.8.1",
84
- "react": "19.2.4",
85
- "react-native": "0.84.1",
86
- "react-native-builder-bob": "^0.41.0",
87
- "react-native-nitro-modules": "0.35.3",
88
- "release-it": "^19.2.4",
89
- "turbo": "^2.9.3",
90
- "typescript": "^6.0.2"
80
+ "eslint-plugin-react-native": "^5.0.0",
81
+ "jest": "^29.7.0",
82
+ "lefthook": "^2.1.10",
83
+ "nitrogen": "^0.36.1",
84
+ "oxfmt": "^0.58.0",
85
+ "oxlint": "^1.73.0",
86
+ "react": "19.2.7",
87
+ "react-native": "0.86.0",
88
+ "react-native-builder-bob": "^0.43.0",
89
+ "react-native-nitro-modules": "^0.36.1",
90
+ "release-it": "^20.2.1",
91
+ "turbo": "^2.10.4",
92
+ "typescript": "^6.0.3"
91
93
  },
92
94
  "peerDependencies": {
93
95
  "react": "*",
94
96
  "react-native": "*",
95
- "react-native-nitro-modules": "0.35.3"
96
- },
97
- "workspaces": [
98
- "example"
99
- ],
100
- "packageManager": "yarn@4.13.0",
101
- "jest": {
102
- "preset": "react-native",
103
- "modulePathIgnorePatterns": [
104
- "<rootDir>/example/node_modules",
105
- "<rootDir>/lib/"
106
- ]
97
+ "react-native-nitro-modules": "^0.36.1"
107
98
  },
108
99
  "commitlint": {
109
100
  "extends": [
110
101
  "@commitlint/config-conventional"
111
102
  ]
112
103
  },
113
- "release-it": {
114
- "git": {
115
- "commitMessage": "chore: release ${version}",
116
- "tagName": "v${version}"
117
- },
118
- "npm": {
119
- "publish": true
120
- },
121
- "github": {
122
- "release": true
123
- },
124
- "plugins": {
125
- "@release-it/conventional-changelog": {
126
- "preset": {
127
- "name": "angular"
128
- }
129
- }
104
+ "jest": {
105
+ "modulePathIgnorePatterns": [
106
+ "<rootDir>/example/node_modules",
107
+ "<rootDir>/lib/"
108
+ ],
109
+ "preset": "@react-native/jest-preset",
110
+ "testEnvironmentOptions": {
111
+ "customExportConditions": [
112
+ "require",
113
+ "react-native",
114
+ "react-native-nitro-country-picker-source"
115
+ ]
130
116
  }
131
117
  },
132
- "prettier": {
133
- "quoteProps": "consistent",
134
- "singleQuote": true,
135
- "tabWidth": 2,
136
- "trailingComma": "es5",
137
- "useTabs": false
118
+ "packageManager": "pnpm@11.10.0",
119
+ "create-react-native-library": {
120
+ "type": "nitro-module",
121
+ "languages": "kotlin-swift",
122
+ "tools": [
123
+ "oxlint",
124
+ "jest",
125
+ "lefthook",
126
+ "release-it"
127
+ ],
128
+ "version": "0.57.2"
138
129
  },
139
130
  "react-native-builder-bob": {
140
131
  "source": "src",
@@ -161,15 +152,23 @@
161
152
  ]
162
153
  ]
163
154
  },
164
- "create-react-native-library": {
165
- "languages": "kotlin-swift",
166
- "type": "nitro-module",
167
- "tools": [
168
- "eslint",
169
- "lefthook",
170
- "release-it",
171
- "jest"
172
- ],
173
- "version": "0.57.2"
155
+ "release-it": {
156
+ "git": {
157
+ "commitMessage": "chore: release ${version}",
158
+ "tagName": "v${version}"
159
+ },
160
+ "npm": {
161
+ "publish": true
162
+ },
163
+ "github": {
164
+ "release": true
165
+ },
166
+ "plugins": {
167
+ "@release-it/conventional-changelog": {
168
+ "preset": {
169
+ "name": "angular"
170
+ }
171
+ }
172
+ }
174
173
  }
175
174
  }