@onekeyfe/react-native-native-list 6.7.0-1 → 6.7.0-12

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 (84) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +1 -1
  2. package/docs/SPEC.md +449 -14
  3. package/ios/HybridNativeList.swift +11 -3
  4. package/ios/RNCNativeListView.swift +10 -6
  5. package/ios/tests/NativeListLifecycleTests.swift +28 -0
  6. package/lib/module/NativeList.js +42 -21
  7. package/lib/module/NativeList.web.js +163 -32
  8. package/lib/module/ScrollEdgeEffect.js +8 -0
  9. package/lib/module/index.js +1 -0
  10. package/lib/module/validation.js +358 -47
  11. package/lib/module/web/NativeListWebEngine.js +373 -67
  12. package/lib/module/web/templates/ActivityRowRenderer.js +484 -5
  13. package/lib/module/web/templates/MarketRowRenderer.js +8 -3
  14. package/lib/module/web/templates/MarketTableRowRenderer.js +577 -0
  15. package/lib/module/web/templates/MediaTileRowRenderer.js +260 -5
  16. package/lib/module/web/templates/RowRendererRegistry.js +5 -3
  17. package/lib/module/web/templates/SectionHeaderRowRenderer.js +34 -1
  18. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +10 -6
  19. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -2
  20. package/lib/nitrogen/generated/android/c++/JNativeListScrollEdgeEffect.hpp +61 -0
  21. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +3 -3
  22. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +1 -1
  23. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt +24 -0
  24. package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +3 -0
  25. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +8 -4
  26. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +4 -4
  27. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -1
  28. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +3 -3
  29. package/lib/nitrogen/generated/ios/swift/NativeListScrollEdgeEffect.swift +44 -0
  30. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -2
  31. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +5 -2
  32. package/lib/nitrogen/generated/shared/c++/NativeListScrollEdgeEffect.hpp +80 -0
  33. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -2
  34. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +4 -3
  35. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -1
  36. package/lib/typescript/src/NativeList.d.ts +2 -2
  37. package/lib/typescript/src/NativeList.nitro.d.ts +2 -1
  38. package/lib/typescript/src/NativeList.types.d.ts +14 -3
  39. package/lib/typescript/src/NativeList.web.d.ts +2 -2
  40. package/lib/typescript/src/ScrollEdgeEffect.d.ts +5 -0
  41. package/lib/typescript/src/index.d.ts +1 -0
  42. package/lib/typescript/src/models.d.ts +71 -1
  43. package/lib/typescript/src/validation.d.ts +3 -0
  44. package/lib/typescript/src/web/NativeListWebEngine.d.ts +26 -1
  45. package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
  46. package/lib/typescript/src/web/templates/MarketTableRowRenderer.d.ts +17 -0
  47. package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +3 -3
  48. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +1 -1
  49. package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
  50. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +10 -6
  51. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -2
  52. package/nitrogen/generated/android/c++/JNativeListScrollEdgeEffect.hpp +61 -0
  53. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +3 -3
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +1 -1
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt +24 -0
  56. package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +3 -0
  57. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +8 -4
  58. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +4 -4
  59. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -1
  60. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +3 -3
  61. package/nitrogen/generated/ios/swift/NativeListScrollEdgeEffect.swift +44 -0
  62. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -2
  63. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +5 -2
  64. package/nitrogen/generated/shared/c++/NativeListScrollEdgeEffect.hpp +80 -0
  65. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -2
  66. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +4 -3
  67. package/nitrogen/generated/shared/json/NativeListConfig.json +1 -1
  68. package/package.json +3 -3
  69. package/react-native-native-list.podspec +4 -1
  70. package/src/NativeList.nitro.ts +3 -1
  71. package/src/NativeList.tsx +102 -60
  72. package/src/NativeList.types.ts +15 -3
  73. package/src/NativeList.web.tsx +264 -65
  74. package/src/ScrollEdgeEffect.ts +4 -0
  75. package/src/index.ts +2 -0
  76. package/src/models.ts +93 -0
  77. package/src/validation.ts +785 -72
  78. package/src/web/NativeListWebEngine.ts +625 -100
  79. package/src/web/templates/ActivityRowRenderer.ts +723 -7
  80. package/src/web/templates/MarketRowRenderer.ts +19 -3
  81. package/src/web/templates/MarketTableRowRenderer.ts +755 -0
  82. package/src/web/templates/MediaTileRowRenderer.ts +313 -5
  83. package/src/web/templates/RowRendererRegistry.ts +10 -5
  84. package/src/web/templates/SectionHeaderRowRenderer.ts +42 -1
@@ -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
- bool JHybridNativeListSpec::getTopScrollEdgeHard() {
88
- static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getTopScrollEdgeHard");
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 static_cast<bool>(__result);
94
+ return __result->toCpp();
91
95
  }
92
- void JHybridNativeListSpec::setTopScrollEdgeHard(bool topScrollEdgeHard) {
93
- static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* topScrollEdgeHard */)>("setTopScrollEdgeHard");
94
- method(_javaPart, topScrollEdgeHard);
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
- bool getTopScrollEdgeHard() override;
60
- void setTopScrollEdgeHard(bool topScrollEdgeHard) override;
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->topScrollEdgeHard.isProvided()
73
- : !newProps->topScrollEdgeHard.hasSameValue(oldProps->topScrollEdgeHard)) {
74
- hybridView->setTopScrollEdgeHard(newProps->topScrollEdgeHard.get());
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()
@@ -49,7 +49,7 @@ abstract class HybridNativeListSpec: HybridView() {
49
49
  @get:Keep
50
50
  @set:DoNotStrip
51
51
  @set:Keep
52
- abstract var topScrollEdgeHard: Boolean
52
+ abstract var topScrollEdgeEffect: NativeListScrollEdgeEffect
53
53
 
54
54
  @get:DoNotStrip
55
55
  @get:Keep
@@ -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 bool getTopScrollEdgeHard() noexcept override {
97
- return _swiftPart.getTopScrollEdgeHard();
99
+ inline NativeListScrollEdgeEffect getTopScrollEdgeEffect() noexcept override {
100
+ auto __result = _swiftPart.getTopScrollEdgeEffect();
101
+ return static_cast<NativeListScrollEdgeEffect>(__result);
98
102
  }
99
- inline void setTopScrollEdgeHard(bool topScrollEdgeHard) noexcept override {
100
- _swiftPart.setTopScrollEdgeHard(std::forward<decltype(topScrollEdgeHard)>(topScrollEdgeHard));
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
- // topScrollEdgeHard: boolean
133
+ // topScrollEdgeEffect: enum
134
134
  if (oldViewProps == nullptr
135
- ? newViewProps.topScrollEdgeHard.isProvided()
136
- : !newViewProps.topScrollEdgeHard.hasSameValue(oldViewProps->topScrollEdgeHard)) {
137
- swiftPart.setTopScrollEdgeHard(newViewProps.topScrollEdgeHard.get());
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 topScrollEdgeHard: Bool { get set }
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 topScrollEdgeHard: Bool {
157
+ public final var topScrollEdgeEffect: Int32 {
158
158
  @inline(__always)
159
159
  get {
160
- return self.__implementation.topScrollEdgeHard
160
+ return self.__implementation.topScrollEdgeEffect.rawValue
161
161
  }
162
162
  @inline(__always)
163
163
  set {
164
- self.__implementation.topScrollEdgeHard = newValue
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("topScrollEdgeHard", &HybridNativeListSpec::getTopScrollEdgeHard);
24
- prototype.registerHybridSetter("topScrollEdgeHard", &HybridNativeListSpec::setTopScrollEdgeHard);
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 bool getTopScrollEdgeHard() = 0;
64
- virtual void setTopScrollEdgeHard(bool topScrollEdgeHard) = 0;
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
- topScrollEdgeHard(nitro::ReactProp<bool>::fromRawValue("NativeList", "topScrollEdgeHard", rawProps, sourceProps.topScrollEdgeHard)),
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("topScrollEdgeHard"): return true;
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<bool> topScrollEdgeHard;
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
- topScrollEdgeHard.hasSameValue(other.topScrollEdgeHard) &&
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
- topScrollEdgeHard.isProvided() ||
91
+ topScrollEdgeEffect.isProvided() ||
91
92
  topOverlayHeight.isProvided() ||
92
93
  scrollPositionThresholdsJson.isProvided() ||
93
94
  onScrollPositionThresholdChange.isProvided() ||
@@ -7,7 +7,7 @@
7
7
  "snapshotJson": true,
8
8
  "fontFamiliesJson": true,
9
9
  "containerSlotHeightsJson": true,
10
- "topScrollEdgeHard": true,
10
+ "topScrollEdgeEffect": true,
11
11
  "topOverlayHeight": true,
12
12
  "scrollPositionThresholdsJson": true,
13
13
  "onScrollPositionThresholdChange": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "6.7.0-1",
3
+ "version": "6.7.0-12",
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-1",
90
- "@onekeyfe/react-native-native-logger": "6.7.0-1",
89
+ "@onekeyfe/react-native-image": "6.7.0-12",
90
+ "@onekeyfe/react-native-native-logger": "6.7.0-12",
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 = { "PRODUCT_MODULE_NAME" => "NativeListModuleTests" }
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"
@@ -13,7 +13,7 @@ export interface NativeListNativeProps extends HybridViewProps {
13
13
  snapshotJson: string;
14
14
  fontFamiliesJson: string;
15
15
  containerSlotHeightsJson: string;
16
- topScrollEdgeHard: boolean;
16
+ topScrollEdgeEffect: NativeListScrollEdgeEffect;
17
17
  topOverlayHeight: number;
18
18
  scrollPositionThresholdsJson: string;
19
19
  onScrollPositionThresholdChange?: (isBeyondThreshold: boolean) => void;
@@ -61,3 +61,5 @@ export interface NativeListMethods extends HybridViewMethods {
61
61
  }
62
62
 
63
63
  export type NativeList = HybridView<NativeListNativeProps, NativeListMethods>;
64
+
65
+ export type NativeListScrollEdgeEffect = 'none' | 'hard' | 'soft';