aix 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/aix/HybridAix.kt +21 -11
- package/ios/HybridAix.swift +18 -8
- package/lib/typescript/src/aix.d.ts +2 -0
- package/lib/typescript/src/aix.d.ts.map +1 -1
- package/lib/typescript/src/views/aix.nitro.d.ts +7 -0
- package/lib/typescript/src/views/aix.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridAixSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JHybridAixSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/views/JHybridAixStateUpdater.cpp +4 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixSpec.kt +6 -0
- package/nitrogen/generated/ios/c++/HybridAixSpecSwift.hpp +7 -0
- package/nitrogen/generated/ios/c++/views/HybridAixComponent.mm +5 -0
- package/nitrogen/generated/ios/swift/HybridAixSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridAixSpec_cxx.swift +17 -0
- package/nitrogen/generated/shared/c++/HybridAixSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridAixSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/views/HybridAixComponent.cpp +12 -0
- package/nitrogen/generated/shared/c++/views/HybridAixComponent.hpp +1 -0
- package/nitrogen/generated/shared/json/AixConfig.json +1 -0
- package/package.json +1 -1
- package/src/views/aix.nitro.ts +7 -0
|
@@ -5,7 +5,7 @@ import android.view.View
|
|
|
5
5
|
import androidx.annotation.Keep
|
|
6
6
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
7
7
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
8
|
-
import com.margelo.nitro.aix
|
|
8
|
+
import com.margelo.nitro.aix.*
|
|
9
9
|
|
|
10
10
|
@Keep
|
|
11
11
|
@DoNotStrip
|
|
@@ -14,14 +14,24 @@ class HybridAix(val context: ThemedReactContext): HybridAixSpec() {
|
|
|
14
14
|
override val view: View = View(context)
|
|
15
15
|
|
|
16
16
|
// Props
|
|
17
|
-
|
|
18
|
-
override var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
override var shouldStartAtEnd: Boolean = true
|
|
18
|
+
override var scrollOnFooterSizeUpdate: AixScrollOnFooterSizeUpdate? = null
|
|
19
|
+
override var scrollEndReachedThreshold: Double? = null
|
|
20
|
+
override var additionalContentInsets: AixAdditionalContentInsetsProp? = null
|
|
21
|
+
override var additionalScrollIndicatorInsets: AixScrollIndicatorInsets? = null
|
|
22
|
+
override var mainScrollViewID: String? = null
|
|
23
|
+
override var penultimateCellIndex: Double? = null
|
|
24
|
+
override var shouldApplyContentInsets: Boolean? = null
|
|
25
|
+
override var applyContentInsetDelay: Double? = null
|
|
26
|
+
override var onWillApplyContentInsets: ((insets: AixContentInsets) -> Unit)? = null
|
|
27
|
+
override var onScrolledNearEndChange: ((isNearEnd: Boolean) -> Unit)? = null
|
|
28
|
+
|
|
29
|
+
// Methods
|
|
30
|
+
override fun scrollToEnd(animated: Boolean?) {
|
|
31
|
+
// TODO: Implement for Android
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun scrollToIndexWhenBlankSizeReady(index: Double, animated: Boolean?, waitForKeyboardToEnd: Boolean?) {
|
|
35
|
+
// TODO: Implement for Android
|
|
36
|
+
}
|
|
27
37
|
}
|
package/ios/HybridAix.swift
CHANGED
|
@@ -100,6 +100,7 @@ class HybridAix: HybridAixSpec, AixContext, KeyboardNotificationsDelegate {
|
|
|
100
100
|
var penultimateCellIndex: Double?
|
|
101
101
|
|
|
102
102
|
var shouldApplyContentInsets: Bool? = nil
|
|
103
|
+
var applyContentInsetDelay: Double? = nil
|
|
103
104
|
var onWillApplyContentInsets: ((_ insets: AixContentInsets) -> Void)? = nil
|
|
104
105
|
var onScrolledNearEndChange: ((_ isNearEnd: Bool) -> Void)? = nil
|
|
105
106
|
|
|
@@ -455,16 +456,25 @@ class HybridAix: HybridAixSpec, AixContext, KeyboardNotificationsDelegate {
|
|
|
455
456
|
return
|
|
456
457
|
}
|
|
457
458
|
|
|
458
|
-
//
|
|
459
|
-
|
|
460
|
-
scrollView
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
459
|
+
// Helper to actually apply the insets
|
|
460
|
+
let applyInsets = { [weak self] in
|
|
461
|
+
guard let self, let scrollView = self.scrollView else { return }
|
|
462
|
+
if scrollView.contentInset.top != targetTop {
|
|
463
|
+
scrollView.contentInset.top = targetTop
|
|
464
|
+
}
|
|
465
|
+
if scrollView.contentInset.bottom != targetBottom {
|
|
466
|
+
scrollView.contentInset.bottom = targetBottom
|
|
467
|
+
}
|
|
468
|
+
// Update scrolled near end state after insets change
|
|
469
|
+
self.updateScrolledNearEndState()
|
|
464
470
|
}
|
|
465
471
|
|
|
466
|
-
//
|
|
467
|
-
|
|
472
|
+
// Apply with optional delay
|
|
473
|
+
if let delay = applyContentInsetDelay, delay > 0 {
|
|
474
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + delay / 1000.0, execute: applyInsets)
|
|
475
|
+
} else {
|
|
476
|
+
applyInsets()
|
|
477
|
+
}
|
|
468
478
|
}
|
|
469
479
|
|
|
470
480
|
/// Centralized function to check and fire onScrolledNearEndChange callback
|
|
@@ -10,6 +10,7 @@ export declare const Aix: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
10
10
|
mainScrollViewID?: string | import("react-native-reanimated").SharedValue<string | undefined> | undefined;
|
|
11
11
|
penultimateCellIndex?: number | import("react-native-reanimated").SharedValue<number | undefined> | undefined;
|
|
12
12
|
shouldApplyContentInsets?: boolean | import("react-native-reanimated").SharedValue<boolean | undefined> | undefined;
|
|
13
|
+
applyContentInsetDelay?: number | import("react-native-reanimated").SharedValue<number | undefined> | undefined;
|
|
13
14
|
onWillApplyContentInsets?: import("react-native-nitro-modules").NitroViewWrappedCallback<((insets: AixContentInsets) => void) | undefined> | import("react-native-reanimated").SharedValue<import("react-native-nitro-modules").NitroViewWrappedCallback<((insets: AixContentInsets) => void) | undefined> | undefined> | undefined;
|
|
14
15
|
onScrolledNearEndChange?: import("react-native-nitro-modules").NitroViewWrappedCallback<((isNearEnd: boolean) => void) | undefined> | import("react-native-reanimated").SharedValue<import("react-native-nitro-modules").NitroViewWrappedCallback<((isNearEnd: boolean) => void) | undefined> | undefined> | undefined;
|
|
15
16
|
hybridRef?: import("react-native-nitro-modules").NitroViewWrappedCallback<((ref: import("react-native-nitro-modules").HybridView<AixProps, AixMethods>) => void) | undefined> | import("react-native-reanimated").SharedValue<import("react-native-nitro-modules").NitroViewWrappedCallback<((ref: import("react-native-nitro-modules").HybridView<AixProps, AixMethods>) => void) | undefined> | undefined> | undefined;
|
|
@@ -127,6 +128,7 @@ export declare const Aix: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
127
128
|
mainScrollViewID?: string | import("react-native-reanimated").SharedValue<string | undefined> | undefined;
|
|
128
129
|
penultimateCellIndex?: number | import("react-native-reanimated").SharedValue<number | undefined> | undefined;
|
|
129
130
|
shouldApplyContentInsets?: boolean | import("react-native-reanimated").SharedValue<boolean | undefined> | undefined;
|
|
131
|
+
applyContentInsetDelay?: number | import("react-native-reanimated").SharedValue<number | undefined> | undefined;
|
|
130
132
|
onWillApplyContentInsets?: import("react-native-nitro-modules").NitroViewWrappedCallback<((insets: AixContentInsets) => void) | undefined> | import("react-native-reanimated").SharedValue<import("react-native-nitro-modules").NitroViewWrappedCallback<((insets: AixContentInsets) => void) | undefined> | undefined> | undefined;
|
|
131
133
|
onScrolledNearEndChange?: import("react-native-nitro-modules").NitroViewWrappedCallback<((isNearEnd: boolean) => void) | undefined> | import("react-native-reanimated").SharedValue<import("react-native-nitro-modules").NitroViewWrappedCallback<((isNearEnd: boolean) => void) | undefined> | undefined> | undefined;
|
|
132
134
|
hybridRef?: import("react-native-nitro-modules").NitroViewWrappedCallback<((ref: import("react-native-nitro-modules").HybridView<AixProps, AixMethods>) => void) | undefined> | import("react-native-reanimated").SharedValue<import("react-native-nitro-modules").NitroViewWrappedCallback<((ref: import("react-native-nitro-modules").HybridView<AixProps, AixMethods>) => void) | undefined> | undefined> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aix.d.ts","sourceRoot":"","sources":["../../../src/aix.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAI/E,MAAM,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;AAgBpD,eAAO,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"aix.d.ts","sourceRoot":"","sources":["../../../src/aix.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAI/E,MAAM,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;AAgBpD,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAJa,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI;8BACnC,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI;0CAyCvD,CAAA"}
|
|
@@ -104,6 +104,13 @@ export interface AixProps extends HybridViewProps {
|
|
|
104
104
|
*/
|
|
105
105
|
penultimateCellIndex?: number;
|
|
106
106
|
shouldApplyContentInsets?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Optional delay in milliseconds before applying content insets to the scroll view.
|
|
109
|
+
*
|
|
110
|
+
* This can help work around race conditions where insets are applied before
|
|
111
|
+
* React commits layout changes.
|
|
112
|
+
*/
|
|
113
|
+
applyContentInsetDelay?: number;
|
|
107
114
|
onWillApplyContentInsets?: (insets: AixContentInsets) => void;
|
|
108
115
|
/**
|
|
109
116
|
* Called when the scroll position changes between "near end" and "not near end" states.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aix.nitro.d.ts","sourceRoot":"","sources":["../../../../src/views/aix.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,4BAA4B,CAAA;AAEnC,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,8BAA8B;IAC7C,GAAG,CAAC,EAAE,0BAA0B,CAAA;IAChC,MAAM,CAAC,EAAE,0BAA0B,CAAA;CACpC;AAED,MAAM,WAAW,4BAA4B;IAC3C,gBAAgB,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,CAAC,EAAE,4BAA4B,CAAA;IAClC,MAAM,CAAC,EAAE,4BAA4B,CAAA;CACtC;AAED,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAA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C1B,QAAQ,EACR,UAAU,EACV;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CACpC,CAAA;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAClC,gBAAgB,EAChB,EAAE,EACF;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CACpC,CAAA;AAED,MAAM,WAAW,wBAAwB;IACvC,gBAAgB,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,wBAAwB,CAAA;CAClC;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,eAAe,CAAC,EAAE,kBAAkB,CAAA;CACrC;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAClC,gBAAgB,EAChB,EAAE,EACF;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CACpC,CAAA"}
|
|
@@ -140,6 +140,15 @@ namespace margelo::nitro::aix {
|
|
|
140
140
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* shouldApplyContentInsets */)>("setShouldApplyContentInsets");
|
|
141
141
|
method(_javaPart, shouldApplyContentInsets.has_value() ? jni::JBoolean::valueOf(shouldApplyContentInsets.value()) : nullptr);
|
|
142
142
|
}
|
|
143
|
+
std::optional<double> JHybridAixSpec::getApplyContentInsetDelay() {
|
|
144
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getApplyContentInsetDelay");
|
|
145
|
+
auto __result = method(_javaPart);
|
|
146
|
+
return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
|
|
147
|
+
}
|
|
148
|
+
void JHybridAixSpec::setApplyContentInsetDelay(std::optional<double> applyContentInsetDelay) {
|
|
149
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* applyContentInsetDelay */)>("setApplyContentInsetDelay");
|
|
150
|
+
method(_javaPart, applyContentInsetDelay.has_value() ? jni::JDouble::valueOf(applyContentInsetDelay.value()) : nullptr);
|
|
151
|
+
}
|
|
143
152
|
std::optional<std::function<void(const AixContentInsets& /* insets */)>> JHybridAixSpec::getOnWillApplyContentInsets() {
|
|
144
153
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_AixContentInsets::javaobject>()>("getOnWillApplyContentInsets_cxx");
|
|
145
154
|
auto __result = method(_javaPart);
|
|
@@ -66,6 +66,8 @@ namespace margelo::nitro::aix {
|
|
|
66
66
|
void setPenultimateCellIndex(std::optional<double> penultimateCellIndex) override;
|
|
67
67
|
std::optional<bool> getShouldApplyContentInsets() override;
|
|
68
68
|
void setShouldApplyContentInsets(std::optional<bool> shouldApplyContentInsets) override;
|
|
69
|
+
std::optional<double> getApplyContentInsetDelay() override;
|
|
70
|
+
void setApplyContentInsetDelay(std::optional<double> applyContentInsetDelay) override;
|
|
69
71
|
std::optional<std::function<void(const AixContentInsets& /* insets */)>> getOnWillApplyContentInsets() override;
|
|
70
72
|
void setOnWillApplyContentInsets(const std::optional<std::function<void(const AixContentInsets& /* insets */)>>& onWillApplyContentInsets) override;
|
|
71
73
|
std::optional<std::function<void(bool /* isNearEnd */)>> getOnScrolledNearEndChange() override;
|
|
@@ -68,6 +68,10 @@ void JHybridAixStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* clas
|
|
|
68
68
|
view->setShouldApplyContentInsets(props.shouldApplyContentInsets.value);
|
|
69
69
|
// TODO: Set isDirty = false
|
|
70
70
|
}
|
|
71
|
+
if (props.applyContentInsetDelay.isDirty) {
|
|
72
|
+
view->setApplyContentInsetDelay(props.applyContentInsetDelay.value);
|
|
73
|
+
// TODO: Set isDirty = false
|
|
74
|
+
}
|
|
71
75
|
if (props.onWillApplyContentInsets.isDirty) {
|
|
72
76
|
view->setOnWillApplyContentInsets(props.onWillApplyContentInsets.value);
|
|
73
77
|
// TODO: Set isDirty = false
|
|
@@ -90,6 +90,12 @@ abstract class HybridAixSpec: HybridView() {
|
|
|
90
90
|
@set:Keep
|
|
91
91
|
abstract var shouldApplyContentInsets: Boolean?
|
|
92
92
|
|
|
93
|
+
@get:DoNotStrip
|
|
94
|
+
@get:Keep
|
|
95
|
+
@set:DoNotStrip
|
|
96
|
+
@set:Keep
|
|
97
|
+
abstract var applyContentInsetDelay: Double?
|
|
98
|
+
|
|
93
99
|
abstract var onWillApplyContentInsets: ((insets: AixContentInsets) -> Unit)?
|
|
94
100
|
|
|
95
101
|
private var onWillApplyContentInsets_cxx: Func_void_AixContentInsets?
|
|
@@ -130,6 +130,13 @@ namespace margelo::nitro::aix {
|
|
|
130
130
|
inline void setShouldApplyContentInsets(std::optional<bool> shouldApplyContentInsets) noexcept override {
|
|
131
131
|
_swiftPart.setShouldApplyContentInsets(shouldApplyContentInsets);
|
|
132
132
|
}
|
|
133
|
+
inline std::optional<double> getApplyContentInsetDelay() noexcept override {
|
|
134
|
+
auto __result = _swiftPart.getApplyContentInsetDelay();
|
|
135
|
+
return __result;
|
|
136
|
+
}
|
|
137
|
+
inline void setApplyContentInsetDelay(std::optional<double> applyContentInsetDelay) noexcept override {
|
|
138
|
+
_swiftPart.setApplyContentInsetDelay(applyContentInsetDelay);
|
|
139
|
+
}
|
|
133
140
|
inline std::optional<std::function<void(const AixContentInsets& /* insets */)>> getOnWillApplyContentInsets() noexcept override {
|
|
134
141
|
auto __result = _swiftPart.getOnWillApplyContentInsets();
|
|
135
142
|
return __result;
|
|
@@ -111,6 +111,11 @@ using namespace margelo::nitro::aix::views;
|
|
|
111
111
|
swiftPart.setShouldApplyContentInsets(newViewProps.shouldApplyContentInsets.value);
|
|
112
112
|
newViewProps.shouldApplyContentInsets.isDirty = false;
|
|
113
113
|
}
|
|
114
|
+
// applyContentInsetDelay: optional
|
|
115
|
+
if (newViewProps.applyContentInsetDelay.isDirty) {
|
|
116
|
+
swiftPart.setApplyContentInsetDelay(newViewProps.applyContentInsetDelay.value);
|
|
117
|
+
newViewProps.applyContentInsetDelay.isDirty = false;
|
|
118
|
+
}
|
|
114
119
|
// onWillApplyContentInsets: optional
|
|
115
120
|
if (newViewProps.onWillApplyContentInsets.isDirty) {
|
|
116
121
|
swiftPart.setOnWillApplyContentInsets(newViewProps.onWillApplyContentInsets.value);
|
|
@@ -19,6 +19,7 @@ public protocol HybridAixSpec_protocol: HybridObject, HybridView {
|
|
|
19
19
|
var mainScrollViewID: String? { get set }
|
|
20
20
|
var penultimateCellIndex: Double? { get set }
|
|
21
21
|
var shouldApplyContentInsets: Bool? { get set }
|
|
22
|
+
var applyContentInsetDelay: Double? { get set }
|
|
22
23
|
var onWillApplyContentInsets: ((_ insets: AixContentInsets) -> Void)? { get set }
|
|
23
24
|
var onScrolledNearEndChange: ((_ isNearEnd: Bool) -> Void)? { get set }
|
|
24
25
|
|
|
@@ -258,6 +258,23 @@ open class HybridAixSpec_cxx {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
public final var applyContentInsetDelay: bridge.std__optional_double_ {
|
|
262
|
+
@inline(__always)
|
|
263
|
+
get {
|
|
264
|
+
return { () -> bridge.std__optional_double_ in
|
|
265
|
+
if let __unwrappedValue = self.__implementation.applyContentInsetDelay {
|
|
266
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
267
|
+
} else {
|
|
268
|
+
return .init()
|
|
269
|
+
}
|
|
270
|
+
}()
|
|
271
|
+
}
|
|
272
|
+
@inline(__always)
|
|
273
|
+
set {
|
|
274
|
+
self.__implementation.applyContentInsetDelay = newValue.value
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
261
278
|
public final var onWillApplyContentInsets: bridge.std__optional_std__function_void_const_AixContentInsets_____insets______ {
|
|
262
279
|
@inline(__always)
|
|
263
280
|
get {
|
|
@@ -30,6 +30,8 @@ namespace margelo::nitro::aix {
|
|
|
30
30
|
prototype.registerHybridSetter("penultimateCellIndex", &HybridAixSpec::setPenultimateCellIndex);
|
|
31
31
|
prototype.registerHybridGetter("shouldApplyContentInsets", &HybridAixSpec::getShouldApplyContentInsets);
|
|
32
32
|
prototype.registerHybridSetter("shouldApplyContentInsets", &HybridAixSpec::setShouldApplyContentInsets);
|
|
33
|
+
prototype.registerHybridGetter("applyContentInsetDelay", &HybridAixSpec::getApplyContentInsetDelay);
|
|
34
|
+
prototype.registerHybridSetter("applyContentInsetDelay", &HybridAixSpec::setApplyContentInsetDelay);
|
|
33
35
|
prototype.registerHybridGetter("onWillApplyContentInsets", &HybridAixSpec::getOnWillApplyContentInsets);
|
|
34
36
|
prototype.registerHybridSetter("onWillApplyContentInsets", &HybridAixSpec::setOnWillApplyContentInsets);
|
|
35
37
|
prototype.registerHybridGetter("onScrolledNearEndChange", &HybridAixSpec::getOnScrolledNearEndChange);
|
|
@@ -73,6 +73,8 @@ namespace margelo::nitro::aix {
|
|
|
73
73
|
virtual void setPenultimateCellIndex(std::optional<double> penultimateCellIndex) = 0;
|
|
74
74
|
virtual std::optional<bool> getShouldApplyContentInsets() = 0;
|
|
75
75
|
virtual void setShouldApplyContentInsets(std::optional<bool> shouldApplyContentInsets) = 0;
|
|
76
|
+
virtual std::optional<double> getApplyContentInsetDelay() = 0;
|
|
77
|
+
virtual void setApplyContentInsetDelay(std::optional<double> applyContentInsetDelay) = 0;
|
|
76
78
|
virtual std::optional<std::function<void(const AixContentInsets& /* insets */)>> getOnWillApplyContentInsets() = 0;
|
|
77
79
|
virtual void setOnWillApplyContentInsets(const std::optional<std::function<void(const AixContentInsets& /* insets */)>>& onWillApplyContentInsets) = 0;
|
|
78
80
|
virtual std::optional<std::function<void(bool /* isNearEnd */)>> getOnScrolledNearEndChange() = 0;
|
|
@@ -105,6 +105,16 @@ namespace margelo::nitro::aix::views {
|
|
|
105
105
|
throw std::runtime_error(std::string("Aix.shouldApplyContentInsets: ") + exc.what());
|
|
106
106
|
}
|
|
107
107
|
}()),
|
|
108
|
+
applyContentInsetDelay([&]() -> CachedProp<std::optional<double>> {
|
|
109
|
+
try {
|
|
110
|
+
const react::RawValue* rawValue = rawProps.at("applyContentInsetDelay", nullptr, nullptr);
|
|
111
|
+
if (rawValue == nullptr) return sourceProps.applyContentInsetDelay;
|
|
112
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
113
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.applyContentInsetDelay);
|
|
114
|
+
} catch (const std::exception& exc) {
|
|
115
|
+
throw std::runtime_error(std::string("Aix.applyContentInsetDelay: ") + exc.what());
|
|
116
|
+
}
|
|
117
|
+
}()),
|
|
108
118
|
onWillApplyContentInsets([&]() -> CachedProp<std::optional<std::function<void(const AixContentInsets& /* insets */)>>> {
|
|
109
119
|
try {
|
|
110
120
|
const react::RawValue* rawValue = rawProps.at("onWillApplyContentInsets", nullptr, nullptr);
|
|
@@ -146,6 +156,7 @@ namespace margelo::nitro::aix::views {
|
|
|
146
156
|
mainScrollViewID(other.mainScrollViewID),
|
|
147
157
|
penultimateCellIndex(other.penultimateCellIndex),
|
|
148
158
|
shouldApplyContentInsets(other.shouldApplyContentInsets),
|
|
159
|
+
applyContentInsetDelay(other.applyContentInsetDelay),
|
|
149
160
|
onWillApplyContentInsets(other.onWillApplyContentInsets),
|
|
150
161
|
onScrolledNearEndChange(other.onScrolledNearEndChange),
|
|
151
162
|
hybridRef(other.hybridRef) { }
|
|
@@ -160,6 +171,7 @@ namespace margelo::nitro::aix::views {
|
|
|
160
171
|
case hashString("mainScrollViewID"): return true;
|
|
161
172
|
case hashString("penultimateCellIndex"): return true;
|
|
162
173
|
case hashString("shouldApplyContentInsets"): return true;
|
|
174
|
+
case hashString("applyContentInsetDelay"): return true;
|
|
163
175
|
case hashString("onWillApplyContentInsets"): return true;
|
|
164
176
|
case hashString("onScrolledNearEndChange"): return true;
|
|
165
177
|
case hashString("hybridRef"): return true;
|
|
@@ -55,6 +55,7 @@ namespace margelo::nitro::aix::views {
|
|
|
55
55
|
CachedProp<std::optional<std::string>> mainScrollViewID;
|
|
56
56
|
CachedProp<std::optional<double>> penultimateCellIndex;
|
|
57
57
|
CachedProp<std::optional<bool>> shouldApplyContentInsets;
|
|
58
|
+
CachedProp<std::optional<double>> applyContentInsetDelay;
|
|
58
59
|
CachedProp<std::optional<std::function<void(const AixContentInsets& /* insets */)>>> onWillApplyContentInsets;
|
|
59
60
|
CachedProp<std::optional<std::function<void(bool /* isNearEnd */)>>> onScrolledNearEndChange;
|
|
60
61
|
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAixSpec>& /* ref */)>>> hybridRef;
|
package/package.json
CHANGED
package/src/views/aix.nitro.ts
CHANGED
|
@@ -120,6 +120,13 @@ export interface AixProps extends HybridViewProps {
|
|
|
120
120
|
penultimateCellIndex?: number
|
|
121
121
|
|
|
122
122
|
shouldApplyContentInsets?: boolean
|
|
123
|
+
/**
|
|
124
|
+
* Optional delay in milliseconds before applying content insets to the scroll view.
|
|
125
|
+
*
|
|
126
|
+
* This can help work around race conditions where insets are applied before
|
|
127
|
+
* React commits layout changes.
|
|
128
|
+
*/
|
|
129
|
+
applyContentInsetDelay?: number
|
|
123
130
|
onWillApplyContentInsets?: (insets: AixContentInsets) => void
|
|
124
131
|
/**
|
|
125
132
|
* Called when the scroll position changes between "near end" and "not near end" states.
|