aix 0.1.0 → 0.2.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.
Files changed (50) hide show
  1. package/ios/HybridAix.swift +22 -8
  2. package/lib/commonjs/aix.js +11 -0
  3. package/lib/commonjs/aix.js.map +1 -1
  4. package/lib/commonjs/hooks/useContentInsetHandler.js +30 -0
  5. package/lib/commonjs/hooks/useContentInsetHandler.js.map +1 -0
  6. package/lib/commonjs/index.js +9 -1
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/module/aix.js +11 -0
  9. package/lib/module/aix.js.map +1 -1
  10. package/lib/module/hooks/useContentInsetHandler.js +26 -0
  11. package/lib/module/hooks/useContentInsetHandler.js.map +1 -0
  12. package/lib/module/index.js +1 -0
  13. package/lib/module/index.js.map +1 -1
  14. package/lib/typescript/src/aix.d.ts +7 -3
  15. package/lib/typescript/src/aix.d.ts.map +1 -1
  16. package/lib/typescript/src/hooks/useContentInsetHandler.d.ts +21 -0
  17. package/lib/typescript/src/hooks/useContentInsetHandler.d.ts.map +1 -0
  18. package/lib/typescript/src/index.d.ts +2 -0
  19. package/lib/typescript/src/index.d.ts.map +1 -1
  20. package/lib/typescript/src/views/aix.nitro.d.ts +30 -0
  21. package/lib/typescript/src/views/aix.nitro.d.ts.map +1 -1
  22. package/nitrogen/generated/android/AixOnLoad.cpp +2 -0
  23. package/nitrogen/generated/android/c++/JAixContentInsets.hpp +69 -0
  24. package/nitrogen/generated/android/c++/JFunc_void_AixContentInsets.hpp +78 -0
  25. package/nitrogen/generated/android/c++/JHybridAixSpec.cpp +33 -0
  26. package/nitrogen/generated/android/c++/JHybridAixSpec.hpp +4 -0
  27. package/nitrogen/generated/android/c++/views/JHybridAixStateUpdater.cpp +8 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/AixContentInsets.kt +47 -0
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/Func_void_AixContentInsets.kt +80 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixSpec.kt +20 -0
  31. package/nitrogen/generated/ios/Aix-Swift-Cxx-Bridge.cpp +8 -0
  32. package/nitrogen/generated/ios/Aix-Swift-Cxx-Bridge.hpp +41 -0
  33. package/nitrogen/generated/ios/Aix-Swift-Cxx-Umbrella.hpp +4 -0
  34. package/nitrogen/generated/ios/c++/HybridAixSpecSwift.hpp +18 -0
  35. package/nitrogen/generated/ios/c++/views/HybridAixComponent.mm +10 -0
  36. package/nitrogen/generated/ios/swift/AixContentInsets.swift +117 -0
  37. package/nitrogen/generated/ios/swift/Func_void_AixContentInsets.swift +47 -0
  38. package/nitrogen/generated/ios/swift/HybridAixSpec.swift +2 -0
  39. package/nitrogen/generated/ios/swift/HybridAixSpec_cxx.swift +56 -0
  40. package/nitrogen/generated/shared/c++/AixContentInsets.hpp +87 -0
  41. package/nitrogen/generated/shared/c++/HybridAixSpec.cpp +4 -0
  42. package/nitrogen/generated/shared/c++/HybridAixSpec.hpp +8 -0
  43. package/nitrogen/generated/shared/c++/views/HybridAixComponent.cpp +24 -0
  44. package/nitrogen/generated/shared/c++/views/HybridAixComponent.hpp +4 -1
  45. package/nitrogen/generated/shared/json/AixConfig.json +2 -0
  46. package/package.json +4 -2
  47. package/src/aix.tsx +26 -11
  48. package/src/hooks/useContentInsetHandler.ts +28 -0
  49. package/src/index.ts +2 -0
  50. package/src/views/aix.nitro.ts +10 -0
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// AixContentInsets.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.aix
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "AixContentInsets".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class AixContentInsets(
20
+ @DoNotStrip
21
+ @Keep
22
+ val top: Double?,
23
+ @DoNotStrip
24
+ @Keep
25
+ val left: Double?,
26
+ @DoNotStrip
27
+ @Keep
28
+ val bottom: Double?,
29
+ @DoNotStrip
30
+ @Keep
31
+ val right: Double?
32
+ ) {
33
+ /* primary constructor */
34
+
35
+ private companion object {
36
+ /**
37
+ * Constructor called from C++
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress("unused")
42
+ @JvmStatic
43
+ private fun fromCpp(top: Double?, left: Double?, bottom: Double?, right: Double?): AixContentInsets {
44
+ return AixContentInsets(top, left, bottom, right)
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// Func_void_AixContentInsets.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.aix
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+
15
+
16
+ /**
17
+ * Represents the JavaScript callback `(insets: struct) => void`.
18
+ * This can be either implemented in C++ (in which case it might be a callback coming from JS),
19
+ * or in Kotlin/Java (in which case it is a native callback).
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress("ClassName", "RedundantUnitReturnType")
24
+ fun interface Func_void_AixContentInsets: (AixContentInsets) -> Unit {
25
+ /**
26
+ * Call the given JS callback.
27
+ * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
28
+ */
29
+ @DoNotStrip
30
+ @Keep
31
+ override fun invoke(insets: AixContentInsets): Unit
32
+ }
33
+
34
+ /**
35
+ * Represents the JavaScript callback `(insets: struct) => void`.
36
+ * This is implemented in C++, via a `std::function<...>`.
37
+ * The callback might be coming from JS.
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress(
42
+ "KotlinJniMissingFunction", "unused",
43
+ "RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
44
+ "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
45
+ )
46
+ class Func_void_AixContentInsets_cxx: Func_void_AixContentInsets {
47
+ @DoNotStrip
48
+ @Keep
49
+ private val mHybridData: HybridData
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ private constructor(hybridData: HybridData) {
54
+ mHybridData = hybridData
55
+ }
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ override fun invoke(insets: AixContentInsets): Unit
60
+ = invoke_cxx(insets)
61
+
62
+ @FastNative
63
+ private external fun invoke_cxx(insets: AixContentInsets): Unit
64
+ }
65
+
66
+ /**
67
+ * Represents the JavaScript callback `(insets: struct) => void`.
68
+ * This is implemented in Java/Kotlin, via a `(AixContentInsets) -> Unit`.
69
+ * The callback is always coming from native.
70
+ */
71
+ @DoNotStrip
72
+ @Keep
73
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
74
+ class Func_void_AixContentInsets_java(private val function: (AixContentInsets) -> Unit): Func_void_AixContentInsets {
75
+ @DoNotStrip
76
+ @Keep
77
+ override fun invoke(insets: AixContentInsets): Unit {
78
+ return this.function(insets)
79
+ }
80
+ }
@@ -83,6 +83,26 @@ abstract class HybridAixSpec: HybridView() {
83
83
  @set:DoNotStrip
84
84
  @set:Keep
85
85
  abstract var penultimateCellIndex: Double?
86
+
87
+ @get:DoNotStrip
88
+ @get:Keep
89
+ @set:DoNotStrip
90
+ @set:Keep
91
+ abstract var shouldApplyContentInsets: Boolean?
92
+
93
+ abstract var onWillApplyContentInsets: ((insets: AixContentInsets) -> Unit)?
94
+
95
+ private var onWillApplyContentInsets_cxx: Func_void_AixContentInsets?
96
+ @Keep
97
+ @DoNotStrip
98
+ get() {
99
+ return onWillApplyContentInsets?.let { Func_void_AixContentInsets_java(it) }
100
+ }
101
+ @Keep
102
+ @DoNotStrip
103
+ set(value) {
104
+ onWillApplyContentInsets = value?.let { it }
105
+ }
86
106
 
87
107
  // Methods
88
108
  @DoNotStrip
@@ -16,6 +16,14 @@
16
16
 
17
17
  namespace margelo::nitro::aix::bridge::swift {
18
18
 
19
+ // pragma MARK: std::function<void(const AixContentInsets& /* insets */)>
20
+ Func_void_AixContentInsets create_Func_void_AixContentInsets(void* NON_NULL swiftClosureWrapper) noexcept {
21
+ auto swiftClosure = Aix::Func_void_AixContentInsets::fromUnsafe(swiftClosureWrapper);
22
+ return [swiftClosure = std::move(swiftClosure)](const AixContentInsets& insets) mutable -> void {
23
+ swiftClosure.call(insets);
24
+ };
25
+ }
26
+
19
27
  // pragma MARK: std::shared_ptr<HybridAixSpec>
20
28
  std::shared_ptr<HybridAixSpec> create_std__shared_ptr_HybridAixSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
21
29
  Aix::HybridAixSpec_cxx swiftPart = Aix::HybridAixSpec_cxx::fromUnsafe(swiftUnsafePointer);
@@ -12,6 +12,8 @@
12
12
  namespace margelo::nitro::aix { struct AixAdditionalContentInsetsProp; }
13
13
  // Forward declaration of `AixAdditionalContentInsets` to properly resolve imports.
14
14
  namespace margelo::nitro::aix { struct AixAdditionalContentInsets; }
15
+ // Forward declaration of `AixContentInsets` to properly resolve imports.
16
+ namespace margelo::nitro::aix { struct AixContentInsets; }
15
17
  // Forward declaration of `AixScrollIndicatorInsetValue` to properly resolve imports.
16
18
  namespace margelo::nitro::aix { struct AixScrollIndicatorInsetValue; }
17
19
  // Forward declaration of `AixScrollIndicatorInsets` to properly resolve imports.
@@ -36,6 +38,7 @@ namespace Aix { class HybridAixSpec_cxx; }
36
38
  // Include C++ defined types
37
39
  #include "AixAdditionalContentInsets.hpp"
38
40
  #include "AixAdditionalContentInsetsProp.hpp"
41
+ #include "AixContentInsets.hpp"
39
42
  #include "AixScrollIndicatorInsetValue.hpp"
40
43
  #include "AixScrollIndicatorInsets.hpp"
41
44
  #include "AixScrollOnFooterSizeUpdate.hpp"
@@ -44,6 +47,7 @@ namespace Aix { class HybridAixSpec_cxx; }
44
47
  #include "HybridAixSpec.hpp"
45
48
  #include <NitroModules/Result.hpp>
46
49
  #include <exception>
50
+ #include <functional>
47
51
  #include <memory>
48
52
  #include <optional>
49
53
  #include <string>
@@ -174,6 +178,43 @@ namespace margelo::nitro::aix::bridge::swift {
174
178
  return *optional;
175
179
  }
176
180
 
181
+ // pragma MARK: std::function<void(const AixContentInsets& /* insets */)>
182
+ /**
183
+ * Specialized version of `std::function<void(const AixContentInsets&)>`.
184
+ */
185
+ using Func_void_AixContentInsets = std::function<void(const AixContentInsets& /* insets */)>;
186
+ /**
187
+ * Wrapper class for a `std::function<void(const AixContentInsets& / * insets * /)>`, this can be used from Swift.
188
+ */
189
+ class Func_void_AixContentInsets_Wrapper final {
190
+ public:
191
+ explicit Func_void_AixContentInsets_Wrapper(std::function<void(const AixContentInsets& /* insets */)>&& func): _function(std::make_unique<std::function<void(const AixContentInsets& /* insets */)>>(std::move(func))) {}
192
+ inline void call(AixContentInsets insets) const noexcept {
193
+ _function->operator()(insets);
194
+ }
195
+ private:
196
+ std::unique_ptr<std::function<void(const AixContentInsets& /* insets */)>> _function;
197
+ } SWIFT_NONCOPYABLE;
198
+ Func_void_AixContentInsets create_Func_void_AixContentInsets(void* NON_NULL swiftClosureWrapper) noexcept;
199
+ inline Func_void_AixContentInsets_Wrapper wrap_Func_void_AixContentInsets(Func_void_AixContentInsets value) noexcept {
200
+ return Func_void_AixContentInsets_Wrapper(std::move(value));
201
+ }
202
+
203
+ // pragma MARK: std::optional<std::function<void(const AixContentInsets& /* insets */)>>
204
+ /**
205
+ * Specialized version of `std::optional<std::function<void(const AixContentInsets& / * insets * /)>>`.
206
+ */
207
+ using std__optional_std__function_void_const_AixContentInsets_____insets______ = std::optional<std::function<void(const AixContentInsets& /* insets */)>>;
208
+ inline std::optional<std::function<void(const AixContentInsets& /* insets */)>> create_std__optional_std__function_void_const_AixContentInsets_____insets______(const std::function<void(const AixContentInsets& /* insets */)>& value) noexcept {
209
+ return std::optional<std::function<void(const AixContentInsets& /* insets */)>>(value);
210
+ }
211
+ inline bool has_value_std__optional_std__function_void_const_AixContentInsets_____insets______(const std::optional<std::function<void(const AixContentInsets& /* insets */)>>& optional) noexcept {
212
+ return optional.has_value();
213
+ }
214
+ inline std::function<void(const AixContentInsets& /* insets */)> get_std__optional_std__function_void_const_AixContentInsets_____insets______(const std::optional<std::function<void(const AixContentInsets& /* insets */)>>& optional) noexcept {
215
+ return *optional;
216
+ }
217
+
177
218
  // pragma MARK: std::shared_ptr<HybridAixSpec>
178
219
  /**
179
220
  * Specialized version of `std::shared_ptr<HybridAixSpec>`.
@@ -12,6 +12,8 @@
12
12
  namespace margelo::nitro::aix { struct AixAdditionalContentInsetsProp; }
13
13
  // Forward declaration of `AixAdditionalContentInsets` to properly resolve imports.
14
14
  namespace margelo::nitro::aix { struct AixAdditionalContentInsets; }
15
+ // Forward declaration of `AixContentInsets` to properly resolve imports.
16
+ namespace margelo::nitro::aix { struct AixContentInsets; }
15
17
  // Forward declaration of `AixScrollIndicatorInsetValue` to properly resolve imports.
16
18
  namespace margelo::nitro::aix { struct AixScrollIndicatorInsetValue; }
17
19
  // Forward declaration of `AixScrollIndicatorInsets` to properly resolve imports.
@@ -28,6 +30,7 @@ namespace margelo::nitro::aix { class HybridAixSpec; }
28
30
  // Include C++ defined types
29
31
  #include "AixAdditionalContentInsets.hpp"
30
32
  #include "AixAdditionalContentInsetsProp.hpp"
33
+ #include "AixContentInsets.hpp"
31
34
  #include "AixScrollIndicatorInsetValue.hpp"
32
35
  #include "AixScrollIndicatorInsets.hpp"
33
36
  #include "AixScrollOnFooterSizeUpdate.hpp"
@@ -36,6 +39,7 @@ namespace margelo::nitro::aix { class HybridAixSpec; }
36
39
  #include "HybridAixSpec.hpp"
37
40
  #include <NitroModules/Result.hpp>
38
41
  #include <exception>
42
+ #include <functional>
39
43
  #include <memory>
40
44
  #include <optional>
41
45
  #include <string>
@@ -22,6 +22,8 @@ namespace margelo::nitro::aix { struct AixAdditionalContentInsets; }
22
22
  namespace margelo::nitro::aix { struct AixScrollIndicatorInsets; }
23
23
  // Forward declaration of `AixScrollIndicatorInsetValue` to properly resolve imports.
24
24
  namespace margelo::nitro::aix { struct AixScrollIndicatorInsetValue; }
25
+ // Forward declaration of `AixContentInsets` to properly resolve imports.
26
+ namespace margelo::nitro::aix { struct AixContentInsets; }
25
27
 
26
28
  #include "AixScrollOnFooterSizeUpdate.hpp"
27
29
  #include <optional>
@@ -30,6 +32,8 @@ namespace margelo::nitro::aix { struct AixScrollIndicatorInsetValue; }
30
32
  #include "AixScrollIndicatorInsets.hpp"
31
33
  #include "AixScrollIndicatorInsetValue.hpp"
32
34
  #include <string>
35
+ #include "AixContentInsets.hpp"
36
+ #include <functional>
33
37
 
34
38
  #include "Aix-Swift-Cxx-Umbrella.hpp"
35
39
 
@@ -119,6 +123,20 @@ namespace margelo::nitro::aix {
119
123
  inline void setPenultimateCellIndex(std::optional<double> penultimateCellIndex) noexcept override {
120
124
  _swiftPart.setPenultimateCellIndex(penultimateCellIndex);
121
125
  }
126
+ inline std::optional<bool> getShouldApplyContentInsets() noexcept override {
127
+ auto __result = _swiftPart.getShouldApplyContentInsets();
128
+ return __result;
129
+ }
130
+ inline void setShouldApplyContentInsets(std::optional<bool> shouldApplyContentInsets) noexcept override {
131
+ _swiftPart.setShouldApplyContentInsets(shouldApplyContentInsets);
132
+ }
133
+ inline std::optional<std::function<void(const AixContentInsets& /* insets */)>> getOnWillApplyContentInsets() noexcept override {
134
+ auto __result = _swiftPart.getOnWillApplyContentInsets();
135
+ return __result;
136
+ }
137
+ inline void setOnWillApplyContentInsets(const std::optional<std::function<void(const AixContentInsets& /* insets */)>>& onWillApplyContentInsets) noexcept override {
138
+ _swiftPart.setOnWillApplyContentInsets(onWillApplyContentInsets);
139
+ }
122
140
 
123
141
  public:
124
142
  // Methods
@@ -106,6 +106,16 @@ using namespace margelo::nitro::aix::views;
106
106
  swiftPart.setPenultimateCellIndex(newViewProps.penultimateCellIndex.value);
107
107
  newViewProps.penultimateCellIndex.isDirty = false;
108
108
  }
109
+ // shouldApplyContentInsets: optional
110
+ if (newViewProps.shouldApplyContentInsets.isDirty) {
111
+ swiftPart.setShouldApplyContentInsets(newViewProps.shouldApplyContentInsets.value);
112
+ newViewProps.shouldApplyContentInsets.isDirty = false;
113
+ }
114
+ // onWillApplyContentInsets: optional
115
+ if (newViewProps.onWillApplyContentInsets.isDirty) {
116
+ swiftPart.setOnWillApplyContentInsets(newViewProps.onWillApplyContentInsets.value);
117
+ newViewProps.onWillApplyContentInsets.isDirty = false;
118
+ }
109
119
 
110
120
  swiftPart.afterUpdate();
111
121
 
@@ -0,0 +1,117 @@
1
+ ///
2
+ /// AixContentInsets.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Represents an instance of `AixContentInsets`, backed by a C++ struct.
13
+ */
14
+ public typealias AixContentInsets = margelo.nitro.aix.AixContentInsets
15
+
16
+ public extension AixContentInsets {
17
+ private typealias bridge = margelo.nitro.aix.bridge.swift
18
+
19
+ /**
20
+ * Create a new instance of `AixContentInsets`.
21
+ */
22
+ init(top: Double?, left: Double?, bottom: Double?, right: Double?) {
23
+ self.init({ () -> bridge.std__optional_double_ in
24
+ if let __unwrappedValue = top {
25
+ return bridge.create_std__optional_double_(__unwrappedValue)
26
+ } else {
27
+ return .init()
28
+ }
29
+ }(), { () -> bridge.std__optional_double_ in
30
+ if let __unwrappedValue = left {
31
+ return bridge.create_std__optional_double_(__unwrappedValue)
32
+ } else {
33
+ return .init()
34
+ }
35
+ }(), { () -> bridge.std__optional_double_ in
36
+ if let __unwrappedValue = bottom {
37
+ return bridge.create_std__optional_double_(__unwrappedValue)
38
+ } else {
39
+ return .init()
40
+ }
41
+ }(), { () -> bridge.std__optional_double_ in
42
+ if let __unwrappedValue = right {
43
+ return bridge.create_std__optional_double_(__unwrappedValue)
44
+ } else {
45
+ return .init()
46
+ }
47
+ }())
48
+ }
49
+
50
+ var top: Double? {
51
+ @inline(__always)
52
+ get {
53
+ return self.__top.value
54
+ }
55
+ @inline(__always)
56
+ set {
57
+ self.__top = { () -> bridge.std__optional_double_ in
58
+ if let __unwrappedValue = newValue {
59
+ return bridge.create_std__optional_double_(__unwrappedValue)
60
+ } else {
61
+ return .init()
62
+ }
63
+ }()
64
+ }
65
+ }
66
+
67
+ var left: Double? {
68
+ @inline(__always)
69
+ get {
70
+ return self.__left.value
71
+ }
72
+ @inline(__always)
73
+ set {
74
+ self.__left = { () -> bridge.std__optional_double_ in
75
+ if let __unwrappedValue = newValue {
76
+ return bridge.create_std__optional_double_(__unwrappedValue)
77
+ } else {
78
+ return .init()
79
+ }
80
+ }()
81
+ }
82
+ }
83
+
84
+ var bottom: Double? {
85
+ @inline(__always)
86
+ get {
87
+ return self.__bottom.value
88
+ }
89
+ @inline(__always)
90
+ set {
91
+ self.__bottom = { () -> bridge.std__optional_double_ in
92
+ if let __unwrappedValue = newValue {
93
+ return bridge.create_std__optional_double_(__unwrappedValue)
94
+ } else {
95
+ return .init()
96
+ }
97
+ }()
98
+ }
99
+ }
100
+
101
+ var right: Double? {
102
+ @inline(__always)
103
+ get {
104
+ return self.__right.value
105
+ }
106
+ @inline(__always)
107
+ set {
108
+ self.__right = { () -> bridge.std__optional_double_ in
109
+ if let __unwrappedValue = newValue {
110
+ return bridge.create_std__optional_double_(__unwrappedValue)
111
+ } else {
112
+ return .init()
113
+ }
114
+ }()
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_AixContentInsets.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ insets: AixContentInsets) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_AixContentInsets {
16
+ public typealias bridge = margelo.nitro.aix.bridge.swift
17
+
18
+ private let closure: (_ insets: AixContentInsets) -> Void
19
+
20
+ public init(_ closure: @escaping (_ insets: AixContentInsets) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(insets: AixContentInsets) -> Void {
26
+ self.closure(insets)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_AixContentInsets`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_AixContentInsets>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_AixContentInsets {
45
+ return Unmanaged<Func_void_AixContentInsets>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -18,6 +18,8 @@ public protocol HybridAixSpec_protocol: HybridObject, HybridView {
18
18
  var additionalScrollIndicatorInsets: AixScrollIndicatorInsets? { get set }
19
19
  var mainScrollViewID: String? { get set }
20
20
  var penultimateCellIndex: Double? { get set }
21
+ var shouldApplyContentInsets: Bool? { get set }
22
+ var onWillApplyContentInsets: ((_ insets: AixContentInsets) -> Void)? { get set }
21
23
 
22
24
  // Methods
23
25
  func scrollToEnd(animated: Bool?) throws -> Void
@@ -233,6 +233,62 @@ open class HybridAixSpec_cxx {
233
233
  self.__implementation.penultimateCellIndex = newValue.value
234
234
  }
235
235
  }
236
+
237
+ public final var shouldApplyContentInsets: bridge.std__optional_bool_ {
238
+ @inline(__always)
239
+ get {
240
+ return { () -> bridge.std__optional_bool_ in
241
+ if let __unwrappedValue = self.__implementation.shouldApplyContentInsets {
242
+ return bridge.create_std__optional_bool_(__unwrappedValue)
243
+ } else {
244
+ return .init()
245
+ }
246
+ }()
247
+ }
248
+ @inline(__always)
249
+ set {
250
+ self.__implementation.shouldApplyContentInsets = { () -> Bool? in
251
+ if bridge.has_value_std__optional_bool_(newValue) {
252
+ let __unwrapped = bridge.get_std__optional_bool_(newValue)
253
+ return __unwrapped
254
+ } else {
255
+ return nil
256
+ }
257
+ }()
258
+ }
259
+ }
260
+
261
+ public final var onWillApplyContentInsets: bridge.std__optional_std__function_void_const_AixContentInsets_____insets______ {
262
+ @inline(__always)
263
+ get {
264
+ return { () -> bridge.std__optional_std__function_void_const_AixContentInsets_____insets______ in
265
+ if let __unwrappedValue = self.__implementation.onWillApplyContentInsets {
266
+ return bridge.create_std__optional_std__function_void_const_AixContentInsets_____insets______({ () -> bridge.Func_void_AixContentInsets in
267
+ let __closureWrapper = Func_void_AixContentInsets(__unwrappedValue)
268
+ return bridge.create_Func_void_AixContentInsets(__closureWrapper.toUnsafe())
269
+ }())
270
+ } else {
271
+ return .init()
272
+ }
273
+ }()
274
+ }
275
+ @inline(__always)
276
+ set {
277
+ self.__implementation.onWillApplyContentInsets = { () -> ((_ insets: AixContentInsets) -> Void)? in
278
+ if bridge.has_value_std__optional_std__function_void_const_AixContentInsets_____insets______(newValue) {
279
+ let __unwrapped = bridge.get_std__optional_std__function_void_const_AixContentInsets_____insets______(newValue)
280
+ return { () -> (AixContentInsets) -> Void in
281
+ let __wrappedFunction = bridge.wrap_Func_void_AixContentInsets(__unwrapped)
282
+ return { (__insets: AixContentInsets) -> Void in
283
+ __wrappedFunction.call(__insets)
284
+ }
285
+ }()
286
+ } else {
287
+ return nil
288
+ }
289
+ }()
290
+ }
291
+ }
236
292
 
237
293
  // Methods
238
294
  @inline(__always)
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// AixContentInsets.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 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
+
26
+
27
+
28
+ #include <optional>
29
+
30
+ namespace margelo::nitro::aix {
31
+
32
+ /**
33
+ * A struct which can be represented as a JavaScript object (AixContentInsets).
34
+ */
35
+ struct AixContentInsets {
36
+ public:
37
+ std::optional<double> top SWIFT_PRIVATE;
38
+ std::optional<double> left SWIFT_PRIVATE;
39
+ std::optional<double> bottom SWIFT_PRIVATE;
40
+ std::optional<double> right SWIFT_PRIVATE;
41
+
42
+ public:
43
+ AixContentInsets() = default;
44
+ explicit AixContentInsets(std::optional<double> top, std::optional<double> left, std::optional<double> bottom, std::optional<double> right): top(top), left(left), bottom(bottom), right(right) {}
45
+ };
46
+
47
+ } // namespace margelo::nitro::aix
48
+
49
+ namespace margelo::nitro {
50
+
51
+ // C++ AixContentInsets <> JS AixContentInsets (object)
52
+ template <>
53
+ struct JSIConverter<margelo::nitro::aix::AixContentInsets> final {
54
+ static inline margelo::nitro::aix::AixContentInsets fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
+ jsi::Object obj = arg.asObject(runtime);
56
+ return margelo::nitro::aix::AixContentInsets(
57
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "top")),
58
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "left")),
59
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "bottom")),
60
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "right"))
61
+ );
62
+ }
63
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::aix::AixContentInsets& arg) {
64
+ jsi::Object obj(runtime);
65
+ obj.setProperty(runtime, "top", JSIConverter<std::optional<double>>::toJSI(runtime, arg.top));
66
+ obj.setProperty(runtime, "left", JSIConverter<std::optional<double>>::toJSI(runtime, arg.left));
67
+ obj.setProperty(runtime, "bottom", JSIConverter<std::optional<double>>::toJSI(runtime, arg.bottom));
68
+ obj.setProperty(runtime, "right", JSIConverter<std::optional<double>>::toJSI(runtime, arg.right));
69
+ return obj;
70
+ }
71
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
72
+ if (!value.isObject()) {
73
+ return false;
74
+ }
75
+ jsi::Object obj = value.getObject(runtime);
76
+ if (!nitro::isPlainObject(runtime, obj)) {
77
+ return false;
78
+ }
79
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "top"))) return false;
80
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "left"))) return false;
81
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "bottom"))) return false;
82
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "right"))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -28,6 +28,10 @@ namespace margelo::nitro::aix {
28
28
  prototype.registerHybridSetter("mainScrollViewID", &HybridAixSpec::setMainScrollViewID);
29
29
  prototype.registerHybridGetter("penultimateCellIndex", &HybridAixSpec::getPenultimateCellIndex);
30
30
  prototype.registerHybridSetter("penultimateCellIndex", &HybridAixSpec::setPenultimateCellIndex);
31
+ prototype.registerHybridGetter("shouldApplyContentInsets", &HybridAixSpec::getShouldApplyContentInsets);
32
+ prototype.registerHybridSetter("shouldApplyContentInsets", &HybridAixSpec::setShouldApplyContentInsets);
33
+ prototype.registerHybridGetter("onWillApplyContentInsets", &HybridAixSpec::getOnWillApplyContentInsets);
34
+ prototype.registerHybridSetter("onWillApplyContentInsets", &HybridAixSpec::setOnWillApplyContentInsets);
31
35
  prototype.registerHybridMethod("scrollToEnd", &HybridAixSpec::scrollToEnd);
32
36
  prototype.registerHybridMethod("scrollToIndexWhenBlankSizeReady", &HybridAixSpec::scrollToIndexWhenBlankSizeReady);
33
37
  });