react-native-nitro-country-picker 0.1.0
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/LICENSE +20 -0
- package/NitroCountryPicker.podspec +37 -0
- package/README.md +164 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +149 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/nitrocountrypicker/CountryPickerActivity.kt +95 -0
- package/android/src/main/java/com/margelo/nitro/nitrocountrypicker/NitroCountryPicker.kt +132 -0
- package/android/src/main/java/com/margelo/nitro/nitrocountrypicker/NitroCountryPickerPackage.kt +36 -0
- package/ios/NitroCountryPicker.swift +94 -0
- package/lib/module/NitroCountryPicker.nitro.js +4 -0
- package/lib/module/NitroCountryPicker.nitro.js.map +1 -0
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NitroCountryPicker.nitro.d.ts +17 -0
- package/lib/typescript/src/NitroCountryPicker.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JHybridNitroCountryPickerSpec.cpp +83 -0
- package/nitrogen/generated/android/c++/JHybridNitroCountryPickerSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JIPickedCountry.hpp +65 -0
- package/nitrogen/generated/android/c++/JPickCountryOptions.hpp +58 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_IPickedCountry.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_IPickedCountry.hpp +72 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocountrypicker/HybridNitroCountryPickerSpec.kt +60 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocountrypicker/IPickedCountry.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocountrypicker/PickCountryOptions.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocountrypicker/Variant_NullType_IPickedCountry.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocountrypicker/nitrocountrypickerOnLoad.kt +35 -0
- package/nitrogen/generated/android/nitrocountrypicker+autolinking.cmake +82 -0
- package/nitrogen/generated/android/nitrocountrypicker+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nitrocountrypickerOnLoad.cpp +54 -0
- package/nitrogen/generated/android/nitrocountrypickerOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NitroCountryPicker+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroCountryPicker-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/NitroCountryPicker-Swift-Cxx-Bridge.hpp +188 -0
- package/nitrogen/generated/ios/NitroCountryPicker-Swift-Cxx-Umbrella.hpp +54 -0
- package/nitrogen/generated/ios/NitroCountryPickerAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroCountryPickerAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroCountryPickerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroCountryPickerSpecSwift.hpp +99 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__IPickedCountry_.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridNitroCountryPickerSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroCountryPickerSpec_cxx.swift +171 -0
- package/nitrogen/generated/ios/swift/IPickedCountry.swift +39 -0
- package/nitrogen/generated/ios/swift/PickCountryOptions.swift +42 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_IPickedCountry.swift +18 -0
- package/nitrogen/generated/shared/c++/HybridNitroCountryPickerSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNitroCountryPickerSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/IPickedCountry.hpp +91 -0
- package/nitrogen/generated/shared/c++/PickCountryOptions.hpp +84 -0
- package/package.json +175 -0
- package/src/NitroCountryPicker.nitro.ts +20 -0
- package/src/index.tsx +19 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroCountryPickerSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNitroCountryPickerSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrocountrypicker {
|
|
11
|
+
|
|
12
|
+
void HybridNitroCountryPickerSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("pickCountry", &HybridNitroCountryPickerSpec::pickCountry);
|
|
18
|
+
prototype.registerHybridMethod("getLastPickedCountry", &HybridNitroCountryPickerSpec::getLastPickedCountry);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace margelo::nitro::nitrocountrypicker
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroCountryPickerSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `IPickedCountry` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitrocountrypicker { struct IPickedCountry; }
|
|
18
|
+
// Forward declaration of `PickCountryOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitrocountrypicker { struct PickCountryOptions; }
|
|
20
|
+
|
|
21
|
+
#include <NitroModules/Null.hpp>
|
|
22
|
+
#include "IPickedCountry.hpp"
|
|
23
|
+
#include <variant>
|
|
24
|
+
#include <NitroModules/Promise.hpp>
|
|
25
|
+
#include "PickCountryOptions.hpp"
|
|
26
|
+
#include <optional>
|
|
27
|
+
|
|
28
|
+
namespace margelo::nitro::nitrocountrypicker {
|
|
29
|
+
|
|
30
|
+
using namespace margelo::nitro;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* An abstract base class for `NitroCountryPicker`
|
|
34
|
+
* Inherit this class to create instances of `HybridNitroCountryPickerSpec` in C++.
|
|
35
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
36
|
+
* @example
|
|
37
|
+
* ```cpp
|
|
38
|
+
* class HybridNitroCountryPicker: public HybridNitroCountryPickerSpec {
|
|
39
|
+
* public:
|
|
40
|
+
* HybridNitroCountryPicker(...): HybridObject(TAG) { ... }
|
|
41
|
+
* // ...
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
class HybridNitroCountryPickerSpec: public virtual HybridObject {
|
|
46
|
+
public:
|
|
47
|
+
// Constructor
|
|
48
|
+
explicit HybridNitroCountryPickerSpec(): HybridObject(TAG) { }
|
|
49
|
+
|
|
50
|
+
// Destructor
|
|
51
|
+
~HybridNitroCountryPickerSpec() override = default;
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
// Properties
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
// Methods
|
|
59
|
+
virtual std::shared_ptr<Promise<std::variant<nitro::NullType, IPickedCountry>>> pickCountry(const std::optional<PickCountryOptions>& options) = 0;
|
|
60
|
+
virtual std::variant<nitro::NullType, IPickedCountry> getLastPickedCountry() = 0;
|
|
61
|
+
|
|
62
|
+
protected:
|
|
63
|
+
// Hybrid Setup
|
|
64
|
+
void loadHybridMethods() override;
|
|
65
|
+
|
|
66
|
+
protected:
|
|
67
|
+
// Tag for logging
|
|
68
|
+
static constexpr auto TAG = "NitroCountryPicker";
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace margelo::nitro::nitrocountrypicker
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// IPickedCountry.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitrocountrypicker {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (IPickedCountry).
|
|
39
|
+
*/
|
|
40
|
+
struct IPickedCountry final {
|
|
41
|
+
public:
|
|
42
|
+
std::string name SWIFT_PRIVATE;
|
|
43
|
+
std::string dialCode SWIFT_PRIVATE;
|
|
44
|
+
std::string code SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
IPickedCountry() = default;
|
|
48
|
+
explicit IPickedCountry(std::string name, std::string dialCode, std::string code): name(name), dialCode(dialCode), code(code) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const IPickedCountry& lhs, const IPickedCountry& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::nitrocountrypicker
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ IPickedCountry <> JS IPickedCountry (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::nitrocountrypicker::IPickedCountry> final {
|
|
61
|
+
static inline margelo::nitro::nitrocountrypicker::IPickedCountry fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::nitrocountrypicker::IPickedCountry(
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
65
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "dialCode"))),
|
|
66
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "code")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrocountrypicker::IPickedCountry& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "dialCode"), JSIConverter<std::string>::toJSI(runtime, arg.dialCode));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "code"), JSIConverter<std::string>::toJSI(runtime, arg.code));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
85
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "dialCode")))) return false;
|
|
86
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "code")))) return false;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PickCountryOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
#include <optional>
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::nitrocountrypicker {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (PickCountryOptions).
|
|
40
|
+
*/
|
|
41
|
+
struct PickCountryOptions final {
|
|
42
|
+
public:
|
|
43
|
+
std::optional<std::string> headerTitle SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
PickCountryOptions() = default;
|
|
47
|
+
explicit PickCountryOptions(std::optional<std::string> headerTitle): headerTitle(headerTitle) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const PickCountryOptions& lhs, const PickCountryOptions& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::nitrocountrypicker
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ PickCountryOptions <> JS PickCountryOptions (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::nitrocountrypicker::PickCountryOptions> final {
|
|
60
|
+
static inline margelo::nitro::nitrocountrypicker::PickCountryOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::nitrocountrypicker::PickCountryOptions(
|
|
63
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headerTitle")))
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrocountrypicker::PickCountryOptions& arg) {
|
|
67
|
+
jsi::Object obj(runtime);
|
|
68
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "headerTitle"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.headerTitle));
|
|
69
|
+
return obj;
|
|
70
|
+
}
|
|
71
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
72
|
+
if (!value.isObject()) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
jsi::Object obj = value.getObject(runtime);
|
|
76
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headerTitle")))) return false;
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
package/package.json
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-nitro-country-picker",
|
|
3
|
+
"version": "0.1.0",
|
|
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"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"nitrogen",
|
|
22
|
+
"nitro.json",
|
|
23
|
+
"*.podspec",
|
|
24
|
+
"react-native.config.js",
|
|
25
|
+
"!ios/build",
|
|
26
|
+
"!android/build",
|
|
27
|
+
"!android/gradle",
|
|
28
|
+
"!android/gradlew",
|
|
29
|
+
"!android/gradlew.bat",
|
|
30
|
+
"!android/local.properties",
|
|
31
|
+
"!**/__tests__",
|
|
32
|
+
"!**/__fixtures__",
|
|
33
|
+
"!**/__mocks__",
|
|
34
|
+
"!**/.*"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"example": "yarn workspace react-native-nitro-country-picker-example",
|
|
38
|
+
"test": "jest",
|
|
39
|
+
"typecheck": "tsc",
|
|
40
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
41
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
42
|
+
"prepare": "bob build",
|
|
43
|
+
"nitrogen": "nitrogen",
|
|
44
|
+
"release": "release-it --only-version"
|
|
45
|
+
},
|
|
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
|
+
"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",
|
|
76
|
+
"del-cli": "^7.0.0",
|
|
77
|
+
"eslint": "^9.32.0",
|
|
78
|
+
"eslint-config-prettier": "^10.1.8",
|
|
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"
|
|
91
|
+
},
|
|
92
|
+
"peerDependencies": {
|
|
93
|
+
"react": "*",
|
|
94
|
+
"react-native": "*",
|
|
95
|
+
"react-native-nitro-modules": "^0.26.4"
|
|
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
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"commitlint": {
|
|
109
|
+
"extends": [
|
|
110
|
+
"@commitlint/config-conventional"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
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
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"prettier": {
|
|
133
|
+
"quoteProps": "consistent",
|
|
134
|
+
"singleQuote": true,
|
|
135
|
+
"tabWidth": 2,
|
|
136
|
+
"trailingComma": "es5",
|
|
137
|
+
"useTabs": false
|
|
138
|
+
},
|
|
139
|
+
"react-native-builder-bob": {
|
|
140
|
+
"source": "src",
|
|
141
|
+
"output": "lib",
|
|
142
|
+
"targets": [
|
|
143
|
+
[
|
|
144
|
+
"custom",
|
|
145
|
+
{
|
|
146
|
+
"script": "nitrogen",
|
|
147
|
+
"clean": "nitrogen/"
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
[
|
|
151
|
+
"module",
|
|
152
|
+
{
|
|
153
|
+
"esm": true
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"typescript",
|
|
158
|
+
{
|
|
159
|
+
"project": "tsconfig.build.json"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
]
|
|
163
|
+
},
|
|
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"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
|
|
3
|
+
export interface IPickedCountry {
|
|
4
|
+
name: string;
|
|
5
|
+
dialCode: string;
|
|
6
|
+
code: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface PickCountryOptions {
|
|
10
|
+
headerTitle?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface NitroCountryPicker extends HybridObject<{
|
|
14
|
+
ios: 'swift';
|
|
15
|
+
android: 'kotlin';
|
|
16
|
+
}> {
|
|
17
|
+
pickCountry(options?: PickCountryOptions): Promise<IPickedCountry | null>;
|
|
18
|
+
|
|
19
|
+
getLastPickedCountry(): IPickedCountry | null;
|
|
20
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
2
|
+
import type {
|
|
3
|
+
IPickedCountry,
|
|
4
|
+
NitroCountryPicker,
|
|
5
|
+
PickCountryOptions,
|
|
6
|
+
} from './NitroCountryPicker.nitro';
|
|
7
|
+
|
|
8
|
+
const NitroCountryPickerHybridObject =
|
|
9
|
+
NitroModules.createHybridObject<NitroCountryPicker>('NitroCountryPicker');
|
|
10
|
+
|
|
11
|
+
export function pickCountry(
|
|
12
|
+
options?: PickCountryOptions
|
|
13
|
+
): Promise<IPickedCountry | null> {
|
|
14
|
+
return NitroCountryPickerHybridObject.pickCountry(options);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getLastPickedCountry(): IPickedCountry | null {
|
|
18
|
+
return NitroCountryPickerHybridObject.getLastPickedCountry();
|
|
19
|
+
}
|