react-native-nitro-simple-toast 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/NitroSimpleToast.podspec +30 -0
- package/README.md +81 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +118 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/nitrosimpletoast/NitroSimpleToast.kt +66 -0
- package/android/src/main/java/com/margelo/nitro/nitrosimpletoast/NitroSimpleToastPackage.kt +26 -0
- package/ios/NitroSimpleToast.swift +60 -0
- package/lib/module/NitroSimpleToast.nitro.js +4 -0
- package/lib/module/NitroSimpleToast.nitro.js.map +1 -0
- package/lib/module/index.js +8 -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/NitroSimpleToast.nitro.d.ts +33 -0
- package/lib/typescript/src/NitroSimpleToast.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++/JHybridNitroSimpleToastSpec.cpp +68 -0
- package/nitrogen/generated/android/c++/JHybridNitroSimpleToastSpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JToastFrom.hpp +58 -0
- package/nitrogen/generated/android/c++/JToastHaptic.hpp +64 -0
- package/nitrogen/generated/android/c++/JToastOptions.hpp +88 -0
- package/nitrogen/generated/android/c++/JToastPreset.hpp +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/HybridNitroSimpleToastSpec.kt +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/ToastFrom.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/ToastHaptic.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/ToastOptions.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/ToastPreset.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/nitrosimpletoastOnLoad.kt +35 -0
- package/nitrogen/generated/android/nitrosimpletoast+autolinking.cmake +81 -0
- package/nitrogen/generated/android/nitrosimpletoast+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nitrosimpletoastOnLoad.cpp +54 -0
- package/nitrogen/generated/android/nitrosimpletoastOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NitroSimpleToast+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroSimpleToast-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/NitroSimpleToast-Swift-Cxx-Bridge.hpp +152 -0
- package/nitrogen/generated/ios/NitroSimpleToast-Swift-Cxx-Umbrella.hpp +57 -0
- package/nitrogen/generated/ios/NitroSimpleToastAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroSimpleToastAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroSimpleToastSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroSimpleToastSpecSwift.hpp +92 -0
- package/nitrogen/generated/ios/swift/HybridNitroSimpleToastSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridNitroSimpleToastSpec_cxx.swift +137 -0
- package/nitrogen/generated/ios/swift/ToastFrom.swift +40 -0
- package/nitrogen/generated/ios/swift/ToastHaptic.swift +48 -0
- package/nitrogen/generated/ios/swift/ToastOptions.swift +116 -0
- package/nitrogen/generated/ios/swift/ToastPreset.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridNitroSimpleToastSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridNitroSimpleToastSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/ToastFrom.hpp +76 -0
- package/nitrogen/generated/shared/c++/ToastHaptic.hpp +84 -0
- package/nitrogen/generated/shared/c++/ToastOptions.hpp +116 -0
- package/nitrogen/generated/shared/c++/ToastPreset.hpp +80 -0
- package/package.json +174 -0
- package/src/NitroSimpleToast.nitro.ts +35 -0
- package/src/index.tsx +16 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ToastOptions.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
|
+
// Forward declaration of `ToastPreset` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastPreset; }
|
|
33
|
+
// Forward declaration of `ToastHaptic` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastHaptic; }
|
|
35
|
+
// Forward declaration of `ToastFrom` to properly resolve imports.
|
|
36
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastFrom; }
|
|
37
|
+
|
|
38
|
+
#include <string>
|
|
39
|
+
#include <optional>
|
|
40
|
+
#include "ToastPreset.hpp"
|
|
41
|
+
#include "ToastHaptic.hpp"
|
|
42
|
+
#include "ToastFrom.hpp"
|
|
43
|
+
|
|
44
|
+
namespace margelo::nitro::nitrosimpletoast {
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A struct which can be represented as a JavaScript object (ToastOptions).
|
|
48
|
+
*/
|
|
49
|
+
struct ToastOptions final {
|
|
50
|
+
public:
|
|
51
|
+
std::string title SWIFT_PRIVATE;
|
|
52
|
+
std::optional<std::string> message SWIFT_PRIVATE;
|
|
53
|
+
std::optional<ToastPreset> preset SWIFT_PRIVATE;
|
|
54
|
+
std::optional<double> duration SWIFT_PRIVATE;
|
|
55
|
+
std::optional<ToastHaptic> haptic SWIFT_PRIVATE;
|
|
56
|
+
std::optional<bool> shouldDismissByDrag SWIFT_PRIVATE;
|
|
57
|
+
std::optional<ToastFrom> from SWIFT_PRIVATE;
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
ToastOptions() = default;
|
|
61
|
+
explicit ToastOptions(std::string title, std::optional<std::string> message, std::optional<ToastPreset> preset, std::optional<double> duration, std::optional<ToastHaptic> haptic, std::optional<bool> shouldDismissByDrag, std::optional<ToastFrom> from): title(title), message(message), preset(preset), duration(duration), haptic(haptic), shouldDismissByDrag(shouldDismissByDrag), from(from) {}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
friend bool operator==(const ToastOptions& lhs, const ToastOptions& rhs) = default;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::nitrosimpletoast
|
|
68
|
+
|
|
69
|
+
namespace margelo::nitro {
|
|
70
|
+
|
|
71
|
+
// C++ ToastOptions <> JS ToastOptions (object)
|
|
72
|
+
template <>
|
|
73
|
+
struct JSIConverter<margelo::nitro::nitrosimpletoast::ToastOptions> final {
|
|
74
|
+
static inline margelo::nitro::nitrosimpletoast::ToastOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
75
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
76
|
+
return margelo::nitro::nitrosimpletoast::ToastOptions(
|
|
77
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title"))),
|
|
78
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message"))),
|
|
79
|
+
JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastPreset>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preset"))),
|
|
80
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
|
|
81
|
+
JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastHaptic>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "haptic"))),
|
|
82
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "shouldDismissByDrag"))),
|
|
83
|
+
JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastFrom>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "from")))
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrosimpletoast::ToastOptions& arg) {
|
|
87
|
+
jsi::Object obj(runtime);
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "title"), JSIConverter<std::string>::toJSI(runtime, arg.title));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "message"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.message));
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "preset"), JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastPreset>>::toJSI(runtime, arg.preset));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.duration));
|
|
92
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "haptic"), JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastHaptic>>::toJSI(runtime, arg.haptic));
|
|
93
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "shouldDismissByDrag"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.shouldDismissByDrag));
|
|
94
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "from"), JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastFrom>>::toJSI(runtime, arg.from));
|
|
95
|
+
return obj;
|
|
96
|
+
}
|
|
97
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
98
|
+
if (!value.isObject()) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
jsi::Object obj = value.getObject(runtime);
|
|
102
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title")))) return false;
|
|
106
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message")))) return false;
|
|
107
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastPreset>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preset")))) return false;
|
|
108
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
|
|
109
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastHaptic>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "haptic")))) return false;
|
|
110
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "shouldDismissByDrag")))) return false;
|
|
111
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitrosimpletoast::ToastFrom>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "from")))) return false;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ToastPreset.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/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitrosimpletoast {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (ToastPreset).
|
|
30
|
+
*/
|
|
31
|
+
enum class ToastPreset {
|
|
32
|
+
DONE SWIFT_NAME(done) = 0,
|
|
33
|
+
ERROR SWIFT_NAME(error) = 1,
|
|
34
|
+
NONE SWIFT_NAME(none) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nitrosimpletoast
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ ToastPreset <> JS ToastPreset (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nitrosimpletoast::ToastPreset> final {
|
|
44
|
+
static inline margelo::nitro::nitrosimpletoast::ToastPreset fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("done"): return margelo::nitro::nitrosimpletoast::ToastPreset::DONE;
|
|
48
|
+
case hashString("error"): return margelo::nitro::nitrosimpletoast::ToastPreset::ERROR;
|
|
49
|
+
case hashString("none"): return margelo::nitro::nitrosimpletoast::ToastPreset::NONE;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ToastPreset - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitrosimpletoast::ToastPreset arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nitrosimpletoast::ToastPreset::DONE: return JSIConverter<std::string>::toJSI(runtime, "done");
|
|
57
|
+
case margelo::nitro::nitrosimpletoast::ToastPreset::ERROR: return JSIConverter<std::string>::toJSI(runtime, "error");
|
|
58
|
+
case margelo::nitro::nitrosimpletoast::ToastPreset::NONE: return JSIConverter<std::string>::toJSI(runtime, "none");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert ToastPreset to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("done"):
|
|
71
|
+
case hashString("error"):
|
|
72
|
+
case hashString("none"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
package/package.json
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-nitro-simple-toast",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "react native simple toast powered by nitro",
|
|
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-simple-toast-example",
|
|
38
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
39
|
+
"prepare": "bob build",
|
|
40
|
+
"nitrogen": "nitrogen",
|
|
41
|
+
"typecheck": "tsc",
|
|
42
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
43
|
+
"test": "jest",
|
|
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/jeongshin/react-native-nitro-simple-toast.git"
|
|
54
|
+
},
|
|
55
|
+
"author": "Huckleberry Shin <sjeong1127@gmail.com> (https://github.com/jeongshin)",
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/jeongshin/react-native-nitro-simple-toast/issues"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://github.com/jeongshin/react-native-nitro-simple-toast#readme",
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"registry": "https://registry.npmjs.org/"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
66
|
+
"@eslint/compat": "^1.3.2",
|
|
67
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
68
|
+
"@eslint/js": "^9.35.0",
|
|
69
|
+
"@react-native/babel-preset": "0.83.0",
|
|
70
|
+
"@react-native/eslint-config": "0.83.0",
|
|
71
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
72
|
+
"@types/jest": "^29.5.14",
|
|
73
|
+
"@types/react": "^19.2.0",
|
|
74
|
+
"commitlint": "^19.8.1",
|
|
75
|
+
"del-cli": "^6.0.0",
|
|
76
|
+
"eslint": "^9.35.0",
|
|
77
|
+
"eslint-config-prettier": "^10.1.8",
|
|
78
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
79
|
+
"jest": "^29.7.0",
|
|
80
|
+
"lefthook": "^2.0.3",
|
|
81
|
+
"nitrogen": "^0.35.2",
|
|
82
|
+
"prettier": "^2.8.8",
|
|
83
|
+
"react": "19.2.0",
|
|
84
|
+
"react-native": "0.83.0",
|
|
85
|
+
"react-native-builder-bob": "^0.40.18",
|
|
86
|
+
"react-native-nitro-modules": "^0.35.2",
|
|
87
|
+
"release-it": "^19.0.4",
|
|
88
|
+
"turbo": "^2.5.6",
|
|
89
|
+
"typescript": "^5.9.2"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"react": "*",
|
|
93
|
+
"react-native": "*",
|
|
94
|
+
"react-native-nitro-modules": "^0.35.2"
|
|
95
|
+
},
|
|
96
|
+
"workspaces": [
|
|
97
|
+
"example"
|
|
98
|
+
],
|
|
99
|
+
"packageManager": "yarn@4.11.0",
|
|
100
|
+
"react-native-builder-bob": {
|
|
101
|
+
"source": "src",
|
|
102
|
+
"output": "lib",
|
|
103
|
+
"targets": [
|
|
104
|
+
[
|
|
105
|
+
"custom",
|
|
106
|
+
{
|
|
107
|
+
"script": "nitrogen",
|
|
108
|
+
"clean": "nitrogen/"
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"module",
|
|
113
|
+
{
|
|
114
|
+
"esm": true
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
[
|
|
118
|
+
"typescript",
|
|
119
|
+
{
|
|
120
|
+
"project": "tsconfig.build.json"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
"prettier": {
|
|
126
|
+
"quoteProps": "consistent",
|
|
127
|
+
"singleQuote": true,
|
|
128
|
+
"tabWidth": 2,
|
|
129
|
+
"trailingComma": "es5",
|
|
130
|
+
"useTabs": false
|
|
131
|
+
},
|
|
132
|
+
"jest": {
|
|
133
|
+
"preset": "react-native",
|
|
134
|
+
"modulePathIgnorePatterns": [
|
|
135
|
+
"<rootDir>/example/node_modules",
|
|
136
|
+
"<rootDir>/lib/"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"commitlint": {
|
|
140
|
+
"extends": [
|
|
141
|
+
"@commitlint/config-conventional"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"release-it": {
|
|
145
|
+
"git": {
|
|
146
|
+
"commitMessage": "chore: release ${version}",
|
|
147
|
+
"tagName": "v${version}"
|
|
148
|
+
},
|
|
149
|
+
"npm": {
|
|
150
|
+
"publish": true
|
|
151
|
+
},
|
|
152
|
+
"github": {
|
|
153
|
+
"release": true
|
|
154
|
+
},
|
|
155
|
+
"plugins": {
|
|
156
|
+
"@release-it/conventional-changelog": {
|
|
157
|
+
"preset": {
|
|
158
|
+
"name": "angular"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"create-react-native-library": {
|
|
164
|
+
"type": "nitro-module",
|
|
165
|
+
"languages": "kotlin-swift",
|
|
166
|
+
"tools": [
|
|
167
|
+
"eslint",
|
|
168
|
+
"jest",
|
|
169
|
+
"lefthook",
|
|
170
|
+
"release-it"
|
|
171
|
+
],
|
|
172
|
+
"version": "0.57.2"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
|
|
3
|
+
export type ToastPreset = 'done' | 'error' | 'none';
|
|
4
|
+
|
|
5
|
+
export type ToastHaptic = 'success' | 'warning' | 'error' | 'none';
|
|
6
|
+
|
|
7
|
+
export type ToastFrom = 'top' | 'bottom';
|
|
8
|
+
|
|
9
|
+
export interface ToastOptions {
|
|
10
|
+
title: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Defaults to `done`.
|
|
14
|
+
*/
|
|
15
|
+
preset?: ToastPreset;
|
|
16
|
+
/**
|
|
17
|
+
* Duration in seconds.
|
|
18
|
+
*/
|
|
19
|
+
duration?: number;
|
|
20
|
+
haptic?: ToastHaptic;
|
|
21
|
+
/**
|
|
22
|
+
* Defaults to `true`.
|
|
23
|
+
*/
|
|
24
|
+
shouldDismissByDrag?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Change the presentation side.
|
|
27
|
+
* @platform ios
|
|
28
|
+
*/
|
|
29
|
+
from?: ToastFrom;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface NitroSimpleToast
|
|
33
|
+
extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
|
|
34
|
+
show(options: ToastOptions): void;
|
|
35
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroSimpleToast, ToastOptions } from './NitroSimpleToast.nitro';
|
|
3
|
+
|
|
4
|
+
const NitroSimpleToastHybridObject =
|
|
5
|
+
NitroModules.createHybridObject<NitroSimpleToast>('NitroSimpleToast');
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
ToastOptions,
|
|
9
|
+
ToastPreset,
|
|
10
|
+
ToastHaptic,
|
|
11
|
+
ToastFrom,
|
|
12
|
+
} from './NitroSimpleToast.nitro';
|
|
13
|
+
|
|
14
|
+
export function toast(options: ToastOptions): void {
|
|
15
|
+
NitroSimpleToastHybridObject.show(options);
|
|
16
|
+
}
|