react-native-nitro-country-picker 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +52 -10
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,20 +1,30 @@
1
1
  # react-native-nitro-country-picker
2
2
 
3
- A native country picker for React Native, powered by Nitro Modules.
3
+ A Promise-based, native country picker for React Native, powered by Nitro Modules.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/react-native-nitro-country-picker?style=for-the-badge&color=blue)](https://www.npmjs.com/package/react-native-nitro-country-picker)
6
+ [![Monthly downloads](https://img.shields.io/npm/dm/react-native-nitro-country-picker?style=for-the-badge)](https://www.npmjs.com/package/react-native-nitro-country-picker)
7
+ [![New Architecture](https://img.shields.io/badge/New%20Architecture-Ready-5f3dc4?style=for-the-badge)](https://reactnative.dev/docs/the-new-architecture/landing-page)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Supported-3178C6?style=for-the-badge)](https://www.typescriptlang.org/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-2f9e44?style=for-the-badge)](LICENSE)
10
+ [![iOS](https://img.shields.io/badge/iOS-15.1%2B-000000?style=for-the-badge&logo=apple)](https://developer.apple.com/ios/)
11
+ [![Android](https://img.shields.io/badge/Android-API%2024%2B-3DDC84?style=for-the-badge&logo=android&logoColor=white)](https://developer.android.com/)
12
+ [![Nitro Modules](https://img.shields.io/badge/Nitro%20Modules-Enabled-ff6b00?style=for-the-badge)](https://nitro.margelo.com/)
13
+
14
+ | Preview 1 | Preview 2 |
15
+ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
16
+ | <img width="350" height="781" alt="iOS Preview" src="./images/cp-ios.png" /> | <img width="350" height="781" alt="Android Preview" src="./images/cp-android.png" /> |
4
17
 
5
18
  This library provides a single async API that opens a native picker and returns structured country data.
6
19
 
20
+ I created this library because I kept running into cases where I needed to implement a country code picker. There are several options, but they are either JS-only solutions with a declarative API (often with poor performance) or noticeably laggy.
21
+
22
+ All I wanted was a module with a single `pickCountry` method that returns country data. Done. No hassle. The UI should include a list and a simple search bar. It can be customized, but for now it should stay as simple as possible.
23
+
7
24
  - Android native implementation: [CountryCodePickerCompose](https://github.com/ahmmedrejowan/CountryCodePickerCompose)
8
25
  - iOS native implementation: [CountryPickerAKS](https://github.com/aksamitsah/CountryPickerAKS)
9
26
 
10
- ## Features
11
-
12
- - Native picker UI on both iOS and Android
13
- - Promise-based API: `pickCountry(options?)`
14
- - Typed result object with `name`, `dialCode`, and `code`
15
- - `null` result when user dismisses without selection
16
- - Last selection cache via `getLastPickedCountry()`
17
- - Optional picker title input: `headerTitle` (currently applied on Android)
27
+ ---
18
28
 
19
29
  ## Requirements
20
30
 
@@ -25,6 +35,20 @@ This library provides a single async API that opens a native picker and returns
25
35
 
26
36
  > Note: This package depends on [react-native-nitro-modules](https://nitro.margelo.com/).
27
37
 
38
+ ---
39
+
40
+ ## Features
41
+
42
+ - 📱 **Native UI**: Uses native picker interfaces on both iOS and Android.
43
+ - ⚡ **Promise-Based API**: Call `pickCountry(options?)` and await the result.
44
+ - 🔷 **Typed Return Data**: Returns a typed object with `name`, `dialCode`, and `code`.
45
+ - 🧭 **Dismiss Handling**: Resolves to `null` when the picker is dismissed or canceled.
46
+ - 🧠 **Last Selection Cache**: Read the last picked country with `getLastPickedCountry()`.
47
+ - 🎛️ **Configurable Title**: Supports `headerTitle` (currently applied on Android).
48
+ - 🧩 **Nitro Module Powered**: Built with `react-native-nitro-modules` for native performance.
49
+
50
+ ---
51
+
28
52
  ## Installation
29
53
 
30
54
  ```bash
@@ -37,12 +61,18 @@ or
37
61
  yarn add react-native-nitro-country-picker react-native-nitro-modules
38
62
  ```
39
63
 
40
- ### iOS setup
64
+ ### iOS Setup
41
65
 
42
66
  ```bash
43
67
  cd ios && pod install
44
68
  ```
45
69
 
70
+ ### Android Setup
71
+
72
+ No additional configuration is required for Android. Autolinking handles the native module setup.
73
+
74
+ ---
75
+
46
76
  ## Usage
47
77
 
48
78
  ```tsx
@@ -61,6 +91,8 @@ const country = await pickCountry({
61
91
  });
62
92
  ```
63
93
 
94
+ ---
95
+
64
96
  ## Returned Data Examples
65
97
 
66
98
  ### 1) Handle selected vs dismissed
@@ -108,6 +140,8 @@ if (last) {
108
140
  }
109
141
  ```
110
142
 
143
+ ---
144
+
111
145
  ## API
112
146
 
113
147
  ### `pickCountry(options?) => Promise<IPickedCountry | null>`
@@ -125,6 +159,8 @@ Options:
125
159
 
126
160
  Returns the most recent selected country for the current app runtime session.
127
161
 
162
+ ---
163
+
128
164
  ## Type Shapes
129
165
 
130
166
  ```ts
@@ -139,6 +175,8 @@ type PickCountryOptions = {
139
175
  };
140
176
  ```
141
177
 
178
+ ---
179
+
142
180
  ## Example App
143
181
 
144
182
  To run the included example app:
@@ -151,10 +189,14 @@ yarn ios
151
189
  yarn android
152
190
  ```
153
191
 
192
+ ---
193
+
154
194
  ## Contributing
155
195
 
156
196
  See [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow and contribution guidelines.
157
197
 
198
+ ---
199
+
158
200
  ## License
159
201
 
160
202
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-country-picker",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Native country picker module, powered by NitroModules",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -84,7 +84,7 @@
84
84
  "react": "19.2.4",
85
85
  "react-native": "0.84.1",
86
86
  "react-native-builder-bob": "^0.41.0",
87
- "react-native-nitro-modules": "^0.35.3",
87
+ "react-native-nitro-modules": "0.35.3",
88
88
  "release-it": "^19.2.4",
89
89
  "turbo": "^2.9.3",
90
90
  "typescript": "^6.0.2"
@@ -92,7 +92,7 @@
92
92
  "peerDependencies": {
93
93
  "react": "*",
94
94
  "react-native": "*",
95
- "react-native-nitro-modules": "^0.26.4"
95
+ "react-native-nitro-modules": "0.35.3"
96
96
  },
97
97
  "workspaces": [
98
98
  "example"