react-native-nitro-modal 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/NitroModal.podspec +29 -0
- package/README.md +39 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +124 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/BottomSheetPresenter.kt +284 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/HybridNitroModal.kt +312 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalConfig.kt +50 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalContentRoot.kt +115 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalPresenter.kt +253 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalHostView.kt +52 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalPackage.kt +28 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalViewManager.kt +67 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/PopupPresenter.kt +156 -0
- package/android/src/main/res/values/styles.xml +17 -0
- package/ios/BackdropView.swift +64 -0
- package/ios/HybridNitroModal.swift +329 -0
- package/ios/HybridNitroModalComponent+Children.mm +77 -0
- package/ios/ModalConfig.swift +73 -0
- package/ios/NitroModalHostView.swift +91 -0
- package/ios/PopupViewController.swift +223 -0
- package/ios/SheetViewController.swift +244 -0
- package/lib/module/NitroModal.js +188 -0
- package/lib/module/NitroModal.js.map +1 -0
- package/lib/module/NitroModal.nitro.js +4 -0
- package/lib/module/NitroModal.nitro.js.map +1 -0
- package/lib/module/NitroModalView.js +17 -0
- package/lib/module/NitroModalView.js.map +1 -0
- package/lib/module/NitroModalView.native.js +6 -0
- package/lib/module/NitroModalView.native.js.map +1 -0
- package/lib/module/index.js +4 -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/NitroModal.d.ts +59 -0
- package/lib/typescript/src/NitroModal.d.ts.map +1 -0
- package/lib/typescript/src/NitroModal.nitro.d.ts +78 -0
- package/lib/typescript/src/NitroModal.nitro.d.ts.map +1 -0
- package/lib/typescript/src/NitroModalView.d.ts +4 -0
- package/lib/typescript/src/NitroModalView.d.ts.map +1 -0
- package/lib/typescript/src/NitroModalView.native.d.ts +3 -0
- package/lib/typescript/src/NitroModalView.native.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JDismissReason.hpp +64 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_DismissReason.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_ModalContentArea.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.cpp +344 -0
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.hpp +106 -0
- package/nitrogen/generated/android/c++/JKeyboardBehavior.hpp +61 -0
- package/nitrogen/generated/android/c++/JModalContentArea.hpp +61 -0
- package/nitrogen/generated/android/c++/JModalMode.hpp +58 -0
- package/nitrogen/generated/android/c++/JPopupAnimation.hpp +61 -0
- package/nitrogen/generated/android/c++/JSheetDetent.hpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroModalStateUpdater.cpp +174 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroModalStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/DismissReason.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/Func_void.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/Func_void_DismissReason.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/Func_void_ModalContentArea.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/Func_void_double.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/HybridNitroModalSpec.kt +237 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/KeyboardBehavior.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/ModalContentArea.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/ModalMode.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/PopupAnimation.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/SheetDetent.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/nitromodalOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/views/HybridNitroModalManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/views/HybridNitroModalStateUpdater.kt +23 -0
- package/nitrogen/generated/android/nitromodal+autolinking.cmake +83 -0
- package/nitrogen/generated/android/nitromodal+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nitromodalOnLoad.cpp +64 -0
- package/nitrogen/generated/android/nitromodalOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NitroModal+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Bridge.hpp +237 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Umbrella.hpp +64 -0
- package/nitrogen/generated/ios/NitroModalAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroModalAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroModalSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroModalSpecSwift.hpp +247 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroModalComponent.mm +264 -0
- package/nitrogen/generated/ios/swift/DismissReason.swift +48 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_DismissReason.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_ModalContentArea.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec.swift +77 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec_cxx.swift +554 -0
- package/nitrogen/generated/ios/swift/KeyboardBehavior.swift +44 -0
- package/nitrogen/generated/ios/swift/ModalContentArea.swift +34 -0
- package/nitrogen/generated/ios/swift/ModalMode.swift +40 -0
- package/nitrogen/generated/ios/swift/PopupAnimation.swift +44 -0
- package/nitrogen/generated/ios/swift/SheetDetent.swift +48 -0
- package/nitrogen/generated/shared/c++/DismissReason.hpp +84 -0
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.cpp +65 -0
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.hpp +124 -0
- package/nitrogen/generated/shared/c++/KeyboardBehavior.hpp +80 -0
- package/nitrogen/generated/shared/c++/ModalContentArea.hpp +87 -0
- package/nitrogen/generated/shared/c++/ModalMode.hpp +76 -0
- package/nitrogen/generated/shared/c++/PopupAnimation.hpp +80 -0
- package/nitrogen/generated/shared/c++/SheetDetent.hpp +84 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.cpp +74 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.hpp +151 -0
- package/nitrogen/generated/shared/json/NitroModalConfig.json +30 -0
- package/package.json +183 -0
- package/src/NitroModal.nitro.ts +92 -0
- package/src/NitroModal.tsx +292 -0
- package/src/NitroModalView.native.tsx +8 -0
- package/src/NitroModalView.tsx +24 -0
- package/src/index.tsx +12 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroModalAutolinking.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class NitroModalAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.nitromodal.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createNitroModal() -> bridge.std__shared_ptr_HybridNitroModalSpec_ {
|
|
16
|
+
let hybridObject = HybridNitroModal()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridNitroModalSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isNitroModalRecyclable() -> Bool {
|
|
24
|
+
return HybridNitroModal.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroModalSpecSwift.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 "HybridNitroModalSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitromodal {
|
|
11
|
+
} // namespace margelo::nitro::nitromodal
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroModalSpecSwift.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
|
+
#include "HybridNitroModalSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridNitroModalSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroModal { class HybridNitroModalSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `ModalMode` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitromodal { enum class ModalMode; }
|
|
17
|
+
// Forward declaration of `SheetDetent` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitromodal { enum class SheetDetent; }
|
|
19
|
+
// Forward declaration of `KeyboardBehavior` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitromodal { enum class KeyboardBehavior; }
|
|
21
|
+
// Forward declaration of `PopupAnimation` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitromodal { enum class PopupAnimation; }
|
|
23
|
+
// Forward declaration of `DismissReason` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitromodal { enum class DismissReason; }
|
|
25
|
+
// Forward declaration of `ModalContentArea` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::nitromodal { struct ModalContentArea; }
|
|
27
|
+
|
|
28
|
+
#include "ModalMode.hpp"
|
|
29
|
+
#include "SheetDetent.hpp"
|
|
30
|
+
#include <vector>
|
|
31
|
+
#include <optional>
|
|
32
|
+
#include "KeyboardBehavior.hpp"
|
|
33
|
+
#include "PopupAnimation.hpp"
|
|
34
|
+
#include <functional>
|
|
35
|
+
#include "DismissReason.hpp"
|
|
36
|
+
#include "ModalContentArea.hpp"
|
|
37
|
+
|
|
38
|
+
#include "NitroModal-Swift-Cxx-Umbrella.hpp"
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro::nitromodal {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The C++ part of HybridNitroModalSpec_cxx.swift.
|
|
44
|
+
*
|
|
45
|
+
* HybridNitroModalSpecSwift (C++) accesses HybridNitroModalSpec_cxx (Swift), and might
|
|
46
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
47
|
+
*
|
|
48
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
49
|
+
* the future, HybridNitroModalSpec_cxx can directly inherit from the C++ class HybridNitroModalSpec
|
|
50
|
+
* to simplify the whole structure and memory management.
|
|
51
|
+
*/
|
|
52
|
+
class HybridNitroModalSpecSwift: public virtual HybridNitroModalSpec {
|
|
53
|
+
public:
|
|
54
|
+
// Constructor from a Swift instance
|
|
55
|
+
explicit HybridNitroModalSpecSwift(const NitroModal::HybridNitroModalSpec_cxx& swiftPart):
|
|
56
|
+
HybridObject(HybridNitroModalSpec::TAG),
|
|
57
|
+
_swiftPart(swiftPart) { }
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
// Get the Swift part
|
|
61
|
+
inline NitroModal::HybridNitroModalSpec_cxx& getSwiftPart() noexcept {
|
|
62
|
+
return _swiftPart;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
67
|
+
return _swiftPart.getMemorySize();
|
|
68
|
+
}
|
|
69
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
70
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNitroModalSpecSwift>(other)) {
|
|
71
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
void dispose() noexcept override {
|
|
76
|
+
_swiftPart.dispose();
|
|
77
|
+
}
|
|
78
|
+
std::string toString() override {
|
|
79
|
+
return _swiftPart.toString();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
|
+
// Properties
|
|
84
|
+
inline bool getIsOpen() noexcept override {
|
|
85
|
+
return _swiftPart.isOpen();
|
|
86
|
+
}
|
|
87
|
+
inline void setIsOpen(bool isOpen) noexcept override {
|
|
88
|
+
_swiftPart.setIsOpen(std::forward<decltype(isOpen)>(isOpen));
|
|
89
|
+
}
|
|
90
|
+
inline ModalMode getMode() noexcept override {
|
|
91
|
+
auto __result = _swiftPart.getMode();
|
|
92
|
+
return static_cast<ModalMode>(__result);
|
|
93
|
+
}
|
|
94
|
+
inline void setMode(ModalMode mode) noexcept override {
|
|
95
|
+
_swiftPart.setMode(static_cast<int>(mode));
|
|
96
|
+
}
|
|
97
|
+
inline std::vector<SheetDetent> getDetents() noexcept override {
|
|
98
|
+
auto __result = _swiftPart.getDetents();
|
|
99
|
+
return __result;
|
|
100
|
+
}
|
|
101
|
+
inline void setDetents(const std::vector<SheetDetent>& detents) noexcept override {
|
|
102
|
+
_swiftPart.setDetents(detents);
|
|
103
|
+
}
|
|
104
|
+
inline double getInitialDetentIndex() noexcept override {
|
|
105
|
+
return _swiftPart.getInitialDetentIndex();
|
|
106
|
+
}
|
|
107
|
+
inline void setInitialDetentIndex(double initialDetentIndex) noexcept override {
|
|
108
|
+
_swiftPart.setInitialDetentIndex(std::forward<decltype(initialDetentIndex)>(initialDetentIndex));
|
|
109
|
+
}
|
|
110
|
+
inline double getBackdropColor() noexcept override {
|
|
111
|
+
return _swiftPart.getBackdropColor();
|
|
112
|
+
}
|
|
113
|
+
inline void setBackdropColor(double backdropColor) noexcept override {
|
|
114
|
+
_swiftPart.setBackdropColor(std::forward<decltype(backdropColor)>(backdropColor));
|
|
115
|
+
}
|
|
116
|
+
inline double getBackdropOpacity() noexcept override {
|
|
117
|
+
return _swiftPart.getBackdropOpacity();
|
|
118
|
+
}
|
|
119
|
+
inline void setBackdropOpacity(double backdropOpacity) noexcept override {
|
|
120
|
+
_swiftPart.setBackdropOpacity(std::forward<decltype(backdropOpacity)>(backdropOpacity));
|
|
121
|
+
}
|
|
122
|
+
inline double getBackdropBlurRadius() noexcept override {
|
|
123
|
+
return _swiftPart.getBackdropBlurRadius();
|
|
124
|
+
}
|
|
125
|
+
inline void setBackdropBlurRadius(double backdropBlurRadius) noexcept override {
|
|
126
|
+
_swiftPart.setBackdropBlurRadius(std::forward<decltype(backdropBlurRadius)>(backdropBlurRadius));
|
|
127
|
+
}
|
|
128
|
+
inline bool getDismissOnBackdropPress() noexcept override {
|
|
129
|
+
return _swiftPart.getDismissOnBackdropPress();
|
|
130
|
+
}
|
|
131
|
+
inline void setDismissOnBackdropPress(bool dismissOnBackdropPress) noexcept override {
|
|
132
|
+
_swiftPart.setDismissOnBackdropPress(std::forward<decltype(dismissOnBackdropPress)>(dismissOnBackdropPress));
|
|
133
|
+
}
|
|
134
|
+
inline bool getDismissOnSwipe() noexcept override {
|
|
135
|
+
return _swiftPart.getDismissOnSwipe();
|
|
136
|
+
}
|
|
137
|
+
inline void setDismissOnSwipe(bool dismissOnSwipe) noexcept override {
|
|
138
|
+
_swiftPart.setDismissOnSwipe(std::forward<decltype(dismissOnSwipe)>(dismissOnSwipe));
|
|
139
|
+
}
|
|
140
|
+
inline bool getDismissOnBackButton() noexcept override {
|
|
141
|
+
return _swiftPart.getDismissOnBackButton();
|
|
142
|
+
}
|
|
143
|
+
inline void setDismissOnBackButton(bool dismissOnBackButton) noexcept override {
|
|
144
|
+
_swiftPart.setDismissOnBackButton(std::forward<decltype(dismissOnBackButton)>(dismissOnBackButton));
|
|
145
|
+
}
|
|
146
|
+
inline bool getGrabberVisible() noexcept override {
|
|
147
|
+
return _swiftPart.getGrabberVisible();
|
|
148
|
+
}
|
|
149
|
+
inline void setGrabberVisible(bool grabberVisible) noexcept override {
|
|
150
|
+
_swiftPart.setGrabberVisible(std::forward<decltype(grabberVisible)>(grabberVisible));
|
|
151
|
+
}
|
|
152
|
+
inline double getCornerRadius() noexcept override {
|
|
153
|
+
return _swiftPart.getCornerRadius();
|
|
154
|
+
}
|
|
155
|
+
inline void setCornerRadius(double cornerRadius) noexcept override {
|
|
156
|
+
_swiftPart.setCornerRadius(std::forward<decltype(cornerRadius)>(cornerRadius));
|
|
157
|
+
}
|
|
158
|
+
inline std::optional<double> getContentBackgroundColor() noexcept override {
|
|
159
|
+
auto __result = _swiftPart.getContentBackgroundColor();
|
|
160
|
+
return __result;
|
|
161
|
+
}
|
|
162
|
+
inline void setContentBackgroundColor(std::optional<double> contentBackgroundColor) noexcept override {
|
|
163
|
+
_swiftPart.setContentBackgroundColor(contentBackgroundColor);
|
|
164
|
+
}
|
|
165
|
+
inline KeyboardBehavior getKeyboardBehavior() noexcept override {
|
|
166
|
+
auto __result = _swiftPart.getKeyboardBehavior();
|
|
167
|
+
return static_cast<KeyboardBehavior>(__result);
|
|
168
|
+
}
|
|
169
|
+
inline void setKeyboardBehavior(KeyboardBehavior keyboardBehavior) noexcept override {
|
|
170
|
+
_swiftPart.setKeyboardBehavior(static_cast<int>(keyboardBehavior));
|
|
171
|
+
}
|
|
172
|
+
inline PopupAnimation getPopupAnimation() noexcept override {
|
|
173
|
+
auto __result = _swiftPart.getPopupAnimation();
|
|
174
|
+
return static_cast<PopupAnimation>(__result);
|
|
175
|
+
}
|
|
176
|
+
inline void setPopupAnimation(PopupAnimation popupAnimation) noexcept override {
|
|
177
|
+
_swiftPart.setPopupAnimation(static_cast<int>(popupAnimation));
|
|
178
|
+
}
|
|
179
|
+
inline std::optional<std::function<void()>> getOnPresent() noexcept override {
|
|
180
|
+
auto __result = _swiftPart.getOnPresent();
|
|
181
|
+
return __result;
|
|
182
|
+
}
|
|
183
|
+
inline void setOnPresent(const std::optional<std::function<void()>>& onPresent) noexcept override {
|
|
184
|
+
_swiftPart.setOnPresent(onPresent);
|
|
185
|
+
}
|
|
186
|
+
inline std::optional<std::function<void(DismissReason /* reason */)>> getOnDismiss() noexcept override {
|
|
187
|
+
auto __result = _swiftPart.getOnDismiss();
|
|
188
|
+
return __result;
|
|
189
|
+
}
|
|
190
|
+
inline void setOnDismiss(const std::optional<std::function<void(DismissReason /* reason */)>>& onDismiss) noexcept override {
|
|
191
|
+
_swiftPart.setOnDismiss(onDismiss);
|
|
192
|
+
}
|
|
193
|
+
inline std::optional<std::function<void(double /* index */)>> getOnDetentChange() noexcept override {
|
|
194
|
+
auto __result = _swiftPart.getOnDetentChange();
|
|
195
|
+
return __result;
|
|
196
|
+
}
|
|
197
|
+
inline void setOnDetentChange(const std::optional<std::function<void(double /* index */)>>& onDetentChange) noexcept override {
|
|
198
|
+
_swiftPart.setOnDetentChange(onDetentChange);
|
|
199
|
+
}
|
|
200
|
+
inline std::optional<std::function<void()>> getOnBackdropPress() noexcept override {
|
|
201
|
+
auto __result = _swiftPart.getOnBackdropPress();
|
|
202
|
+
return __result;
|
|
203
|
+
}
|
|
204
|
+
inline void setOnBackdropPress(const std::optional<std::function<void()>>& onBackdropPress) noexcept override {
|
|
205
|
+
_swiftPart.setOnBackdropPress(onBackdropPress);
|
|
206
|
+
}
|
|
207
|
+
inline std::optional<std::function<void()>> getOnBackButtonPress() noexcept override {
|
|
208
|
+
auto __result = _swiftPart.getOnBackButtonPress();
|
|
209
|
+
return __result;
|
|
210
|
+
}
|
|
211
|
+
inline void setOnBackButtonPress(const std::optional<std::function<void()>>& onBackButtonPress) noexcept override {
|
|
212
|
+
_swiftPart.setOnBackButtonPress(onBackButtonPress);
|
|
213
|
+
}
|
|
214
|
+
inline std::optional<std::function<void(const ModalContentArea& /* area */)>> getOnContentAreaChange() noexcept override {
|
|
215
|
+
auto __result = _swiftPart.getOnContentAreaChange();
|
|
216
|
+
return __result;
|
|
217
|
+
}
|
|
218
|
+
inline void setOnContentAreaChange(const std::optional<std::function<void(const ModalContentArea& /* area */)>>& onContentAreaChange) noexcept override {
|
|
219
|
+
_swiftPart.setOnContentAreaChange(onContentAreaChange);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
public:
|
|
223
|
+
// Methods
|
|
224
|
+
inline void present() override {
|
|
225
|
+
auto __result = _swiftPart.present();
|
|
226
|
+
if (__result.hasError()) [[unlikely]] {
|
|
227
|
+
std::rethrow_exception(__result.error());
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
inline void dismiss() override {
|
|
231
|
+
auto __result = _swiftPart.dismiss();
|
|
232
|
+
if (__result.hasError()) [[unlikely]] {
|
|
233
|
+
std::rethrow_exception(__result.error());
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
inline void snapToDetent(double index) override {
|
|
237
|
+
auto __result = _swiftPart.snapToDetent(std::forward<decltype(index)>(index));
|
|
238
|
+
if (__result.hasError()) [[unlikely]] {
|
|
239
|
+
std::rethrow_exception(__result.error());
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private:
|
|
244
|
+
NitroModal::HybridNitroModalSpec_cxx _swiftPart;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
} // namespace margelo::nitro::nitromodal
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroModalComponent.mm
|
|
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
|
+
#import "HybridNitroModalComponent.hpp"
|
|
9
|
+
#import <memory>
|
|
10
|
+
#import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <React/RCTComponentViewFactory.h>
|
|
13
|
+
#import <React/UIView+ComponentViewProtocol.h>
|
|
14
|
+
#import <NitroModules/NitroDefines.hpp>
|
|
15
|
+
#import <UIKit/UIKit.h>
|
|
16
|
+
|
|
17
|
+
#import "HybridNitroModalSpecSwift.hpp"
|
|
18
|
+
#import "NitroModal-Swift-Cxx-Umbrella.hpp"
|
|
19
|
+
|
|
20
|
+
#if __has_include(<cxxreact/ReactNativeVersion.h>)
|
|
21
|
+
#include <cxxreact/ReactNativeVersion.h>
|
|
22
|
+
#if REACT_NATIVE_VERSION_MINOR >= 82
|
|
23
|
+
#define ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
24
|
+
#endif
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
using namespace facebook;
|
|
28
|
+
using namespace margelo::nitro::nitromodal;
|
|
29
|
+
using namespace margelo::nitro::nitromodal::views;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Represents the React Native View holder for the Nitro "NitroModal" HybridView.
|
|
33
|
+
*/
|
|
34
|
+
@interface HybridNitroModalComponent: RCTViewComponentView
|
|
35
|
+
+ (BOOL)shouldBeRecycled;
|
|
36
|
+
@end
|
|
37
|
+
|
|
38
|
+
@implementation HybridNitroModalComponent {
|
|
39
|
+
std::shared_ptr<HybridNitroModalSpecSwift> _hybridView;
|
|
40
|
+
BOOL _didDropView;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
+ (void) load {
|
|
44
|
+
[super load];
|
|
45
|
+
[RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:[HybridNitroModalComponent class]];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
+ (react::ComponentDescriptorProvider) componentDescriptorProvider {
|
|
49
|
+
return react::concreteComponentDescriptorProvider<HybridNitroModalComponentDescriptor>();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (instancetype) init {
|
|
53
|
+
if (self = [super init]) {
|
|
54
|
+
_props = HybridNitroModalShadowNode::defaultSharedProps();
|
|
55
|
+
std::shared_ptr<HybridNitroModalSpec> hybridView = NitroModal::NitroModalAutolinking::createNitroModal();
|
|
56
|
+
_hybridView = std::dynamic_pointer_cast<HybridNitroModalSpecSwift>(hybridView);
|
|
57
|
+
[self updateView];
|
|
58
|
+
}
|
|
59
|
+
return self;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (void) updateView {
|
|
63
|
+
// 1. Get Swift part
|
|
64
|
+
NitroModal::HybridNitroModalSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
65
|
+
|
|
66
|
+
// 2. Get UIView*
|
|
67
|
+
void* viewUnsafe = swiftPart.getView();
|
|
68
|
+
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
|
|
69
|
+
|
|
70
|
+
// 3. Update RCTViewComponentView's [contentView]
|
|
71
|
+
[self setContentView:view];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (void) notifyOnDropView {
|
|
75
|
+
// A recycled component can later be invalidated. Notify only once per mount.
|
|
76
|
+
if (_didDropView) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
NitroModal::HybridNitroModalSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
80
|
+
swiftPart.onDropView();
|
|
81
|
+
_didDropView = YES;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
- (void) updateProps:(const std::shared_ptr<const react::Props>&)props
|
|
85
|
+
oldProps:(const std::shared_ptr<const react::Props>&)oldProps {
|
|
86
|
+
// A props update marks a newly mounted or still-active component.
|
|
87
|
+
_didDropView = NO;
|
|
88
|
+
|
|
89
|
+
// 1. Downcast props
|
|
90
|
+
const auto& newViewProps = *std::static_pointer_cast<const HybridNitroModalProps>(props);
|
|
91
|
+
const auto* oldViewProps = static_cast<const HybridNitroModalProps*>(oldProps.get());
|
|
92
|
+
NitroModal::HybridNitroModalSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
93
|
+
|
|
94
|
+
// 2. Update only props that differ from the previous Props snapshot.
|
|
95
|
+
const bool hasTransactionPropChanges = oldViewProps == nullptr
|
|
96
|
+
? newViewProps.hasAnyProvidedProps()
|
|
97
|
+
: !newViewProps.hasSameProps(*oldViewProps);
|
|
98
|
+
if (hasTransactionPropChanges) {
|
|
99
|
+
swiftPart.beforeUpdate();
|
|
100
|
+
|
|
101
|
+
// isOpen: boolean
|
|
102
|
+
if (oldViewProps == nullptr
|
|
103
|
+
? newViewProps.isOpen.isProvided()
|
|
104
|
+
: !newViewProps.isOpen.hasSameValue(oldViewProps->isOpen)) {
|
|
105
|
+
swiftPart.setIsOpen(newViewProps.isOpen.get());
|
|
106
|
+
}
|
|
107
|
+
// mode: enum
|
|
108
|
+
if (oldViewProps == nullptr
|
|
109
|
+
? newViewProps.mode.isProvided()
|
|
110
|
+
: !newViewProps.mode.hasSameValue(oldViewProps->mode)) {
|
|
111
|
+
swiftPart.setMode(static_cast<int>(newViewProps.mode.get()));
|
|
112
|
+
}
|
|
113
|
+
// detents: array
|
|
114
|
+
if (oldViewProps == nullptr
|
|
115
|
+
? newViewProps.detents.isProvided()
|
|
116
|
+
: !newViewProps.detents.hasSameValue(oldViewProps->detents)) {
|
|
117
|
+
swiftPart.setDetents(newViewProps.detents.get());
|
|
118
|
+
}
|
|
119
|
+
// initialDetentIndex: number
|
|
120
|
+
if (oldViewProps == nullptr
|
|
121
|
+
? newViewProps.initialDetentIndex.isProvided()
|
|
122
|
+
: !newViewProps.initialDetentIndex.hasSameValue(oldViewProps->initialDetentIndex)) {
|
|
123
|
+
swiftPart.setInitialDetentIndex(newViewProps.initialDetentIndex.get());
|
|
124
|
+
}
|
|
125
|
+
// backdropColor: number
|
|
126
|
+
if (oldViewProps == nullptr
|
|
127
|
+
? newViewProps.backdropColor.isProvided()
|
|
128
|
+
: !newViewProps.backdropColor.hasSameValue(oldViewProps->backdropColor)) {
|
|
129
|
+
swiftPart.setBackdropColor(newViewProps.backdropColor.get());
|
|
130
|
+
}
|
|
131
|
+
// backdropOpacity: number
|
|
132
|
+
if (oldViewProps == nullptr
|
|
133
|
+
? newViewProps.backdropOpacity.isProvided()
|
|
134
|
+
: !newViewProps.backdropOpacity.hasSameValue(oldViewProps->backdropOpacity)) {
|
|
135
|
+
swiftPart.setBackdropOpacity(newViewProps.backdropOpacity.get());
|
|
136
|
+
}
|
|
137
|
+
// backdropBlurRadius: number
|
|
138
|
+
if (oldViewProps == nullptr
|
|
139
|
+
? newViewProps.backdropBlurRadius.isProvided()
|
|
140
|
+
: !newViewProps.backdropBlurRadius.hasSameValue(oldViewProps->backdropBlurRadius)) {
|
|
141
|
+
swiftPart.setBackdropBlurRadius(newViewProps.backdropBlurRadius.get());
|
|
142
|
+
}
|
|
143
|
+
// dismissOnBackdropPress: boolean
|
|
144
|
+
if (oldViewProps == nullptr
|
|
145
|
+
? newViewProps.dismissOnBackdropPress.isProvided()
|
|
146
|
+
: !newViewProps.dismissOnBackdropPress.hasSameValue(oldViewProps->dismissOnBackdropPress)) {
|
|
147
|
+
swiftPart.setDismissOnBackdropPress(newViewProps.dismissOnBackdropPress.get());
|
|
148
|
+
}
|
|
149
|
+
// dismissOnSwipe: boolean
|
|
150
|
+
if (oldViewProps == nullptr
|
|
151
|
+
? newViewProps.dismissOnSwipe.isProvided()
|
|
152
|
+
: !newViewProps.dismissOnSwipe.hasSameValue(oldViewProps->dismissOnSwipe)) {
|
|
153
|
+
swiftPart.setDismissOnSwipe(newViewProps.dismissOnSwipe.get());
|
|
154
|
+
}
|
|
155
|
+
// dismissOnBackButton: boolean
|
|
156
|
+
if (oldViewProps == nullptr
|
|
157
|
+
? newViewProps.dismissOnBackButton.isProvided()
|
|
158
|
+
: !newViewProps.dismissOnBackButton.hasSameValue(oldViewProps->dismissOnBackButton)) {
|
|
159
|
+
swiftPart.setDismissOnBackButton(newViewProps.dismissOnBackButton.get());
|
|
160
|
+
}
|
|
161
|
+
// grabberVisible: boolean
|
|
162
|
+
if (oldViewProps == nullptr
|
|
163
|
+
? newViewProps.grabberVisible.isProvided()
|
|
164
|
+
: !newViewProps.grabberVisible.hasSameValue(oldViewProps->grabberVisible)) {
|
|
165
|
+
swiftPart.setGrabberVisible(newViewProps.grabberVisible.get());
|
|
166
|
+
}
|
|
167
|
+
// cornerRadius: number
|
|
168
|
+
if (oldViewProps == nullptr
|
|
169
|
+
? newViewProps.cornerRadius.isProvided()
|
|
170
|
+
: !newViewProps.cornerRadius.hasSameValue(oldViewProps->cornerRadius)) {
|
|
171
|
+
swiftPart.setCornerRadius(newViewProps.cornerRadius.get());
|
|
172
|
+
}
|
|
173
|
+
// contentBackgroundColor: optional
|
|
174
|
+
if (oldViewProps == nullptr
|
|
175
|
+
? newViewProps.contentBackgroundColor.isProvided()
|
|
176
|
+
: !newViewProps.contentBackgroundColor.hasSameValue(oldViewProps->contentBackgroundColor)) {
|
|
177
|
+
swiftPart.setContentBackgroundColor(newViewProps.contentBackgroundColor.get());
|
|
178
|
+
}
|
|
179
|
+
// keyboardBehavior: enum
|
|
180
|
+
if (oldViewProps == nullptr
|
|
181
|
+
? newViewProps.keyboardBehavior.isProvided()
|
|
182
|
+
: !newViewProps.keyboardBehavior.hasSameValue(oldViewProps->keyboardBehavior)) {
|
|
183
|
+
swiftPart.setKeyboardBehavior(static_cast<int>(newViewProps.keyboardBehavior.get()));
|
|
184
|
+
}
|
|
185
|
+
// popupAnimation: enum
|
|
186
|
+
if (oldViewProps == nullptr
|
|
187
|
+
? newViewProps.popupAnimation.isProvided()
|
|
188
|
+
: !newViewProps.popupAnimation.hasSameValue(oldViewProps->popupAnimation)) {
|
|
189
|
+
swiftPart.setPopupAnimation(static_cast<int>(newViewProps.popupAnimation.get()));
|
|
190
|
+
}
|
|
191
|
+
// onPresent: optional
|
|
192
|
+
if (oldViewProps == nullptr
|
|
193
|
+
? newViewProps.onPresent.isProvided()
|
|
194
|
+
: !newViewProps.onPresent.hasSameValue(oldViewProps->onPresent)) {
|
|
195
|
+
swiftPart.setOnPresent(newViewProps.onPresent.get());
|
|
196
|
+
}
|
|
197
|
+
// onDismiss: optional
|
|
198
|
+
if (oldViewProps == nullptr
|
|
199
|
+
? newViewProps.onDismiss.isProvided()
|
|
200
|
+
: !newViewProps.onDismiss.hasSameValue(oldViewProps->onDismiss)) {
|
|
201
|
+
swiftPart.setOnDismiss(newViewProps.onDismiss.get());
|
|
202
|
+
}
|
|
203
|
+
// onDetentChange: optional
|
|
204
|
+
if (oldViewProps == nullptr
|
|
205
|
+
? newViewProps.onDetentChange.isProvided()
|
|
206
|
+
: !newViewProps.onDetentChange.hasSameValue(oldViewProps->onDetentChange)) {
|
|
207
|
+
swiftPart.setOnDetentChange(newViewProps.onDetentChange.get());
|
|
208
|
+
}
|
|
209
|
+
// onBackdropPress: optional
|
|
210
|
+
if (oldViewProps == nullptr
|
|
211
|
+
? newViewProps.onBackdropPress.isProvided()
|
|
212
|
+
: !newViewProps.onBackdropPress.hasSameValue(oldViewProps->onBackdropPress)) {
|
|
213
|
+
swiftPart.setOnBackdropPress(newViewProps.onBackdropPress.get());
|
|
214
|
+
}
|
|
215
|
+
// onBackButtonPress: optional
|
|
216
|
+
if (oldViewProps == nullptr
|
|
217
|
+
? newViewProps.onBackButtonPress.isProvided()
|
|
218
|
+
: !newViewProps.onBackButtonPress.hasSameValue(oldViewProps->onBackButtonPress)) {
|
|
219
|
+
swiftPart.setOnBackButtonPress(newViewProps.onBackButtonPress.get());
|
|
220
|
+
}
|
|
221
|
+
// onContentAreaChange: optional
|
|
222
|
+
if (oldViewProps == nullptr
|
|
223
|
+
? newViewProps.onContentAreaChange.isProvided()
|
|
224
|
+
: !newViewProps.onContentAreaChange.hasSameValue(oldViewProps->onContentAreaChange)) {
|
|
225
|
+
swiftPart.setOnContentAreaChange(newViewProps.onContentAreaChange.get());
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Update hybridRef if it changed
|
|
229
|
+
if (oldViewProps == nullptr
|
|
230
|
+
? newViewProps.hybridRef.isProvided()
|
|
231
|
+
: !newViewProps.hybridRef.hasSameValue(oldViewProps->hybridRef)) {
|
|
232
|
+
// hybridRef changed - call it with new this
|
|
233
|
+
const auto& maybeFunc = newViewProps.hybridRef.get();
|
|
234
|
+
if (maybeFunc.has_value()) {
|
|
235
|
+
maybeFunc.value()(_hybridView);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
swiftPart.afterUpdate();
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// 3. Continue in base class
|
|
243
|
+
[super updateProps:props oldProps:oldProps];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
+ (BOOL)shouldBeRecycled {
|
|
247
|
+
return NitroModal::NitroModalAutolinking::isNitroModalRecyclable();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
- (void)prepareForRecycle {
|
|
251
|
+
[self notifyOnDropView];
|
|
252
|
+
[super prepareForRecycle];
|
|
253
|
+
NitroModal::HybridNitroModalSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
254
|
+
swiftPart.maybePrepareForRecycle();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
#ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
258
|
+
- (void)invalidate {
|
|
259
|
+
[self notifyOnDropView];
|
|
260
|
+
[super invalidate];
|
|
261
|
+
}
|
|
262
|
+
#endif
|
|
263
|
+
|
|
264
|
+
@end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// DismissReason.swift
|
|
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
|
+
/**
|
|
9
|
+
* Represents the JS union `DismissReason`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias DismissReason = margelo.nitro.nitromodal.DismissReason
|
|
12
|
+
|
|
13
|
+
public extension DismissReason {
|
|
14
|
+
/**
|
|
15
|
+
* Get a DismissReason for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "programmatic":
|
|
21
|
+
self = .programmatic
|
|
22
|
+
case "swipe":
|
|
23
|
+
self = .swipe
|
|
24
|
+
case "backdrop":
|
|
25
|
+
self = .backdrop
|
|
26
|
+
case "backButton":
|
|
27
|
+
self = .backbutton
|
|
28
|
+
default:
|
|
29
|
+
return nil
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the String value this DismissReason represents.
|
|
35
|
+
*/
|
|
36
|
+
var stringValue: String {
|
|
37
|
+
switch self {
|
|
38
|
+
case .programmatic:
|
|
39
|
+
return "programmatic"
|
|
40
|
+
case .swipe:
|
|
41
|
+
return "swipe"
|
|
42
|
+
case .backdrop:
|
|
43
|
+
return "backdrop"
|
|
44
|
+
case .backbutton:
|
|
45
|
+
return "backButton"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `() -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void {
|
|
15
|
+
public typealias bridge = margelo.nitro.nitromodal.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: () -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping () -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call() -> Void {
|
|
25
|
+
self.closure()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
|
|
44
|
+
return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_DismissReason.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ reason: DismissReason) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_DismissReason {
|
|
15
|
+
public typealias bridge = margelo.nitro.nitromodal.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ reason: DismissReason) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ reason: DismissReason) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(reason: Int32) -> Void {
|
|
25
|
+
self.closure(margelo.nitro.nitromodal.DismissReason(rawValue: reason)!)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_DismissReason`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_DismissReason>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_DismissReason {
|
|
44
|
+
return Unmanaged<Func_void_DismissReason>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|