react-native-country-select 0.3.5 → 0.3.6

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
@@ -69,6 +69,8 @@
69
69
  npm install react-native-country-select
70
70
  # or
71
71
  yarn add react-native-country-select
72
+ # and
73
+ cd ios && pod install
72
74
  ```
73
75
 
74
76
  <br>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-country-select",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "šŸŒ React Native country picker with flags, search, TypeScript, i18n, and offline support. Lightweight, customizable, and designed with a modern UI.",
5
5
  "main": "lib/index.tsx",
6
6
  "types": "lib/index.d.ts",
@@ -26,6 +26,9 @@
26
26
  "react native country picker",
27
27
  "react native country select"
28
28
  ],
29
+ "scripts": {
30
+ "postinstall": "node scripts/install-react-native-safe-area-context.js"
31
+ },
29
32
  "repository": {
30
33
  "type": "git",
31
34
  "url": "git+https://github.com/AstrOOnauta/react-native-country-select.git"
@@ -39,12 +42,14 @@
39
42
  "publishConfig": {
40
43
  "registry": "https://registry.npmjs.org/"
41
44
  },
42
- "dependencies": {
43
- "react-native-safe-area-context": "*"
44
- },
45
- "devDependencies": {},
46
45
  "peerDependencies": {
47
46
  "react": "*",
48
- "react-native": "*"
47
+ "react-native": "*",
48
+ "react-native-safe-area-context": ">=4.0.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "react-native-safe-area-context": {
52
+ "optional": false
53
+ }
49
54
  }
50
55
  }
@@ -0,0 +1,84 @@
1
+ const { execSync } = require('child_process');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ // Navigate to the project root directory (outside node_modules)
6
+ function findProjectRoot() {
7
+ let current = process.cwd();
8
+
9
+ // If we're inside node_modules, go up until we're out
10
+ while (current.includes('node_modules')) {
11
+ current = path.dirname(current);
12
+ }
13
+
14
+ // Look for the project's package.json
15
+ while (!fs.existsSync(path.join(current, 'package.json'))) {
16
+ const next = path.dirname(current);
17
+ if (next === current) break;
18
+ current = next;
19
+ }
20
+
21
+ return current;
22
+ }
23
+
24
+ const root = findProjectRoot();
25
+ process.chdir(root);
26
+
27
+ // Check if react-native-safe-area-context is already installed
28
+ function isPackageInstalled() {
29
+ const packagePath = path.join(
30
+ root,
31
+ 'node_modules',
32
+ 'react-native-safe-area-context'
33
+ );
34
+
35
+ if (fs.existsSync(packagePath)) {
36
+ console.log(
37
+ 'āœ… react-native-safe-area-context is already installed!\n'
38
+ );
39
+ return true;
40
+ }
41
+
42
+ return false;
43
+ }
44
+
45
+ // If already installed, do nothing
46
+ if (isPackageInstalled()) {
47
+ process.exit(0);
48
+ }
49
+
50
+ function detectPackageManager() {
51
+ if (fs.existsSync(path.join(root, 'bun.lockb'))) return 'bun';
52
+ if (fs.existsSync(path.join(root, 'pnpm-lock.yaml'))) return 'pnpm';
53
+ if (fs.existsSync(path.join(root, 'yarn.lock'))) return 'yarn';
54
+ return 'npm';
55
+ }
56
+
57
+ const pm = detectPackageManager();
58
+
59
+ const commands = {
60
+ npm: 'npm install react-native-safe-area-context@latest --save',
61
+ yarn: 'yarn add react-native-safe-area-context@latest',
62
+ pnpm: 'pnpm add react-native-safe-area-context@latest',
63
+ bun: 'bun add react-native-safe-area-context@latest',
64
+ };
65
+
66
+ const command = commands[pm] || commands.npm;
67
+
68
+ try {
69
+ console.log(`\nšŸ”§ Detected package manager: ${pm}`);
70
+ console.log(`šŸ“¦ Installing react-native-safe-area-context using:`);
71
+ console.log(`āž”ļø ${command}\n`);
72
+
73
+ execSync(command, { stdio: 'inherit' });
74
+
75
+ console.log(
76
+ `\nāœ… react-native-safe-area-context installed successfully!\n`
77
+ );
78
+ } catch (err) {
79
+ console.error(
80
+ '\nāš ļø Could not automatically install react-native-safe-area-context'
81
+ );
82
+ console.error('Please install it manually by running:\n');
83
+ console.error(` ${command}\n`);
84
+ }