concentric-sheet 0.0.2

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/NitroConcentricSheet.podspec +31 -0
  3. package/README.md +118 -0
  4. package/ios/Bridge.h +8 -0
  5. package/ios/SheetModalController.swift +912 -0
  6. package/lib/NativeSheetModal.d.ts +10 -0
  7. package/lib/NativeSheetModal.js +243 -0
  8. package/lib/index.d.ts +3 -0
  9. package/lib/index.js +1 -0
  10. package/lib/specs/SheetModalController.nitro.d.ts +46 -0
  11. package/lib/specs/SheetModalController.nitro.js +1 -0
  12. package/nitro.json +23 -0
  13. package/nitrogen/generated/.gitattributes +1 -0
  14. package/nitrogen/generated/ios/NitroConcentricSheet+autolinking.rb +60 -0
  15. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Bridge.cpp +33 -0
  16. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Bridge.hpp +269 -0
  17. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Umbrella.hpp +69 -0
  18. package/nitrogen/generated/ios/NitroConcentricSheetAutolinking.mm +33 -0
  19. package/nitrogen/generated/ios/NitroConcentricSheetAutolinking.swift +26 -0
  20. package/nitrogen/generated/ios/c++/HybridSheetModalControllerSpecSwift.cpp +11 -0
  21. package/nitrogen/generated/ios/c++/HybridSheetModalControllerSpecSwift.hpp +130 -0
  22. package/nitrogen/generated/ios/swift/HybridSheetModalControllerSpec.swift +58 -0
  23. package/nitrogen/generated/ios/swift/HybridSheetModalControllerSpec_cxx.swift +181 -0
  24. package/nitrogen/generated/ios/swift/ModalCornerConfiguration.swift +83 -0
  25. package/nitrogen/generated/ios/swift/ModalCornerConfigurationType.swift +48 -0
  26. package/nitrogen/generated/ios/swift/ModalViewBackground.swift +40 -0
  27. package/nitrogen/generated/ios/swift/PresentedModalConfig.swift +129 -0
  28. package/nitrogen/generated/ios/swift/PresentedModalDetent.swift +71 -0
  29. package/nitrogen/generated/ios/swift/SheetDetentIdentifier.swift +40 -0
  30. package/nitrogen/generated/ios/swift/SheetPresentationConfig.swift +238 -0
  31. package/nitrogen/generated/ios/swift/Variant_NullType_PresentedModalDetent.swift +18 -0
  32. package/nitrogen/generated/shared/c++/HybridSheetModalControllerSpec.cpp +24 -0
  33. package/nitrogen/generated/shared/c++/HybridSheetModalControllerSpec.hpp +71 -0
  34. package/nitrogen/generated/shared/c++/ModalCornerConfiguration.hpp +97 -0
  35. package/nitrogen/generated/shared/c++/ModalCornerConfigurationType.hpp +84 -0
  36. package/nitrogen/generated/shared/c++/ModalViewBackground.hpp +76 -0
  37. package/nitrogen/generated/shared/c++/PresentedModalConfig.hpp +115 -0
  38. package/nitrogen/generated/shared/c++/PresentedModalDetent.hpp +94 -0
  39. package/nitrogen/generated/shared/c++/SheetDetentIdentifier.hpp +76 -0
  40. package/nitrogen/generated/shared/c++/SheetPresentationConfig.hpp +130 -0
  41. package/package.json +103 -0
  42. package/react-native.config.js +13 -0
  43. package/src/NativeSheetModal.tsx +343 -0
  44. package/src/index.ts +16 -0
  45. package/src/specs/SheetModalController.nitro.ts +54 -0
@@ -0,0 +1,115 @@
1
+ ///
2
+ /// PresentedModalConfig.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 `ModalViewBackground` to properly resolve imports.
32
+ namespace margelo::nitro::concentricsheet { enum class ModalViewBackground; }
33
+ // Forward declaration of `ModalCornerConfiguration` to properly resolve imports.
34
+ namespace margelo::nitro::concentricsheet { struct ModalCornerConfiguration; }
35
+ // Forward declaration of `SheetPresentationConfig` to properly resolve imports.
36
+ namespace margelo::nitro::concentricsheet { struct SheetPresentationConfig; }
37
+
38
+ #include <optional>
39
+ #include "ModalViewBackground.hpp"
40
+ #include "ModalCornerConfiguration.hpp"
41
+ #include "SheetPresentationConfig.hpp"
42
+
43
+ namespace margelo::nitro::concentricsheet {
44
+
45
+ /**
46
+ * A struct which can be represented as a JavaScript object (PresentedModalConfig).
47
+ */
48
+ struct PresentedModalConfig final {
49
+ public:
50
+ std::optional<double> modalInstanceId SWIFT_PRIVATE;
51
+ std::optional<bool> isModalInPresentation SWIFT_PRIVATE;
52
+ std::optional<double> preferredContentWidth SWIFT_PRIVATE;
53
+ std::optional<double> preferredContentHeight SWIFT_PRIVATE;
54
+ std::optional<ModalViewBackground> modalViewBackground SWIFT_PRIVATE;
55
+ std::optional<ModalCornerConfiguration> cornerConfiguration SWIFT_PRIVATE;
56
+ std::optional<SheetPresentationConfig> sheet SWIFT_PRIVATE;
57
+
58
+ public:
59
+ PresentedModalConfig() = default;
60
+ explicit PresentedModalConfig(std::optional<double> modalInstanceId, std::optional<bool> isModalInPresentation, std::optional<double> preferredContentWidth, std::optional<double> preferredContentHeight, std::optional<ModalViewBackground> modalViewBackground, std::optional<ModalCornerConfiguration> cornerConfiguration, std::optional<SheetPresentationConfig> sheet): modalInstanceId(modalInstanceId), isModalInPresentation(isModalInPresentation), preferredContentWidth(preferredContentWidth), preferredContentHeight(preferredContentHeight), modalViewBackground(modalViewBackground), cornerConfiguration(cornerConfiguration), sheet(sheet) {}
61
+
62
+ public:
63
+ friend bool operator==(const PresentedModalConfig& lhs, const PresentedModalConfig& rhs) = default;
64
+ };
65
+
66
+ } // namespace margelo::nitro::concentricsheet
67
+
68
+ namespace margelo::nitro {
69
+
70
+ // C++ PresentedModalConfig <> JS PresentedModalConfig (object)
71
+ template <>
72
+ struct JSIConverter<margelo::nitro::concentricsheet::PresentedModalConfig> final {
73
+ static inline margelo::nitro::concentricsheet::PresentedModalConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
74
+ jsi::Object obj = arg.asObject(runtime);
75
+ return margelo::nitro::concentricsheet::PresentedModalConfig(
76
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modalInstanceId"))),
77
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isModalInPresentation"))),
78
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredContentWidth"))),
79
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredContentHeight"))),
80
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalViewBackground>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modalViewBackground"))),
81
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalCornerConfiguration>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerConfiguration"))),
82
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetPresentationConfig>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sheet")))
83
+ );
84
+ }
85
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::concentricsheet::PresentedModalConfig& arg) {
86
+ jsi::Object obj(runtime);
87
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "modalInstanceId"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.modalInstanceId));
88
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "isModalInPresentation"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isModalInPresentation));
89
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "preferredContentWidth"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.preferredContentWidth));
90
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "preferredContentHeight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.preferredContentHeight));
91
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "modalViewBackground"), JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalViewBackground>>::toJSI(runtime, arg.modalViewBackground));
92
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cornerConfiguration"), JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalCornerConfiguration>>::toJSI(runtime, arg.cornerConfiguration));
93
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "sheet"), JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetPresentationConfig>>::toJSI(runtime, arg.sheet));
94
+ return obj;
95
+ }
96
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
97
+ if (!value.isObject()) {
98
+ return false;
99
+ }
100
+ jsi::Object obj = value.getObject(runtime);
101
+ if (!nitro::isPlainObject(runtime, obj)) {
102
+ return false;
103
+ }
104
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modalInstanceId")))) return false;
105
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isModalInPresentation")))) return false;
106
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredContentWidth")))) return false;
107
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredContentHeight")))) return false;
108
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalViewBackground>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modalViewBackground")))) return false;
109
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::ModalCornerConfiguration>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerConfiguration")))) return false;
110
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetPresentationConfig>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sheet")))) return false;
111
+ return true;
112
+ }
113
+ };
114
+
115
+ } // namespace margelo::nitro
@@ -0,0 +1,94 @@
1
+ ///
2
+ /// PresentedModalDetent.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 `SheetDetentIdentifier` to properly resolve imports.
32
+ namespace margelo::nitro::concentricsheet { enum class SheetDetentIdentifier; }
33
+
34
+ #include "SheetDetentIdentifier.hpp"
35
+ #include <optional>
36
+ #include <string>
37
+
38
+ namespace margelo::nitro::concentricsheet {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (PresentedModalDetent).
42
+ */
43
+ struct PresentedModalDetent final {
44
+ public:
45
+ std::optional<SheetDetentIdentifier> detentIdentifier SWIFT_PRIVATE;
46
+ std::optional<double> customDetentHeight SWIFT_PRIVATE;
47
+ std::optional<std::string> rawDetentIdentifier SWIFT_PRIVATE;
48
+
49
+ public:
50
+ PresentedModalDetent() = default;
51
+ explicit PresentedModalDetent(std::optional<SheetDetentIdentifier> detentIdentifier, std::optional<double> customDetentHeight, std::optional<std::string> rawDetentIdentifier): detentIdentifier(detentIdentifier), customDetentHeight(customDetentHeight), rawDetentIdentifier(rawDetentIdentifier) {}
52
+
53
+ public:
54
+ friend bool operator==(const PresentedModalDetent& lhs, const PresentedModalDetent& rhs) = default;
55
+ };
56
+
57
+ } // namespace margelo::nitro::concentricsheet
58
+
59
+ namespace margelo::nitro {
60
+
61
+ // C++ PresentedModalDetent <> JS PresentedModalDetent (object)
62
+ template <>
63
+ struct JSIConverter<margelo::nitro::concentricsheet::PresentedModalDetent> final {
64
+ static inline margelo::nitro::concentricsheet::PresentedModalDetent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
65
+ jsi::Object obj = arg.asObject(runtime);
66
+ return margelo::nitro::concentricsheet::PresentedModalDetent(
67
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "detentIdentifier"))),
68
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "customDetentHeight"))),
69
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawDetentIdentifier")))
70
+ );
71
+ }
72
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::concentricsheet::PresentedModalDetent& arg) {
73
+ jsi::Object obj(runtime);
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "detentIdentifier"), JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::toJSI(runtime, arg.detentIdentifier));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "customDetentHeight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.customDetentHeight));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "rawDetentIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.rawDetentIdentifier));
77
+ return obj;
78
+ }
79
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
80
+ if (!value.isObject()) {
81
+ return false;
82
+ }
83
+ jsi::Object obj = value.getObject(runtime);
84
+ if (!nitro::isPlainObject(runtime, obj)) {
85
+ return false;
86
+ }
87
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "detentIdentifier")))) return false;
88
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "customDetentHeight")))) return false;
89
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rawDetentIdentifier")))) return false;
90
+ return true;
91
+ }
92
+ };
93
+
94
+ } // namespace margelo::nitro
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// SheetDetentIdentifier.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::concentricsheet {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (SheetDetentIdentifier).
30
+ */
31
+ enum class SheetDetentIdentifier {
32
+ MEDIUM SWIFT_NAME(medium) = 0,
33
+ LARGE SWIFT_NAME(large) = 1,
34
+ } CLOSED_ENUM;
35
+
36
+ } // namespace margelo::nitro::concentricsheet
37
+
38
+ namespace margelo::nitro {
39
+
40
+ // C++ SheetDetentIdentifier <> JS SheetDetentIdentifier (union)
41
+ template <>
42
+ struct JSIConverter<margelo::nitro::concentricsheet::SheetDetentIdentifier> final {
43
+ static inline margelo::nitro::concentricsheet::SheetDetentIdentifier fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
44
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
45
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
46
+ case hashString("medium"): return margelo::nitro::concentricsheet::SheetDetentIdentifier::MEDIUM;
47
+ case hashString("large"): return margelo::nitro::concentricsheet::SheetDetentIdentifier::LARGE;
48
+ default: [[unlikely]]
49
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum SheetDetentIdentifier - invalid value!");
50
+ }
51
+ }
52
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::concentricsheet::SheetDetentIdentifier arg) {
53
+ switch (arg) {
54
+ case margelo::nitro::concentricsheet::SheetDetentIdentifier::MEDIUM: return JSIConverter<std::string>::toJSI(runtime, "medium");
55
+ case margelo::nitro::concentricsheet::SheetDetentIdentifier::LARGE: return JSIConverter<std::string>::toJSI(runtime, "large");
56
+ default: [[unlikely]]
57
+ throw std::invalid_argument("Cannot convert SheetDetentIdentifier to JS - invalid value: "
58
+ + std::to_string(static_cast<int>(arg)) + "!");
59
+ }
60
+ }
61
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
62
+ if (!value.isString()) {
63
+ return false;
64
+ }
65
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
66
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
67
+ case hashString("medium"):
68
+ case hashString("large"):
69
+ return true;
70
+ default:
71
+ return false;
72
+ }
73
+ }
74
+ };
75
+
76
+ } // namespace margelo::nitro
@@ -0,0 +1,130 @@
1
+ ///
2
+ /// SheetPresentationConfig.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 `SheetDetentIdentifier` to properly resolve imports.
32
+ namespace margelo::nitro::concentricsheet { enum class SheetDetentIdentifier; }
33
+
34
+ #include "SheetDetentIdentifier.hpp"
35
+ #include <vector>
36
+ #include <optional>
37
+
38
+ namespace margelo::nitro::concentricsheet {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (SheetPresentationConfig).
42
+ */
43
+ struct SheetPresentationConfig final {
44
+ public:
45
+ std::optional<std::vector<SheetDetentIdentifier>> detents SWIFT_PRIVATE;
46
+ std::optional<std::vector<double>> customDetentHeights SWIFT_PRIVATE;
47
+ std::optional<SheetDetentIdentifier> selectedDetentIdentifier SWIFT_PRIVATE;
48
+ std::optional<double> selectedCustomDetentHeight SWIFT_PRIVATE;
49
+ std::optional<SheetDetentIdentifier> largestUndimmedDetentIdentifier SWIFT_PRIVATE;
50
+ std::optional<double> largestUndimmedCustomDetentHeight SWIFT_PRIVATE;
51
+ std::optional<bool> prefersGrabberVisible SWIFT_PRIVATE;
52
+ std::optional<double> preferredCornerRadius SWIFT_PRIVATE;
53
+ std::optional<bool> prefersScrollingExpandsWhenScrolledToEdge SWIFT_PRIVATE;
54
+ std::optional<bool> prefersEdgeAttachedInCompactHeight SWIFT_PRIVATE;
55
+ std::optional<bool> widthFollowsPreferredContentSizeWhenEdgeAttached SWIFT_PRIVATE;
56
+ std::optional<bool> wantsFullScreen SWIFT_PRIVATE;
57
+
58
+ public:
59
+ SheetPresentationConfig() = default;
60
+ explicit SheetPresentationConfig(std::optional<std::vector<SheetDetentIdentifier>> detents, std::optional<std::vector<double>> customDetentHeights, std::optional<SheetDetentIdentifier> selectedDetentIdentifier, std::optional<double> selectedCustomDetentHeight, std::optional<SheetDetentIdentifier> largestUndimmedDetentIdentifier, std::optional<double> largestUndimmedCustomDetentHeight, std::optional<bool> prefersGrabberVisible, std::optional<double> preferredCornerRadius, std::optional<bool> prefersScrollingExpandsWhenScrolledToEdge, std::optional<bool> prefersEdgeAttachedInCompactHeight, std::optional<bool> widthFollowsPreferredContentSizeWhenEdgeAttached, std::optional<bool> wantsFullScreen): detents(detents), customDetentHeights(customDetentHeights), selectedDetentIdentifier(selectedDetentIdentifier), selectedCustomDetentHeight(selectedCustomDetentHeight), largestUndimmedDetentIdentifier(largestUndimmedDetentIdentifier), largestUndimmedCustomDetentHeight(largestUndimmedCustomDetentHeight), prefersGrabberVisible(prefersGrabberVisible), preferredCornerRadius(preferredCornerRadius), prefersScrollingExpandsWhenScrolledToEdge(prefersScrollingExpandsWhenScrolledToEdge), prefersEdgeAttachedInCompactHeight(prefersEdgeAttachedInCompactHeight), widthFollowsPreferredContentSizeWhenEdgeAttached(widthFollowsPreferredContentSizeWhenEdgeAttached), wantsFullScreen(wantsFullScreen) {}
61
+
62
+ public:
63
+ friend bool operator==(const SheetPresentationConfig& lhs, const SheetPresentationConfig& rhs) = default;
64
+ };
65
+
66
+ } // namespace margelo::nitro::concentricsheet
67
+
68
+ namespace margelo::nitro {
69
+
70
+ // C++ SheetPresentationConfig <> JS SheetPresentationConfig (object)
71
+ template <>
72
+ struct JSIConverter<margelo::nitro::concentricsheet::SheetPresentationConfig> final {
73
+ static inline margelo::nitro::concentricsheet::SheetPresentationConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
74
+ jsi::Object obj = arg.asObject(runtime);
75
+ return margelo::nitro::concentricsheet::SheetPresentationConfig(
76
+ JSIConverter<std::optional<std::vector<margelo::nitro::concentricsheet::SheetDetentIdentifier>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "detents"))),
77
+ JSIConverter<std::optional<std::vector<double>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "customDetentHeights"))),
78
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedDetentIdentifier"))),
79
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedCustomDetentHeight"))),
80
+ JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedDetentIdentifier"))),
81
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedCustomDetentHeight"))),
82
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersGrabberVisible"))),
83
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredCornerRadius"))),
84
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersScrollingExpandsWhenScrolledToEdge"))),
85
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersEdgeAttachedInCompactHeight"))),
86
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "widthFollowsPreferredContentSizeWhenEdgeAttached"))),
87
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "wantsFullScreen")))
88
+ );
89
+ }
90
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::concentricsheet::SheetPresentationConfig& arg) {
91
+ jsi::Object obj(runtime);
92
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "detents"), JSIConverter<std::optional<std::vector<margelo::nitro::concentricsheet::SheetDetentIdentifier>>>::toJSI(runtime, arg.detents));
93
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "customDetentHeights"), JSIConverter<std::optional<std::vector<double>>>::toJSI(runtime, arg.customDetentHeights));
94
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "selectedDetentIdentifier"), JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::toJSI(runtime, arg.selectedDetentIdentifier));
95
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "selectedCustomDetentHeight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.selectedCustomDetentHeight));
96
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedDetentIdentifier"), JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::toJSI(runtime, arg.largestUndimmedDetentIdentifier));
97
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedCustomDetentHeight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.largestUndimmedCustomDetentHeight));
98
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "prefersGrabberVisible"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.prefersGrabberVisible));
99
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "preferredCornerRadius"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.preferredCornerRadius));
100
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "prefersScrollingExpandsWhenScrolledToEdge"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.prefersScrollingExpandsWhenScrolledToEdge));
101
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "prefersEdgeAttachedInCompactHeight"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.prefersEdgeAttachedInCompactHeight));
102
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "widthFollowsPreferredContentSizeWhenEdgeAttached"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.widthFollowsPreferredContentSizeWhenEdgeAttached));
103
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "wantsFullScreen"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.wantsFullScreen));
104
+ return obj;
105
+ }
106
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
107
+ if (!value.isObject()) {
108
+ return false;
109
+ }
110
+ jsi::Object obj = value.getObject(runtime);
111
+ if (!nitro::isPlainObject(runtime, obj)) {
112
+ return false;
113
+ }
114
+ if (!JSIConverter<std::optional<std::vector<margelo::nitro::concentricsheet::SheetDetentIdentifier>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "detents")))) return false;
115
+ if (!JSIConverter<std::optional<std::vector<double>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "customDetentHeights")))) return false;
116
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedDetentIdentifier")))) return false;
117
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selectedCustomDetentHeight")))) return false;
118
+ if (!JSIConverter<std::optional<margelo::nitro::concentricsheet::SheetDetentIdentifier>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedDetentIdentifier")))) return false;
119
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "largestUndimmedCustomDetentHeight")))) return false;
120
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersGrabberVisible")))) return false;
121
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferredCornerRadius")))) return false;
122
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersScrollingExpandsWhenScrolledToEdge")))) return false;
123
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefersEdgeAttachedInCompactHeight")))) return false;
124
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "widthFollowsPreferredContentSizeWhenEdgeAttached")))) return false;
125
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "wantsFullScreen")))) return false;
126
+ return true;
127
+ }
128
+ };
129
+
130
+ } // namespace margelo::nitro
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "concentric-sheet",
3
+ "version": "0.0.2",
4
+ "description": "n iOS sheet view controller that supports concentric corners + glass.",
5
+ "main": "lib/index",
6
+ "module": "lib/index",
7
+ "types": "lib/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "react-native.config.js",
13
+ "lib",
14
+ "nitrogen",
15
+ "ios/**/*.h",
16
+ "ios/**/*.m",
17
+ "ios/**/*.mm",
18
+ "ios/**/*.cpp",
19
+ "ios/**/*.swift",
20
+ "app.plugin.js",
21
+ "nitro.json",
22
+ "*.podspec",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "typecheck": "tsc --noEmit",
27
+ "build": "bun run typescript",
28
+ "clean": "rm -rf node_modules/**/android/build lib",
29
+ "lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
30
+ "lint-ci": "eslint \"**/*.{js,ts,tsx}\" -f @jamesacarr/github-actions",
31
+ "typescript": "tsc",
32
+ "specs": "tsc --noEmit false && nitrogen --logLevel=\"debug\""
33
+ },
34
+ "keywords": [
35
+ "react-native",
36
+ "nitro"
37
+ ],
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/mrousavy/nitro.git"
41
+ },
42
+ "author": "Marc Rousavy <me@mrousavy.com> (https://github.com/mrousavy)",
43
+ "license": "MIT",
44
+ "bugs": {
45
+ "url": "https://github.com/mrousavy/nitro/issues"
46
+ },
47
+ "homepage": "https://github.com/mrousavy/nitro#readme",
48
+ "publishConfig": {
49
+ "registry": "https://registry.npmjs.org/"
50
+ },
51
+ "devDependencies": {
52
+ "@react-native/eslint-config": "0.83.0",
53
+ "@types/react": "^19.1.03",
54
+ "eslint": "^8.57.0",
55
+ "eslint-config-prettier": "^9.1.0",
56
+ "eslint-plugin-prettier": "^5.2.1",
57
+ "nitrogen": "*",
58
+ "prettier": "^3.3.3",
59
+ "react": "19.2.0",
60
+ "react-native": "0.83.0",
61
+ "react-native-nitro-modules": "*",
62
+ "typescript": "^5.8.3"
63
+ },
64
+ "peerDependencies": {
65
+ "react": "*",
66
+ "react-native": "*",
67
+ "react-native-nitro-modules": "*"
68
+ },
69
+ "eslintConfig": {
70
+ "root": true,
71
+ "extends": [
72
+ "@react-native",
73
+ "prettier"
74
+ ],
75
+ "plugins": [
76
+ "prettier"
77
+ ],
78
+ "rules": {
79
+ "prettier/prettier": [
80
+ "warn",
81
+ {
82
+ "quoteProps": "consistent",
83
+ "singleQuote": true,
84
+ "tabWidth": 2,
85
+ "trailingComma": "es5",
86
+ "useTabs": false
87
+ }
88
+ ]
89
+ }
90
+ },
91
+ "eslintIgnore": [
92
+ "node_modules/",
93
+ "lib/"
94
+ ],
95
+ "prettier": {
96
+ "quoteProps": "consistent",
97
+ "singleQuote": true,
98
+ "tabWidth": 2,
99
+ "trailingComma": "es5",
100
+ "useTabs": false,
101
+ "semi": false
102
+ }
103
+ }
@@ -0,0 +1,13 @@
1
+ // https://github.com/react-native-community/cli/blob/main/docs/dependencies.md
2
+
3
+ module.exports = {
4
+ dependency: {
5
+ platforms: {
6
+ /**
7
+ * @type {import('@react-native-community/cli-types').IOSDependencyParams}
8
+ */
9
+ ios: {},
10
+ android: null,
11
+ },
12
+ },
13
+ }