@onekeyfe/react-native-native-list 6.7.0-alpha.324 → 6.7.0-alpha.327
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/onekey/nativelist/HybridNativeList.kt +1 -1
- package/docs/SPEC.md +15 -2
- package/ios/HybridNativeList.swift +11 -3
- package/ios/RNCNativeListView.swift +10 -6
- package/ios/tests/NativeListLifecycleTests.swift +28 -0
- package/lib/module/NativeList.js +2 -2
- package/lib/module/ScrollEdgeEffect.js +8 -0
- package/lib/module/index.js +1 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +10 -6
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -2
- package/lib/nitrogen/generated/android/c++/JNativeListScrollEdgeEffect.hpp +61 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +3 -3
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +1 -1
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt +24 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +3 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +8 -4
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +4 -4
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -1
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +3 -3
- package/lib/nitrogen/generated/ios/swift/NativeListScrollEdgeEffect.swift +44 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -2
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +5 -2
- package/lib/nitrogen/generated/shared/c++/NativeListScrollEdgeEffect.hpp +80 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +4 -3
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -1
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -1
- package/lib/typescript/src/NativeList.types.d.ts +3 -2
- package/lib/typescript/src/ScrollEdgeEffect.d.ts +5 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +10 -6
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -2
- package/nitrogen/generated/android/c++/JNativeListScrollEdgeEffect.hpp +61 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt +24 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +8 -4
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +4 -4
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +3 -3
- package/nitrogen/generated/ios/swift/NativeListScrollEdgeEffect.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -2
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +5 -2
- package/nitrogen/generated/shared/c++/NativeListScrollEdgeEffect.hpp +80 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +4 -3
- package/nitrogen/generated/shared/json/NativeListConfig.json +1 -1
- package/package.json +3 -3
- package/react-native-native-list.podspec +4 -1
- package/src/NativeList.nitro.ts +3 -1
- package/src/NativeList.tsx +4 -2
- package/src/NativeList.types.ts +3 -2
- package/src/ScrollEdgeEffect.ts +4 -0
- package/src/index.ts +2 -0
|
@@ -23,7 +23,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
23
23
|
snapshotJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "snapshotJson", rawProps, sourceProps.snapshotJson)),
|
|
24
24
|
fontFamiliesJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "fontFamiliesJson", rawProps, sourceProps.fontFamiliesJson)),
|
|
25
25
|
containerSlotHeightsJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "containerSlotHeightsJson", rawProps, sourceProps.containerSlotHeightsJson)),
|
|
26
|
-
|
|
26
|
+
topScrollEdgeEffect(nitro::ReactProp<NativeListScrollEdgeEffect>::fromRawValue("NativeList", "topScrollEdgeEffect", rawProps, sourceProps.topScrollEdgeEffect)),
|
|
27
27
|
topOverlayHeight(nitro::ReactProp<double>::fromRawValue("NativeList", "topOverlayHeight", rawProps, sourceProps.topOverlayHeight)),
|
|
28
28
|
scrollPositionThresholdsJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "scrollPositionThresholdsJson", rawProps, sourceProps.scrollPositionThresholdsJson)),
|
|
29
29
|
onScrollPositionThresholdChange(nitro::ReactProp<std::optional<std::function<void(bool /* isBeyondThreshold */)>>>::fromRawValue("NativeList", "onScrollPositionThresholdChange", rawProps, sourceProps.onScrollPositionThresholdChange)),
|
|
@@ -42,7 +42,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
42
42
|
case hashString("snapshotJson"): return true;
|
|
43
43
|
case hashString("fontFamiliesJson"): return true;
|
|
44
44
|
case hashString("containerSlotHeightsJson"): return true;
|
|
45
|
-
case hashString("
|
|
45
|
+
case hashString("topScrollEdgeEffect"): return true;
|
|
46
46
|
case hashString("topOverlayHeight"): return true;
|
|
47
47
|
case hashString("scrollPositionThresholdsJson"): return true;
|
|
48
48
|
case hashString("onScrollPositionThresholdChange"): return true;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
#include <string>
|
|
19
19
|
|
|
20
20
|
#include <string>
|
|
21
|
+
#include "NativeListScrollEdgeEffect.hpp"
|
|
21
22
|
#include <functional>
|
|
22
23
|
#include <optional>
|
|
23
24
|
#include "NativeListKeyboardDismissMode.hpp"
|
|
@@ -48,7 +49,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
48
49
|
nitro::ReactProp<std::string> snapshotJson;
|
|
49
50
|
nitro::ReactProp<std::string> fontFamiliesJson;
|
|
50
51
|
nitro::ReactProp<std::string> containerSlotHeightsJson;
|
|
51
|
-
nitro::ReactProp<
|
|
52
|
+
nitro::ReactProp<NativeListScrollEdgeEffect> topScrollEdgeEffect;
|
|
52
53
|
nitro::ReactProp<double> topOverlayHeight;
|
|
53
54
|
nitro::ReactProp<std::string> scrollPositionThresholdsJson;
|
|
54
55
|
nitro::ReactProp<std::optional<std::function<void(bool /* isBeyondThreshold */)>>> onScrollPositionThresholdChange;
|
|
@@ -67,7 +68,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
67
68
|
return snapshotJson.hasSameValue(other.snapshotJson) &&
|
|
68
69
|
fontFamiliesJson.hasSameValue(other.fontFamiliesJson) &&
|
|
69
70
|
containerSlotHeightsJson.hasSameValue(other.containerSlotHeightsJson) &&
|
|
70
|
-
|
|
71
|
+
topScrollEdgeEffect.hasSameValue(other.topScrollEdgeEffect) &&
|
|
71
72
|
topOverlayHeight.hasSameValue(other.topOverlayHeight) &&
|
|
72
73
|
scrollPositionThresholdsJson.hasSameValue(other.scrollPositionThresholdsJson) &&
|
|
73
74
|
onScrollPositionThresholdChange.hasSameValue(other.onScrollPositionThresholdChange) &&
|
|
@@ -87,7 +88,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
87
88
|
return snapshotJson.isProvided() ||
|
|
88
89
|
fontFamiliesJson.isProvided() ||
|
|
89
90
|
containerSlotHeightsJson.isProvided() ||
|
|
90
|
-
|
|
91
|
+
topScrollEdgeEffect.isProvided() ||
|
|
91
92
|
topOverlayHeight.isProvided() ||
|
|
92
93
|
scrollPositionThresholdsJson.isProvided() ||
|
|
93
94
|
onScrollPositionThresholdChange.isProvided() ||
|
|
@@ -8,7 +8,7 @@ export interface NativeListNativeProps extends HybridViewProps {
|
|
|
8
8
|
snapshotJson: string;
|
|
9
9
|
fontFamiliesJson: string;
|
|
10
10
|
containerSlotHeightsJson: string;
|
|
11
|
-
|
|
11
|
+
topScrollEdgeEffect: NativeListScrollEdgeEffect;
|
|
12
12
|
topOverlayHeight: number;
|
|
13
13
|
scrollPositionThresholdsJson: string;
|
|
14
14
|
onScrollPositionThresholdChange?: (isBeyondThreshold: boolean) => void;
|
|
@@ -36,4 +36,5 @@ export interface NativeListMethods extends HybridViewMethods {
|
|
|
36
36
|
setRefreshing(refreshing: boolean): void;
|
|
37
37
|
}
|
|
38
38
|
export type NativeList = HybridView<NativeListNativeProps, NativeListMethods>;
|
|
39
|
+
export type NativeListScrollEdgeEffect = 'none' | 'hard' | 'soft';
|
|
39
40
|
//# sourceMappingURL=NativeList.nitro.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ScrollEdgeEffect } from './ScrollEdgeEffect';
|
|
1
2
|
import type { ReactNode, RefObject } from 'react';
|
|
2
3
|
import type { View, ViewProps } from 'react-native';
|
|
3
4
|
import type { ActionAnchorInvalidatedEvent, EndReachedEvent, NativeListSnapshot, ReorderEvent, RowActionEvent, RowModel, RowPatch, SelectionDeltaEvent, VisibleRangeChangedEvent } from './models';
|
|
@@ -81,8 +82,8 @@ export type NativeListProps = Omit<ViewProps, 'children'> & Readonly<{
|
|
|
81
82
|
listEmpty?: ReactNode;
|
|
82
83
|
/** Fixed overlay above scrolling rows on iOS 26 and newer. */
|
|
83
84
|
topOverlay?: ReactNode;
|
|
84
|
-
/**
|
|
85
|
-
topScrollEdgeEffect?:
|
|
85
|
+
/** Selects UIKit's top scroll-edge effect on iOS 26 and newer. */
|
|
86
|
+
topScrollEdgeEffect?: `${ScrollEdgeEffect}`;
|
|
86
87
|
/** Web only. Defaults to true and is ignored by the native host. */
|
|
87
88
|
webVirtualizationEnabled?: boolean;
|
|
88
89
|
/** Web only. Hosts the section index inside this container. */
|
|
@@ -6,4 +6,5 @@ export { checkboxStateForKeys, checkboxStateForSection, isSelectableRow, reduceS
|
|
|
6
6
|
export type { SelectionAction, SelectionResult, SelectionState, } from './selection';
|
|
7
7
|
export { configureNativeListFonts } from './fonts';
|
|
8
8
|
export type { NativeListFontFamilies } from './fonts';
|
|
9
|
+
export { ScrollEdgeEffect } from './ScrollEdgeEffect';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
#include "JHybridNativeListSpec.hpp"
|
|
9
9
|
|
|
10
|
+
// Forward declaration of `NativeListScrollEdgeEffect` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::nativelist { enum class NativeListScrollEdgeEffect; }
|
|
10
12
|
// Forward declaration of `NativeListKeyboardDismissMode` to properly resolve imports.
|
|
11
13
|
namespace margelo::nitro::nativelist { enum class NativeListKeyboardDismissMode; }
|
|
12
14
|
// Forward declaration of `NativeListKeyboardShouldPersistTaps` to properly resolve imports.
|
|
@@ -15,6 +17,8 @@ namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersis
|
|
|
15
17
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
16
18
|
|
|
17
19
|
#include <string>
|
|
20
|
+
#include "NativeListScrollEdgeEffect.hpp"
|
|
21
|
+
#include "JNativeListScrollEdgeEffect.hpp"
|
|
18
22
|
#include <functional>
|
|
19
23
|
#include <optional>
|
|
20
24
|
#include "JFunc_void_bool.hpp"
|
|
@@ -84,14 +88,14 @@ namespace margelo::nitro::nativelist {
|
|
|
84
88
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* containerSlotHeightsJson */)>("setContainerSlotHeightsJson");
|
|
85
89
|
method(_javaPart, jni::make_jstring(containerSlotHeightsJson));
|
|
86
90
|
}
|
|
87
|
-
|
|
88
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<
|
|
91
|
+
NativeListScrollEdgeEffect JHybridNativeListSpec::getTopScrollEdgeEffect() {
|
|
92
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNativeListScrollEdgeEffect>()>("getTopScrollEdgeEffect");
|
|
89
93
|
auto __result = method(_javaPart);
|
|
90
|
-
return
|
|
94
|
+
return __result->toCpp();
|
|
91
95
|
}
|
|
92
|
-
void JHybridNativeListSpec::
|
|
93
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<void(
|
|
94
|
-
method(_javaPart,
|
|
96
|
+
void JHybridNativeListSpec::setTopScrollEdgeEffect(NativeListScrollEdgeEffect topScrollEdgeEffect) {
|
|
97
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JNativeListScrollEdgeEffect> /* topScrollEdgeEffect */)>("setTopScrollEdgeEffect");
|
|
98
|
+
method(_javaPart, JNativeListScrollEdgeEffect::fromCpp(topScrollEdgeEffect));
|
|
95
99
|
}
|
|
96
100
|
double JHybridNativeListSpec::getTopOverlayHeight() {
|
|
97
101
|
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getTopOverlayHeight");
|
|
@@ -56,8 +56,8 @@ namespace margelo::nitro::nativelist {
|
|
|
56
56
|
void setFontFamiliesJson(const std::string& fontFamiliesJson) override;
|
|
57
57
|
std::string getContainerSlotHeightsJson() override;
|
|
58
58
|
void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) override;
|
|
59
|
-
|
|
60
|
-
void
|
|
59
|
+
NativeListScrollEdgeEffect getTopScrollEdgeEffect() override;
|
|
60
|
+
void setTopScrollEdgeEffect(NativeListScrollEdgeEffect topScrollEdgeEffect) override;
|
|
61
61
|
double getTopOverlayHeight() override;
|
|
62
62
|
void setTopOverlayHeight(double topOverlayHeight) override;
|
|
63
63
|
std::string getScrollPositionThresholdsJson() override;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNativeListScrollEdgeEffect.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NativeListScrollEdgeEffect.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nativelist {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "NativeListScrollEdgeEffect" and the Kotlin enum "NativeListScrollEdgeEffect".
|
|
19
|
+
*/
|
|
20
|
+
struct JNativeListScrollEdgeEffect final: public jni::JavaClass<JNativeListScrollEdgeEffect> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nativelist/NativeListScrollEdgeEffect;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum NativeListScrollEdgeEffect.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
NativeListScrollEdgeEffect toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<NativeListScrollEdgeEffect>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JNativeListScrollEdgeEffect> fromCpp(NativeListScrollEdgeEffect value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case NativeListScrollEdgeEffect::NONE:
|
|
46
|
+
static const auto fieldNONE = clazz->getStaticField<JNativeListScrollEdgeEffect>("NONE");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldNONE);
|
|
48
|
+
case NativeListScrollEdgeEffect::HARD:
|
|
49
|
+
static const auto fieldHARD = clazz->getStaticField<JNativeListScrollEdgeEffect>("HARD");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldHARD);
|
|
51
|
+
case NativeListScrollEdgeEffect::SOFT:
|
|
52
|
+
static const auto fieldSOFT = clazz->getStaticField<JNativeListScrollEdgeEffect>("SOFT");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldSOFT);
|
|
54
|
+
default:
|
|
55
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
56
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::nativelist
|
|
@@ -69,9 +69,9 @@ void JHybridNativeListStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
69
69
|
hybridView->setContainerSlotHeightsJson(newProps->containerSlotHeightsJson.get());
|
|
70
70
|
}
|
|
71
71
|
if (oldProps == nullptr
|
|
72
|
-
? newProps->
|
|
73
|
-
: !newProps->
|
|
74
|
-
hybridView->
|
|
72
|
+
? newProps->topScrollEdgeEffect.isProvided()
|
|
73
|
+
: !newProps->topScrollEdgeEffect.hasSameValue(oldProps->topScrollEdgeEffect)) {
|
|
74
|
+
hybridView->setTopScrollEdgeEffect(newProps->topScrollEdgeEffect.get());
|
|
75
75
|
}
|
|
76
76
|
if (oldProps == nullptr
|
|
77
77
|
? newProps->topOverlayHeight.isProvided()
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListScrollEdgeEffect.kt
|
|
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
|
+
package com.margelo.nitro.nativelist
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "NativeListScrollEdgeEffect".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class NativeListScrollEdgeEffect(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
NONE(0),
|
|
20
|
+
HARD(1),
|
|
21
|
+
SOFT(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
|
@@ -16,12 +16,15 @@ namespace margelo::nitro::nativelist { enum class NativeListKeyboardDismissMode;
|
|
|
16
16
|
namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersistTaps; }
|
|
17
17
|
// Forward declaration of `NativeListScrollAlignment` to properly resolve imports.
|
|
18
18
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
19
|
+
// Forward declaration of `NativeListScrollEdgeEffect` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nativelist { enum class NativeListScrollEdgeEffect; }
|
|
19
21
|
|
|
20
22
|
// Include C++ defined types
|
|
21
23
|
#include "HybridNativeListSpec.hpp"
|
|
22
24
|
#include "NativeListKeyboardDismissMode.hpp"
|
|
23
25
|
#include "NativeListKeyboardShouldPersistTaps.hpp"
|
|
24
26
|
#include "NativeListScrollAlignment.hpp"
|
|
27
|
+
#include "NativeListScrollEdgeEffect.hpp"
|
|
25
28
|
#include <NitroModules/Result.hpp>
|
|
26
29
|
#include <exception>
|
|
27
30
|
#include <functional>
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
// Forward declaration of `HybridNativeListSpec_cxx` to properly resolve imports.
|
|
13
13
|
namespace NativeListModule { class HybridNativeListSpec_cxx; }
|
|
14
14
|
|
|
15
|
+
// Forward declaration of `NativeListScrollEdgeEffect` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nativelist { enum class NativeListScrollEdgeEffect; }
|
|
15
17
|
// Forward declaration of `NativeListKeyboardDismissMode` to properly resolve imports.
|
|
16
18
|
namespace margelo::nitro::nativelist { enum class NativeListKeyboardDismissMode; }
|
|
17
19
|
// Forward declaration of `NativeListKeyboardShouldPersistTaps` to properly resolve imports.
|
|
@@ -20,6 +22,7 @@ namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersis
|
|
|
20
22
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
21
23
|
|
|
22
24
|
#include <string>
|
|
25
|
+
#include "NativeListScrollEdgeEffect.hpp"
|
|
23
26
|
#include <functional>
|
|
24
27
|
#include <optional>
|
|
25
28
|
#include "NativeListKeyboardDismissMode.hpp"
|
|
@@ -93,11 +96,12 @@ namespace margelo::nitro::nativelist {
|
|
|
93
96
|
inline void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) noexcept override {
|
|
94
97
|
_swiftPart.setContainerSlotHeightsJson(containerSlotHeightsJson);
|
|
95
98
|
}
|
|
96
|
-
inline
|
|
97
|
-
|
|
99
|
+
inline NativeListScrollEdgeEffect getTopScrollEdgeEffect() noexcept override {
|
|
100
|
+
auto __result = _swiftPart.getTopScrollEdgeEffect();
|
|
101
|
+
return static_cast<NativeListScrollEdgeEffect>(__result);
|
|
98
102
|
}
|
|
99
|
-
inline void
|
|
100
|
-
_swiftPart.
|
|
103
|
+
inline void setTopScrollEdgeEffect(NativeListScrollEdgeEffect topScrollEdgeEffect) noexcept override {
|
|
104
|
+
_swiftPart.setTopScrollEdgeEffect(static_cast<int>(topScrollEdgeEffect));
|
|
101
105
|
}
|
|
102
106
|
inline double getTopOverlayHeight() noexcept override {
|
|
103
107
|
return _swiftPart.getTopOverlayHeight();
|
|
@@ -130,11 +130,11 @@ using namespace margelo::nitro::nativelist::views;
|
|
|
130
130
|
: !newViewProps.containerSlotHeightsJson.hasSameValue(oldViewProps->containerSlotHeightsJson)) {
|
|
131
131
|
swiftPart.setContainerSlotHeightsJson(newViewProps.containerSlotHeightsJson.get());
|
|
132
132
|
}
|
|
133
|
-
//
|
|
133
|
+
// topScrollEdgeEffect: enum
|
|
134
134
|
if (oldViewProps == nullptr
|
|
135
|
-
? newViewProps.
|
|
136
|
-
: !newViewProps.
|
|
137
|
-
swiftPart.
|
|
135
|
+
? newViewProps.topScrollEdgeEffect.isProvided()
|
|
136
|
+
: !newViewProps.topScrollEdgeEffect.hasSameValue(oldViewProps->topScrollEdgeEffect)) {
|
|
137
|
+
swiftPart.setTopScrollEdgeEffect(static_cast<int>(newViewProps.topScrollEdgeEffect.get()));
|
|
138
138
|
}
|
|
139
139
|
// topOverlayHeight: number
|
|
140
140
|
if (oldViewProps == nullptr
|
|
@@ -13,7 +13,7 @@ public protocol HybridNativeListSpec_protocol: HybridObject, HybridView {
|
|
|
13
13
|
var snapshotJson: String { get set }
|
|
14
14
|
var fontFamiliesJson: String { get set }
|
|
15
15
|
var containerSlotHeightsJson: String { get set }
|
|
16
|
-
var
|
|
16
|
+
var topScrollEdgeEffect: NativeListScrollEdgeEffect { get set }
|
|
17
17
|
var topOverlayHeight: Double { get set }
|
|
18
18
|
var scrollPositionThresholdsJson: String { get set }
|
|
19
19
|
var onScrollPositionThresholdChange: ((_ isBeyondThreshold: Bool) -> Void)? { get set }
|
|
@@ -154,14 +154,14 @@ open class HybridNativeListSpec_cxx {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
public final var
|
|
157
|
+
public final var topScrollEdgeEffect: Int32 {
|
|
158
158
|
@inline(__always)
|
|
159
159
|
get {
|
|
160
|
-
return self.__implementation.
|
|
160
|
+
return self.__implementation.topScrollEdgeEffect.rawValue
|
|
161
161
|
}
|
|
162
162
|
@inline(__always)
|
|
163
163
|
set {
|
|
164
|
-
self.__implementation.
|
|
164
|
+
self.__implementation.topScrollEdgeEffect = margelo.nitro.nativelist.NativeListScrollEdgeEffect(rawValue: newValue)!
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListScrollEdgeEffect.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `NativeListScrollEdgeEffect`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias NativeListScrollEdgeEffect = margelo.nitro.nativelist.NativeListScrollEdgeEffect
|
|
12
|
+
|
|
13
|
+
public extension NativeListScrollEdgeEffect {
|
|
14
|
+
/**
|
|
15
|
+
* Get a NativeListScrollEdgeEffect for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "none":
|
|
21
|
+
self = .none
|
|
22
|
+
case "hard":
|
|
23
|
+
self = .hard
|
|
24
|
+
case "soft":
|
|
25
|
+
self = .soft
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this NativeListScrollEdgeEffect represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .none:
|
|
37
|
+
return "none"
|
|
38
|
+
case .hard:
|
|
39
|
+
return "hard"
|
|
40
|
+
case .soft:
|
|
41
|
+
return "soft"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -20,8 +20,8 @@ namespace margelo::nitro::nativelist {
|
|
|
20
20
|
prototype.registerHybridSetter("fontFamiliesJson", &HybridNativeListSpec::setFontFamiliesJson);
|
|
21
21
|
prototype.registerHybridGetter("containerSlotHeightsJson", &HybridNativeListSpec::getContainerSlotHeightsJson);
|
|
22
22
|
prototype.registerHybridSetter("containerSlotHeightsJson", &HybridNativeListSpec::setContainerSlotHeightsJson);
|
|
23
|
-
prototype.registerHybridGetter("
|
|
24
|
-
prototype.registerHybridSetter("
|
|
23
|
+
prototype.registerHybridGetter("topScrollEdgeEffect", &HybridNativeListSpec::getTopScrollEdgeEffect);
|
|
24
|
+
prototype.registerHybridSetter("topScrollEdgeEffect", &HybridNativeListSpec::setTopScrollEdgeEffect);
|
|
25
25
|
prototype.registerHybridGetter("topOverlayHeight", &HybridNativeListSpec::getTopOverlayHeight);
|
|
26
26
|
prototype.registerHybridSetter("topOverlayHeight", &HybridNativeListSpec::setTopOverlayHeight);
|
|
27
27
|
prototype.registerHybridGetter("scrollPositionThresholdsJson", &HybridNativeListSpec::getScrollPositionThresholdsJson);
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
14
|
#endif
|
|
15
15
|
|
|
16
|
+
// Forward declaration of `NativeListScrollEdgeEffect` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nativelist { enum class NativeListScrollEdgeEffect; }
|
|
16
18
|
// Forward declaration of `NativeListKeyboardDismissMode` to properly resolve imports.
|
|
17
19
|
namespace margelo::nitro::nativelist { enum class NativeListKeyboardDismissMode; }
|
|
18
20
|
// Forward declaration of `NativeListKeyboardShouldPersistTaps` to properly resolve imports.
|
|
@@ -21,6 +23,7 @@ namespace margelo::nitro::nativelist { enum class NativeListKeyboardShouldPersis
|
|
|
21
23
|
namespace margelo::nitro::nativelist { enum class NativeListScrollAlignment; }
|
|
22
24
|
|
|
23
25
|
#include <string>
|
|
26
|
+
#include "NativeListScrollEdgeEffect.hpp"
|
|
24
27
|
#include <functional>
|
|
25
28
|
#include <optional>
|
|
26
29
|
#include "NativeListKeyboardDismissMode.hpp"
|
|
@@ -60,8 +63,8 @@ namespace margelo::nitro::nativelist {
|
|
|
60
63
|
virtual void setFontFamiliesJson(const std::string& fontFamiliesJson) = 0;
|
|
61
64
|
virtual std::string getContainerSlotHeightsJson() = 0;
|
|
62
65
|
virtual void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) = 0;
|
|
63
|
-
virtual
|
|
64
|
-
virtual void
|
|
66
|
+
virtual NativeListScrollEdgeEffect getTopScrollEdgeEffect() = 0;
|
|
67
|
+
virtual void setTopScrollEdgeEffect(NativeListScrollEdgeEffect topScrollEdgeEffect) = 0;
|
|
65
68
|
virtual double getTopOverlayHeight() = 0;
|
|
66
69
|
virtual void setTopOverlayHeight(double topOverlayHeight) = 0;
|
|
67
70
|
virtual std::string getScrollPositionThresholdsJson() = 0;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeListScrollEdgeEffect.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::nativelist {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (NativeListScrollEdgeEffect).
|
|
30
|
+
*/
|
|
31
|
+
enum class NativeListScrollEdgeEffect {
|
|
32
|
+
NONE SWIFT_NAME(none) = 0,
|
|
33
|
+
HARD SWIFT_NAME(hard) = 1,
|
|
34
|
+
SOFT SWIFT_NAME(soft) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::nativelist
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ NativeListScrollEdgeEffect <> JS NativeListScrollEdgeEffect (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::nativelist::NativeListScrollEdgeEffect> final {
|
|
44
|
+
static inline margelo::nitro::nativelist::NativeListScrollEdgeEffect fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("none"): return margelo::nitro::nativelist::NativeListScrollEdgeEffect::NONE;
|
|
48
|
+
case hashString("hard"): return margelo::nitro::nativelist::NativeListScrollEdgeEffect::HARD;
|
|
49
|
+
case hashString("soft"): return margelo::nitro::nativelist::NativeListScrollEdgeEffect::SOFT;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NativeListScrollEdgeEffect - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nativelist::NativeListScrollEdgeEffect arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::nativelist::NativeListScrollEdgeEffect::NONE: return JSIConverter<std::string>::toJSI(runtime, "none");
|
|
57
|
+
case margelo::nitro::nativelist::NativeListScrollEdgeEffect::HARD: return JSIConverter<std::string>::toJSI(runtime, "hard");
|
|
58
|
+
case margelo::nitro::nativelist::NativeListScrollEdgeEffect::SOFT: return JSIConverter<std::string>::toJSI(runtime, "soft");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert NativeListScrollEdgeEffect to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("none"):
|
|
71
|
+
case hashString("hard"):
|
|
72
|
+
case hashString("soft"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -23,7 +23,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
23
23
|
snapshotJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "snapshotJson", rawProps, sourceProps.snapshotJson)),
|
|
24
24
|
fontFamiliesJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "fontFamiliesJson", rawProps, sourceProps.fontFamiliesJson)),
|
|
25
25
|
containerSlotHeightsJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "containerSlotHeightsJson", rawProps, sourceProps.containerSlotHeightsJson)),
|
|
26
|
-
|
|
26
|
+
topScrollEdgeEffect(nitro::ReactProp<NativeListScrollEdgeEffect>::fromRawValue("NativeList", "topScrollEdgeEffect", rawProps, sourceProps.topScrollEdgeEffect)),
|
|
27
27
|
topOverlayHeight(nitro::ReactProp<double>::fromRawValue("NativeList", "topOverlayHeight", rawProps, sourceProps.topOverlayHeight)),
|
|
28
28
|
scrollPositionThresholdsJson(nitro::ReactProp<std::string>::fromRawValue("NativeList", "scrollPositionThresholdsJson", rawProps, sourceProps.scrollPositionThresholdsJson)),
|
|
29
29
|
onScrollPositionThresholdChange(nitro::ReactProp<std::optional<std::function<void(bool /* isBeyondThreshold */)>>>::fromRawValue("NativeList", "onScrollPositionThresholdChange", rawProps, sourceProps.onScrollPositionThresholdChange)),
|
|
@@ -42,7 +42,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
42
42
|
case hashString("snapshotJson"): return true;
|
|
43
43
|
case hashString("fontFamiliesJson"): return true;
|
|
44
44
|
case hashString("containerSlotHeightsJson"): return true;
|
|
45
|
-
case hashString("
|
|
45
|
+
case hashString("topScrollEdgeEffect"): return true;
|
|
46
46
|
case hashString("topOverlayHeight"): return true;
|
|
47
47
|
case hashString("scrollPositionThresholdsJson"): return true;
|
|
48
48
|
case hashString("onScrollPositionThresholdChange"): return true;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
#include <string>
|
|
19
19
|
|
|
20
20
|
#include <string>
|
|
21
|
+
#include "NativeListScrollEdgeEffect.hpp"
|
|
21
22
|
#include <functional>
|
|
22
23
|
#include <optional>
|
|
23
24
|
#include "NativeListKeyboardDismissMode.hpp"
|
|
@@ -48,7 +49,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
48
49
|
nitro::ReactProp<std::string> snapshotJson;
|
|
49
50
|
nitro::ReactProp<std::string> fontFamiliesJson;
|
|
50
51
|
nitro::ReactProp<std::string> containerSlotHeightsJson;
|
|
51
|
-
nitro::ReactProp<
|
|
52
|
+
nitro::ReactProp<NativeListScrollEdgeEffect> topScrollEdgeEffect;
|
|
52
53
|
nitro::ReactProp<double> topOverlayHeight;
|
|
53
54
|
nitro::ReactProp<std::string> scrollPositionThresholdsJson;
|
|
54
55
|
nitro::ReactProp<std::optional<std::function<void(bool /* isBeyondThreshold */)>>> onScrollPositionThresholdChange;
|
|
@@ -67,7 +68,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
67
68
|
return snapshotJson.hasSameValue(other.snapshotJson) &&
|
|
68
69
|
fontFamiliesJson.hasSameValue(other.fontFamiliesJson) &&
|
|
69
70
|
containerSlotHeightsJson.hasSameValue(other.containerSlotHeightsJson) &&
|
|
70
|
-
|
|
71
|
+
topScrollEdgeEffect.hasSameValue(other.topScrollEdgeEffect) &&
|
|
71
72
|
topOverlayHeight.hasSameValue(other.topOverlayHeight) &&
|
|
72
73
|
scrollPositionThresholdsJson.hasSameValue(other.scrollPositionThresholdsJson) &&
|
|
73
74
|
onScrollPositionThresholdChange.hasSameValue(other.onScrollPositionThresholdChange) &&
|
|
@@ -87,7 +88,7 @@ namespace margelo::nitro::nativelist::views {
|
|
|
87
88
|
return snapshotJson.isProvided() ||
|
|
88
89
|
fontFamiliesJson.isProvided() ||
|
|
89
90
|
containerSlotHeightsJson.isProvided() ||
|
|
90
|
-
|
|
91
|
+
topScrollEdgeEffect.isProvided() ||
|
|
91
92
|
topOverlayHeight.isProvided() ||
|
|
92
93
|
scrollPositionThresholdsJson.isProvided() ||
|
|
93
94
|
onScrollPositionThresholdChange.isProvided() ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-list",
|
|
3
|
-
"version": "6.7.0-alpha.
|
|
3
|
+
"version": "6.7.0-alpha.327",
|
|
4
4
|
"description": "Template-driven native RecyclerView and UICollectionView for React Native",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"typescript": "^5.9.2"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@onekeyfe/react-native-image": "6.7.0-alpha.
|
|
90
|
-
"@onekeyfe/react-native-native-logger": "6.7.0-alpha.
|
|
89
|
+
"@onekeyfe/react-native-image": "6.7.0-alpha.327",
|
|
90
|
+
"@onekeyfe/react-native-native-logger": "6.7.0-alpha.327",
|
|
91
91
|
"react": "*",
|
|
92
92
|
"react-native": "*",
|
|
93
93
|
"react-native-nitro-modules": "0.37.0"
|
|
@@ -34,7 +34,10 @@ Pod::Spec.new do |s|
|
|
|
34
34
|
|
|
35
35
|
s.test_spec "Tests" do |test_spec|
|
|
36
36
|
test_spec.source_files = "ios/tests/**/*.swift"
|
|
37
|
-
test_spec.pod_target_xcconfig = {
|
|
37
|
+
test_spec.pod_target_xcconfig = {
|
|
38
|
+
"PRODUCT_MODULE_NAME" => "NativeListModuleTests",
|
|
39
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx"
|
|
40
|
+
}
|
|
38
41
|
end
|
|
39
42
|
|
|
40
43
|
load "nitrogen/generated/ios/NativeListModule+autolinking.rb"
|