react-nitro-navigation 0.0.0-stage → 0.0.1-alpha.7
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 +21 -0
- package/Package.swift +104 -0
- package/README.md +20 -2
- package/Sources/ReactNitroNavigation/HybridNavigationScreen.swift +27 -0
- package/Sources/ReactNitroNavigation/HybridNavigationStack.swift +103 -0
- package/Sources/ReactNitroNavigation/NavigationControllerDelegate.swift +11 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/apple/ReactNitroNavigation-Swift-Cxx-Bridge.cpp +109 -0
- package/nitrogen/generated/apple/ReactNitroNavigationAppleCxx/ReactNitroNavigationAppleCxx.cpp +9 -0
- package/nitrogen/generated/apple/ReactNitroNavigationAppleCxx/include/ReactNitroNavigationAppleCxx/ReactNitroNavigationAppleCxx.h +120 -0
- package/nitrogen/generated/apple/ReactNitroNavigationAutolinking.cpp +22 -0
- package/nitrogen/generated/apple/ReactNitroNavigationAutolinking.mm +24 -0
- package/nitrogen/generated/apple/c++/HybridNavigationScreenSpecSwift.cpp +54 -0
- package/nitrogen/generated/apple/c++/HybridNavigationScreenSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/HybridNavigationStackSpecSwift.cpp +69 -0
- package/nitrogen/generated/apple/c++/HybridNavigationStackSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/ListenerSubscription-Swift.cpp +37 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/ReactNitroNavigationAutolinking.hpp +13 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/HybridNavigationScreenSpecSwift.hpp +75 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/HybridNavigationScreenSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/HybridNavigationStackSpecSwift.hpp +75 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/HybridNavigationStackSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/ListenerSubscription-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/ReactNitroNavigation-Swift-Cxx-Umbrella.hpp +48 -0
- package/nitrogen/generated/apple/c++/include/module.modulemap +12 -0
- package/nitrogen/generated/apple/swift/Callback_void.swift +60 -0
- package/nitrogen/generated/apple/swift/Callback_void_double.swift +60 -0
- package/nitrogen/generated/apple/swift/HybridNavigationScreenSpec.swift +68 -0
- package/nitrogen/generated/apple/swift/HybridNavigationScreenSpec_cxx.swift +163 -0
- package/nitrogen/generated/apple/swift/HybridNavigationStackSpec.swift +69 -0
- package/nitrogen/generated/apple/swift/HybridNavigationStackSpec_cxx.swift +177 -0
- package/nitrogen/generated/apple/swift/ListenerSubscription.swift +29 -0
- package/nitrogen/generated/apple/swift/Promise_void.swift +100 -0
- package/nitrogen/generated/hybrid-classes.json +21 -0
- package/nitrogen/generated/shared/c++/ReactNitroNavigationCxxModule.cpp +2 -0
- package/nitrogen/generated/shared/c++/include/ReactNitroNavigation/ReactNitroNavigationCxxModule.hpp +2 -0
- package/nitrogen/generated/shared/javascript/NavigationScreen.cjs +19 -0
- package/nitrogen/generated/shared/javascript/NavigationScreen.d.cts +9 -0
- package/nitrogen/generated/shared/javascript/NavigationStack.cjs +19 -0
- package/nitrogen/generated/shared/javascript/NavigationStack.d.cts +9 -0
- package/package.json +33 -4
- package/src/NativeScreenHost.ts +18 -0
- package/src/NativeStackHost.ts +14 -0
- package/src/StackNavigationOptions.ts +7 -0
- package/src/StackNavigationProp.ts +8 -0
- package/src/StackScreen.tsx +19 -0
- package/src/createStackNavigator.tsx +67 -0
- package/src/index.ts +4 -0
- package/src/specs/NavigationScreen.nitro.ts +17 -0
- package/src/specs/NavigationStack.nitro.ts +20 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationScreenSpec_cxx-Swift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <ReactNitroNavigation/private/HybridNavigationScreenSpec_cxx-Swift.hpp>
|
|
9
|
+
#include <ReactNitroNavigation/private/ReactNitroNavigation-Swift-Cxx-Umbrella.hpp>
|
|
10
|
+
#include <ReactNitroNavigation/private/HybridNavigationScreenSpecSwift.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro {
|
|
13
|
+
|
|
14
|
+
::ReactNitroNavigation::HybridNavigationScreenSpec_cxx JSIConverter<::ReactNitroNavigation::HybridNavigationScreenSpec_cxx>::fromJSI(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
15
|
+
auto hybridSpec = JSIConverter<std::shared_ptr<margelo::nitro::navigation::HybridNavigationScreenSpecSwift>>::fromJSI(runtime, value);
|
|
16
|
+
return ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx::fromUnsafe(margelo::nitro::navigation::swift_bridge::get_std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_(hybridSpec));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
jsi::Value JSIConverter<::ReactNitroNavigation::HybridNavigationScreenSpec_cxx>::toJSI(jsi::Runtime& runtime, const ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx& value) {
|
|
20
|
+
auto hybridSpec = ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx::getCxxPart(value);
|
|
21
|
+
return JSIConverter<std::shared_ptr<margelo::nitro::navigation::HybridNavigationScreenSpecSwift>>::toJSI(runtime, hybridSpec);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
bool JSIConverter<::ReactNitroNavigation::HybridNavigationScreenSpec_cxx>::canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
25
|
+
return JSIConverter<std::shared_ptr<margelo::nitro::navigation::HybridNavigationScreenSpecSwift>>::canConvert(runtime, value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationStackSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <ReactNitroNavigation/private/HybridNavigationStackSpecSwift.hpp>
|
|
9
|
+
#include <NitroModules/SwiftConverter.hpp>
|
|
10
|
+
#include <NitroModules/SwiftResult.hpp>
|
|
11
|
+
#include <optional>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::navigation {
|
|
14
|
+
|
|
15
|
+
std::string HybridNavigationStackSpecSwift::toString() {
|
|
16
|
+
return SwiftConverter<std::string, swift::String>::fromSwift(_swiftPart.toString());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Properties
|
|
20
|
+
|
|
21
|
+
// Methods
|
|
22
|
+
|
|
23
|
+
void HybridNavigationStackSpecSwift::attachTo(const ::ReactNitroRenderer::HybridViewControllerSpec_cxx& parent) {
|
|
24
|
+
auto __result = _swiftPart.attachTo(parent);
|
|
25
|
+
if (__result.hasError()) [[unlikely]] {
|
|
26
|
+
std::rethrow_exception(__result.error());
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void HybridNavigationStackSpecSwift::removeFromParent() {
|
|
31
|
+
auto __result = _swiftPart.removeFromParent();
|
|
32
|
+
if (__result.hasError()) [[unlikely]] {
|
|
33
|
+
std::rethrow_exception(__result.error());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
::ReactNitroNavigation::ListenerSubscription HybridNavigationStackSpecSwift::addOnPopListener(const Callback<void(double)>& listener) {
|
|
38
|
+
auto __result = ([&](const void* listener) {
|
|
39
|
+
return withSwiftResult<::ReactNitroNavigation::ListenerSubscription>([&](void* __outResult) {
|
|
40
|
+
return _swiftPart.addOnPopListener(listener, __outResult);
|
|
41
|
+
});
|
|
42
|
+
})(std::addressof(listener));
|
|
43
|
+
if (__result.hasError()) [[unlikely]] {
|
|
44
|
+
std::rethrow_exception(__result.error());
|
|
45
|
+
}
|
|
46
|
+
return std::move(__result.value());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Constructor
|
|
50
|
+
|
|
51
|
+
::ReactNitroNavigation::HybridNavigationStackSpec_cxx HybridNavigationStackSpecSwift::constructor() {
|
|
52
|
+
auto __result = ::ReactNitroNavigation::HybridNavigationStackSpec_cxx::constructor();
|
|
53
|
+
if (__result.hasError()) [[unlikely]] {
|
|
54
|
+
std::rethrow_exception(__result.error());
|
|
55
|
+
}
|
|
56
|
+
return ::ReactNitroNavigation::HybridNavigationStackSpec_cxx::fromUnsafe(__result.value());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const std::shared_ptr<const HybridClass>& HybridNavigationStackSpecSwift::Class::get() {
|
|
60
|
+
static const auto hybridClass = HybridClass::create<Class>([](HybridClass& clazz) {
|
|
61
|
+
clazz.registerHybridMethod("attachTo", &HybridNavigationStackSpecSwift::attachTo);
|
|
62
|
+
clazz.registerHybridMethod("removeFromParent", &HybridNavigationStackSpecSwift::removeFromParent);
|
|
63
|
+
clazz.registerHybridMethod("addOnPopListener", &HybridNavigationStackSpecSwift::addOnPopListener);
|
|
64
|
+
clazz.registerHybridConstructor(&HybridNavigationStackSpecSwift::constructor);
|
|
65
|
+
});
|
|
66
|
+
return hybridClass;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
} // namespace margelo::nitro::navigation
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationStackSpec_cxx-Swift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <ReactNitroNavigation/private/HybridNavigationStackSpec_cxx-Swift.hpp>
|
|
9
|
+
#include <ReactNitroNavigation/private/ReactNitroNavigation-Swift-Cxx-Umbrella.hpp>
|
|
10
|
+
#include <ReactNitroNavigation/private/HybridNavigationStackSpecSwift.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro {
|
|
13
|
+
|
|
14
|
+
::ReactNitroNavigation::HybridNavigationStackSpec_cxx JSIConverter<::ReactNitroNavigation::HybridNavigationStackSpec_cxx>::fromJSI(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
15
|
+
auto hybridSpec = JSIConverter<std::shared_ptr<margelo::nitro::navigation::HybridNavigationStackSpecSwift>>::fromJSI(runtime, value);
|
|
16
|
+
return ::ReactNitroNavigation::HybridNavigationStackSpec_cxx::fromUnsafe(margelo::nitro::navigation::swift_bridge::get_std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_(hybridSpec));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
jsi::Value JSIConverter<::ReactNitroNavigation::HybridNavigationStackSpec_cxx>::toJSI(jsi::Runtime& runtime, const ::ReactNitroNavigation::HybridNavigationStackSpec_cxx& value) {
|
|
20
|
+
auto hybridSpec = ::ReactNitroNavigation::HybridNavigationStackSpec_cxx::getCxxPart(value);
|
|
21
|
+
return JSIConverter<std::shared_ptr<margelo::nitro::navigation::HybridNavigationStackSpecSwift>>::toJSI(runtime, hybridSpec);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
bool JSIConverter<::ReactNitroNavigation::HybridNavigationStackSpec_cxx>::canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
25
|
+
return JSIConverter<std::shared_ptr<margelo::nitro::navigation::HybridNavigationStackSpecSwift>>::canConvert(runtime, value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ListenerSubscription-Swift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <ReactNitroNavigation/private/ListenerSubscription-Swift.hpp>
|
|
9
|
+
#include <ReactNitroNavigation/private/ReactNitroNavigation-Swift-Cxx-Umbrella.hpp>
|
|
10
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
11
|
+
#include <NitroModules/SwiftResult.hpp>
|
|
12
|
+
#include <memory>
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro {
|
|
15
|
+
|
|
16
|
+
::ReactNitroNavigation::ListenerSubscription JSIConverter<::ReactNitroNavigation::ListenerSubscription>::fromJSI(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
17
|
+
auto object = value.asObject(runtime);
|
|
18
|
+
auto __remove = JSIConverter<Callback<void()>>::fromJSI(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "remove")));
|
|
19
|
+
return ::ReactNitroNavigation::ListenerSubscription::init_cxx(std::addressof(__remove));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
jsi::Value JSIConverter<::ReactNitroNavigation::ListenerSubscription>::toJSI(jsi::Runtime& runtime, const ::ReactNitroNavigation::ListenerSubscription& value) {
|
|
23
|
+
jsi::Object object(runtime);
|
|
24
|
+
object.setProperty(runtime, PropNameIDCache::get(runtime, "remove"), JSIConverter<Callback<void()>>::toJSI(runtime, makeCxxValue<Callback<void()>>([&](void* __outResult) {
|
|
25
|
+
value.getRemove_cxx(__outResult);
|
|
26
|
+
})));
|
|
27
|
+
return object;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
bool JSIConverter<::ReactNitroNavigation::ListenerSubscription>::canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
31
|
+
if (!value.isObject()) return false;
|
|
32
|
+
auto object = value.getObject(runtime);
|
|
33
|
+
if (!isPlainObject(runtime, object)) return false;
|
|
34
|
+
return JSIConverter<Callback<void()>>::canConvert(runtime, object.getProperty(runtime, PropNameIDCache::get(runtime, "remove")));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNitroNavigationAutolinking.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::navigation {
|
|
11
|
+
// Register all generated HybridObject classes
|
|
12
|
+
void registerHybridClasses();
|
|
13
|
+
} // namespace margelo::nitro::navigation
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationScreenSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/HybridObject.hpp>
|
|
11
|
+
#include <NitroModules/HybridClass.hpp>
|
|
12
|
+
#include <ReactNitroRenderer/private/HybridViewSpecSwift.hpp>
|
|
13
|
+
|
|
14
|
+
// This implementation header is consumed only by C++ translation units.
|
|
15
|
+
#include <ReactNitroNavigation/private/ReactNitroNavigation-Swift-Cxx-Umbrella.hpp>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::navigation {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ part of HybridNavigationScreenSpec_cxx.swift.
|
|
21
|
+
*
|
|
22
|
+
* HybridNavigationScreenSpecSwift accesses the concrete Swift wrapper and registers
|
|
23
|
+
* its Swift signatures for JS. C++ callers use a separate adapter when needed.
|
|
24
|
+
*/
|
|
25
|
+
class HybridNavigationScreenSpecSwift final : public margelo::nitro::renderer::HybridViewSpecSwift {
|
|
26
|
+
public:
|
|
27
|
+
struct Class {
|
|
28
|
+
using Base = margelo::nitro::renderer::HybridViewSpecSwift::Class;
|
|
29
|
+
static constexpr const char* name = "NavigationScreen";
|
|
30
|
+
static const std::shared_ptr<const HybridClass>& get();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
public:
|
|
34
|
+
// Constructor from a Swift instance
|
|
35
|
+
explicit HybridNavigationScreenSpecSwift(const ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx& swiftPart):
|
|
36
|
+
margelo::nitro::renderer::HybridViewSpecSwift(swiftPart),
|
|
37
|
+
_swiftPart(swiftPart) { }
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
// Get the Swift part
|
|
41
|
+
::ReactNitroNavigation::HybridNavigationScreenSpec_cxx& getSwiftPart() noexcept {
|
|
42
|
+
return _swiftPart;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// HybridObject overrides
|
|
46
|
+
size_t getExternalMemorySize() noexcept override {
|
|
47
|
+
return _swiftPart.getMemorySize();
|
|
48
|
+
}
|
|
49
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
50
|
+
auto value = std::dynamic_pointer_cast<HybridNavigationScreenSpecSwift>(other);
|
|
51
|
+
return value && _swiftPart.equals(value->_swiftPart);
|
|
52
|
+
}
|
|
53
|
+
void dispose() override {
|
|
54
|
+
_swiftPart.dispose();
|
|
55
|
+
}
|
|
56
|
+
std::string toString() override;
|
|
57
|
+
|
|
58
|
+
// Properties
|
|
59
|
+
::ReactNitroRenderer::HybridViewControllerSpec_cxx getViewController();
|
|
60
|
+
swift::Optional<swift::String> getTitle();
|
|
61
|
+
void setTitle(const swift::Optional<swift::String>& title);
|
|
62
|
+
// Methods
|
|
63
|
+
// Constructor
|
|
64
|
+
static ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx constructor();
|
|
65
|
+
|
|
66
|
+
protected:
|
|
67
|
+
const std::shared_ptr<const HybridClass>& getHybridClass() override {
|
|
68
|
+
return Class::get();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
::ReactNitroNavigation::HybridNavigationScreenSpec_cxx _swiftPart;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::navigation
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationScreenSpec_cxx-Swift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
11
|
+
// Forward declaration of `HybridNavigationScreenSpec_cxx` to properly resolve imports.
|
|
12
|
+
namespace ReactNitroNavigation { class HybridNavigationScreenSpec_cxx; }
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro {
|
|
15
|
+
|
|
16
|
+
template <>
|
|
17
|
+
struct JSIConverter<::ReactNitroNavigation::HybridNavigationScreenSpec_cxx> {
|
|
18
|
+
static ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
19
|
+
static jsi::Value toJSI(jsi::Runtime& runtime, const ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx& value);
|
|
20
|
+
static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationStackSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/HybridObject.hpp>
|
|
11
|
+
#include <NitroModules/HybridClass.hpp>
|
|
12
|
+
#include <ReactNitroRenderer/private/HybridViewSpecSwift.hpp>
|
|
13
|
+
|
|
14
|
+
// This implementation header is consumed only by C++ translation units.
|
|
15
|
+
#include <ReactNitroNavigation/private/ReactNitroNavigation-Swift-Cxx-Umbrella.hpp>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::navigation {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ part of HybridNavigationStackSpec_cxx.swift.
|
|
21
|
+
*
|
|
22
|
+
* HybridNavigationStackSpecSwift accesses the concrete Swift wrapper and registers
|
|
23
|
+
* its Swift signatures for JS. C++ callers use a separate adapter when needed.
|
|
24
|
+
*/
|
|
25
|
+
class HybridNavigationStackSpecSwift final : public margelo::nitro::renderer::HybridViewSpecSwift {
|
|
26
|
+
public:
|
|
27
|
+
struct Class {
|
|
28
|
+
using Base = margelo::nitro::renderer::HybridViewSpecSwift::Class;
|
|
29
|
+
static constexpr const char* name = "NavigationStack";
|
|
30
|
+
static const std::shared_ptr<const HybridClass>& get();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
public:
|
|
34
|
+
// Constructor from a Swift instance
|
|
35
|
+
explicit HybridNavigationStackSpecSwift(const ::ReactNitroNavigation::HybridNavigationStackSpec_cxx& swiftPart):
|
|
36
|
+
margelo::nitro::renderer::HybridViewSpecSwift(swiftPart),
|
|
37
|
+
_swiftPart(swiftPart) { }
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
// Get the Swift part
|
|
41
|
+
::ReactNitroNavigation::HybridNavigationStackSpec_cxx& getSwiftPart() noexcept {
|
|
42
|
+
return _swiftPart;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// HybridObject overrides
|
|
46
|
+
size_t getExternalMemorySize() noexcept override {
|
|
47
|
+
return _swiftPart.getMemorySize();
|
|
48
|
+
}
|
|
49
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
50
|
+
auto value = std::dynamic_pointer_cast<HybridNavigationStackSpecSwift>(other);
|
|
51
|
+
return value && _swiftPart.equals(value->_swiftPart);
|
|
52
|
+
}
|
|
53
|
+
void dispose() override {
|
|
54
|
+
_swiftPart.dispose();
|
|
55
|
+
}
|
|
56
|
+
std::string toString() override;
|
|
57
|
+
|
|
58
|
+
// Properties
|
|
59
|
+
// Methods
|
|
60
|
+
void attachTo(const ::ReactNitroRenderer::HybridViewControllerSpec_cxx& parent);
|
|
61
|
+
void removeFromParent();
|
|
62
|
+
::ReactNitroNavigation::ListenerSubscription addOnPopListener(const Callback<void(double)>& listener);
|
|
63
|
+
// Constructor
|
|
64
|
+
static ::ReactNitroNavigation::HybridNavigationStackSpec_cxx constructor();
|
|
65
|
+
|
|
66
|
+
protected:
|
|
67
|
+
const std::shared_ptr<const HybridClass>& getHybridClass() override {
|
|
68
|
+
return Class::get();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
::ReactNitroNavigation::HybridNavigationStackSpec_cxx _swiftPart;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::navigation
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationStackSpec_cxx-Swift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
11
|
+
// Forward declaration of `HybridNavigationStackSpec_cxx` to properly resolve imports.
|
|
12
|
+
namespace ReactNitroNavigation { class HybridNavigationStackSpec_cxx; }
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro {
|
|
15
|
+
|
|
16
|
+
template <>
|
|
17
|
+
struct JSIConverter<::ReactNitroNavigation::HybridNavigationStackSpec_cxx> {
|
|
18
|
+
static ::ReactNitroNavigation::HybridNavigationStackSpec_cxx fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
19
|
+
static jsi::Value toJSI(jsi::Runtime& runtime, const ::ReactNitroNavigation::HybridNavigationStackSpec_cxx& value);
|
|
20
|
+
static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ListenerSubscription-Swift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
11
|
+
// Forward declaration of `ListenerSubscription` to properly resolve imports.
|
|
12
|
+
namespace ReactNitroNavigation { class ListenerSubscription; }
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro {
|
|
15
|
+
|
|
16
|
+
template <>
|
|
17
|
+
struct JSIConverter<::ReactNitroNavigation::ListenerSubscription> {
|
|
18
|
+
static ::ReactNitroNavigation::ListenerSubscription fromJSI(jsi::Runtime& runtime, const jsi::Value& value);
|
|
19
|
+
static jsi::Value toJSI(jsi::Runtime& runtime, const ::ReactNitroNavigation::ListenerSubscription& value);
|
|
20
|
+
static bool canConvert(jsi::Runtime& runtime, const jsi::Value& value);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNitroNavigation-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Private C++ implementation includes. Never import this umbrella from Swift.
|
|
11
|
+
// Include Swift defined types. They define swift::Optional and swift::Array,
|
|
12
|
+
// which the C++ helpers below only forward-declare for Swift's importer.
|
|
13
|
+
#include <NitroModules/NitroModules-Swift-Cxx-Umbrella.hpp>
|
|
14
|
+
|
|
15
|
+
// C++ helpers for Swift
|
|
16
|
+
#include <ReactNitroNavigationAppleCxx/ReactNitroNavigationAppleCxx.h>
|
|
17
|
+
#include <ReactNitroRenderer/private/ReactNitroRenderer-Swift-Cxx-Umbrella.hpp>
|
|
18
|
+
#if __has_include("ReactNitroNavigation-Swift.h")
|
|
19
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
20
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNitroNavigation".
|
|
21
|
+
#include "ReactNitroNavigation-Swift.h"
|
|
22
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
23
|
+
#elif __has_include(<ReactNitroNavigation/ReactNitroNavigation-Swift.h>)
|
|
24
|
+
#include <ReactNitroNavigation/ReactNitroNavigation-Swift.h>
|
|
25
|
+
#else
|
|
26
|
+
#error ReactNitroNavigation's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNitroNavigation", and try building the app first.
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#include <ReactNitroRenderer/private/HybridViewSpec_cxx-Swift.hpp>
|
|
31
|
+
#include <NitroModules/JSIConverter+SwiftOptional.hpp>
|
|
32
|
+
#include <ReactNitroRenderer/private/EdgeInsets-Swift.hpp>
|
|
33
|
+
#include <ReactNitroRenderer/private/Corner-Swift.hpp>
|
|
34
|
+
#include <NitroModules/JSIConverter+SwiftArray.hpp>
|
|
35
|
+
#include <ReactNitroRenderer/private/CornerCurve-Swift.hpp>
|
|
36
|
+
#include <ReactNitroRenderer/private/Point3D-Swift.hpp>
|
|
37
|
+
#include <ReactNitroRenderer/private/Frame-Swift.hpp>
|
|
38
|
+
#include <ReactNitroRenderer/private/HybridAnimatorSpec_cxx-Swift.hpp>
|
|
39
|
+
#include <ReactNitroRenderer/private/HybridGestureRecognizerSpec_cxx-Swift.hpp>
|
|
40
|
+
#include <ReactNitroRenderer/private/AnimationCurve-Swift.hpp>
|
|
41
|
+
#include <NitroModules/Callback.hpp>
|
|
42
|
+
#include <NitroModules/Result.hpp>
|
|
43
|
+
#include <ReactNitroNavigation/private/HybridNavigationScreenSpec_cxx-Swift.hpp>
|
|
44
|
+
#include <ReactNitroRenderer/private/HybridViewControllerSpec_cxx-Swift.hpp>
|
|
45
|
+
#include <NitroModules/NitroModules-Swift-Cxx-Umbrella.hpp>
|
|
46
|
+
#include <NitroModules/JSIConverter+SwiftString.hpp>
|
|
47
|
+
#include <ReactNitroNavigation/private/HybridNavigationStackSpec_cxx-Swift.hpp>
|
|
48
|
+
#include <ReactNitroNavigation/private/ListenerSubscription-Swift.hpp>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// module.modulemap
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
// Headers used by Swift belong to the AppleCxx module.
|
|
9
|
+
// This implementation target must not claim them through an umbrella directory.
|
|
10
|
+
module ReactNitroNavigationSwiftBridge {
|
|
11
|
+
requires cplusplus
|
|
12
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Callback_void.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public import NitroModules
|
|
9
|
+
internal import CxxStdlib
|
|
10
|
+
internal import ReactNitroNavigationAppleCxx
|
|
11
|
+
|
|
12
|
+
public typealias Callback_void = margelo.nitro.navigation.swift_bridge.Callback_void
|
|
13
|
+
|
|
14
|
+
extension Callback_void {
|
|
15
|
+
public typealias Arguments = ()
|
|
16
|
+
public typealias Return = Void
|
|
17
|
+
public typealias AsyncResult = margelo.nitro.navigation.swift_bridge.Promise_void
|
|
18
|
+
private typealias bridge = margelo.nitro.navigation.swift_bridge
|
|
19
|
+
|
|
20
|
+
public borrowing func __nitroCallSync(_ arguments: Arguments) throws -> Return {
|
|
21
|
+
let __result = bridge.callSync_Callback_void(self)
|
|
22
|
+
if __result.hasError() {
|
|
23
|
+
throw RuntimeError.from(cppError: __result.error())
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
public borrowing func __nitroCallAsync(_ arguments: Arguments) -> AsyncResult {
|
|
27
|
+
return __callAsync()
|
|
28
|
+
}
|
|
29
|
+
public borrowing func __nitroCallAndForget(_ arguments: Arguments) {
|
|
30
|
+
__callAndForget()
|
|
31
|
+
}
|
|
32
|
+
public init(_ closure: @escaping @Sendable () throws -> Return) {
|
|
33
|
+
self = bridge.create_Callback_void(.init { () -> bridge.Result_void in
|
|
34
|
+
do {
|
|
35
|
+
try closure()
|
|
36
|
+
return bridge.Result_void.withValue()
|
|
37
|
+
} catch {
|
|
38
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
extension Callback<(), Void> where Self == Callback_void {
|
|
45
|
+
/// Creates a native callback from an escaping Swift closure.
|
|
46
|
+
public static func native(_ closure: @escaping @Sendable () throws -> Void) -> Self {
|
|
47
|
+
return Self(closure)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
extension Callback<(), Void> {
|
|
52
|
+
func toCpp() -> Callback_void {
|
|
53
|
+
if let value = self as? Callback_void {
|
|
54
|
+
return value
|
|
55
|
+
}
|
|
56
|
+
return Callback_void { () -> Void in
|
|
57
|
+
try self.callSync(())
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Callback_void_double.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public import NitroModules
|
|
9
|
+
internal import CxxStdlib
|
|
10
|
+
internal import ReactNitroNavigationAppleCxx
|
|
11
|
+
|
|
12
|
+
public typealias Callback_void_double = margelo.nitro.navigation.swift_bridge.Callback_void_double
|
|
13
|
+
|
|
14
|
+
extension Callback_void_double {
|
|
15
|
+
public typealias Arguments = (Double)
|
|
16
|
+
public typealias Return = Void
|
|
17
|
+
public typealias AsyncResult = margelo.nitro.navigation.swift_bridge.Promise_void
|
|
18
|
+
private typealias bridge = margelo.nitro.navigation.swift_bridge
|
|
19
|
+
|
|
20
|
+
public borrowing func __nitroCallSync(_ arguments: Arguments) throws -> Return {
|
|
21
|
+
let __result = bridge.callSync_Callback_void_double(self, arguments)
|
|
22
|
+
if __result.hasError() {
|
|
23
|
+
throw RuntimeError.from(cppError: __result.error())
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
public borrowing func __nitroCallAsync(_ arguments: Arguments) -> AsyncResult {
|
|
27
|
+
return __callAsync(arguments)
|
|
28
|
+
}
|
|
29
|
+
public borrowing func __nitroCallAndForget(_ arguments: Arguments) {
|
|
30
|
+
__callAndForget(arguments)
|
|
31
|
+
}
|
|
32
|
+
public init(_ closure: @escaping @Sendable (Double) throws -> Return) {
|
|
33
|
+
self = bridge.create_Callback_void_double(.init { (param0: Double) -> bridge.Result_void in
|
|
34
|
+
do {
|
|
35
|
+
try closure(param0)
|
|
36
|
+
return bridge.Result_void.withValue()
|
|
37
|
+
} catch {
|
|
38
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
extension Callback<(Double), Void> where Self == Callback_void_double {
|
|
45
|
+
/// Creates a native callback from an escaping Swift closure.
|
|
46
|
+
public static func native(_ closure: @escaping @Sendable (Double) throws -> Void) -> Self {
|
|
47
|
+
return Self(closure)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
extension Callback<(Double), Void> {
|
|
52
|
+
func toCpp() -> Callback_void_double {
|
|
53
|
+
if let value = self as? Callback_void_double {
|
|
54
|
+
return value
|
|
55
|
+
}
|
|
56
|
+
return Callback_void_double { (param0: Double) -> Void in
|
|
57
|
+
try self.callSync((param0))
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationScreenSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public import NitroModules
|
|
9
|
+
public import ReactNitroRenderer
|
|
10
|
+
|
|
11
|
+
/// See ``HybridNavigationScreenSpec``
|
|
12
|
+
public protocol HybridNavigationScreenSpec_protocol: HybridNavigationScreenSpec_base, HybridObject, HybridViewSpec_protocol {
|
|
13
|
+
// Constructor
|
|
14
|
+
init() throws
|
|
15
|
+
|
|
16
|
+
// Properties
|
|
17
|
+
var viewController: (any HybridViewControllerSpec) { get }
|
|
18
|
+
var title: String? { get set }
|
|
19
|
+
|
|
20
|
+
// Methods
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// Static Properties
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// Static Methods
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public extension HybridNavigationScreenSpec_protocol {
|
|
31
|
+
/// Default implementation of ``HybridObject.toString``
|
|
32
|
+
func toString() -> String {
|
|
33
|
+
return "[HybridObject NavigationScreen]"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// See ``HybridNavigationScreenSpec``
|
|
38
|
+
open class HybridNavigationScreenSpec_base: HybridViewSpec_base {
|
|
39
|
+
private weak var cxxWrapper: HybridNavigationScreenSpec_cxx? = nil
|
|
40
|
+
public override init() throws {
|
|
41
|
+
try super.init()
|
|
42
|
+
}
|
|
43
|
+
public final override func getCxxWrapper() -> HybridNavigationScreenSpec_cxx {
|
|
44
|
+
#if DEBUG
|
|
45
|
+
guard self is any HybridNavigationScreenSpec else {
|
|
46
|
+
fatalError("`self` is not a `HybridNavigationScreenSpec`! Did you accidentally inherit from `HybridNavigationScreenSpec_base` instead of `HybridNavigationScreenSpec`?")
|
|
47
|
+
}
|
|
48
|
+
#endif
|
|
49
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
50
|
+
return cxxWrapper
|
|
51
|
+
} else {
|
|
52
|
+
let cxxWrapper = HybridNavigationScreenSpec_cxx(self as! any HybridNavigationScreenSpec)
|
|
53
|
+
self.cxxWrapper = cxxWrapper
|
|
54
|
+
return cxxWrapper
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A Swift base-protocol representing the NavigationScreen HybridObject.
|
|
61
|
+
* Implement this protocol to create Swift-based instances of NavigationScreen.
|
|
62
|
+
* ```swift
|
|
63
|
+
* class HybridNavigationScreen : HybridNavigationScreenSpec {
|
|
64
|
+
* // ...
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
public typealias HybridNavigationScreenSpec = HybridNavigationScreenSpec_protocol & HybridNavigationScreenSpec_base
|