@onekeyfe/react-native-segment-slider 3.0.40

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 (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/SegmentSlider.podspec +29 -0
  4. package/android/CMakeLists.txt +26 -0
  5. package/android/build.gradle +128 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  8. package/android/src/main/java/com/margelo/nitro/segmentslider/HybridSegmentSlider.kt +364 -0
  9. package/android/src/main/java/com/margelo/nitro/segmentslider/SegmentSliderColorParser.kt +56 -0
  10. package/android/src/main/java/com/margelo/nitro/segmentslider/SegmentSliderPackage.kt +29 -0
  11. package/ios/HybridSegmentSlider.swift +412 -0
  12. package/ios/SegmentSliderColorParser.swift +152 -0
  13. package/lib/module/SegmentSlider.nitro.js +4 -0
  14. package/lib/module/SegmentSlider.nitro.js.map +1 -0
  15. package/lib/module/index.js +43 -0
  16. package/lib/module/index.js.map +1 -0
  17. package/lib/module/package.json +1 -0
  18. package/lib/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  19. package/lib/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  20. package/lib/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.cpp +265 -0
  21. package/lib/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.hpp +106 -0
  22. package/lib/nitrogen/generated/android/c++/views/JHybridSegmentSliderStateUpdater.cpp +136 -0
  23. package/lib/nitrogen/generated/android/c++/views/JHybridSegmentSliderStateUpdater.hpp +49 -0
  24. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/Func_void.kt +80 -0
  25. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/Func_void_double.kt +80 -0
  26. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/HybridSegmentSliderSpec.kt +203 -0
  27. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/segmentsliderOnLoad.kt +35 -0
  28. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/views/HybridSegmentSliderManager.kt +50 -0
  29. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/views/HybridSegmentSliderStateUpdater.kt +23 -0
  30. package/lib/nitrogen/generated/android/segmentslider+autolinking.cmake +83 -0
  31. package/lib/nitrogen/generated/android/segmentslider+autolinking.gradle +27 -0
  32. package/lib/nitrogen/generated/android/segmentsliderOnLoad.cpp +50 -0
  33. package/lib/nitrogen/generated/android/segmentsliderOnLoad.hpp +25 -0
  34. package/lib/nitrogen/generated/ios/SegmentSlider+autolinking.rb +60 -0
  35. package/lib/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Bridge.cpp +49 -0
  36. package/lib/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Bridge.hpp +116 -0
  37. package/lib/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Umbrella.hpp +44 -0
  38. package/lib/nitrogen/generated/ios/SegmentSliderAutolinking.mm +33 -0
  39. package/lib/nitrogen/generated/ios/SegmentSliderAutolinking.swift +25 -0
  40. package/lib/nitrogen/generated/ios/c++/HybridSegmentSliderSpecSwift.cpp +11 -0
  41. package/lib/nitrogen/generated/ios/c++/HybridSegmentSliderSpecSwift.hpp +208 -0
  42. package/lib/nitrogen/generated/ios/c++/views/HybridSegmentSliderComponent.mm +196 -0
  43. package/lib/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  44. package/lib/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  45. package/lib/nitrogen/generated/ios/swift/HybridSegmentSliderSpec.swift +76 -0
  46. package/lib/nitrogen/generated/ios/swift/HybridSegmentSliderSpec_cxx.swift +423 -0
  47. package/lib/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.cpp +62 -0
  48. package/lib/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.hpp +105 -0
  49. package/lib/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.cpp +327 -0
  50. package/lib/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.hpp +128 -0
  51. package/lib/nitrogen/generated/shared/json/SegmentSliderConfig.json +30 -0
  52. package/lib/nitrogen/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  53. package/lib/nitrogen/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  54. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.cpp +265 -0
  55. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.hpp +106 -0
  56. package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridSegmentSliderStateUpdater.cpp +136 -0
  57. package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridSegmentSliderStateUpdater.hpp +49 -0
  58. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/Func_void.kt +80 -0
  59. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/Func_void_double.kt +80 -0
  60. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/HybridSegmentSliderSpec.kt +203 -0
  61. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/segmentsliderOnLoad.kt +35 -0
  62. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/views/HybridSegmentSliderManager.kt +50 -0
  63. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/views/HybridSegmentSliderStateUpdater.kt +23 -0
  64. package/lib/nitrogen/nitrogen/generated/android/segmentslider+autolinking.cmake +83 -0
  65. package/lib/nitrogen/nitrogen/generated/android/segmentslider+autolinking.gradle +27 -0
  66. package/lib/nitrogen/nitrogen/generated/android/segmentsliderOnLoad.cpp +50 -0
  67. package/lib/nitrogen/nitrogen/generated/android/segmentsliderOnLoad.hpp +25 -0
  68. package/lib/nitrogen/nitrogen/generated/ios/SegmentSlider+autolinking.rb +60 -0
  69. package/lib/nitrogen/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Bridge.cpp +49 -0
  70. package/lib/nitrogen/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Bridge.hpp +116 -0
  71. package/lib/nitrogen/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Umbrella.hpp +44 -0
  72. package/lib/nitrogen/nitrogen/generated/ios/SegmentSliderAutolinking.mm +33 -0
  73. package/lib/nitrogen/nitrogen/generated/ios/SegmentSliderAutolinking.swift +25 -0
  74. package/lib/nitrogen/nitrogen/generated/ios/c++/HybridSegmentSliderSpecSwift.cpp +11 -0
  75. package/lib/nitrogen/nitrogen/generated/ios/c++/HybridSegmentSliderSpecSwift.hpp +208 -0
  76. package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridSegmentSliderComponent.mm +196 -0
  77. package/lib/nitrogen/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  78. package/lib/nitrogen/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  79. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridSegmentSliderSpec.swift +76 -0
  80. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridSegmentSliderSpec_cxx.swift +423 -0
  81. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.cpp +62 -0
  82. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.hpp +105 -0
  83. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.cpp +327 -0
  84. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.hpp +128 -0
  85. package/lib/nitrogen/nitrogen/generated/shared/json/SegmentSliderConfig.json +30 -0
  86. package/lib/typescript/package.json +1 -0
  87. package/lib/typescript/src/SegmentSlider.nitro.d.ts +72 -0
  88. package/lib/typescript/src/SegmentSlider.nitro.d.ts.map +1 -0
  89. package/lib/typescript/src/index.d.ts +11 -0
  90. package/lib/typescript/src/index.d.ts.map +1 -0
  91. package/nitro.json +17 -0
  92. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  93. package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  94. package/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.cpp +265 -0
  95. package/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.hpp +106 -0
  96. package/nitrogen/generated/android/c++/views/JHybridSegmentSliderStateUpdater.cpp +136 -0
  97. package/nitrogen/generated/android/c++/views/JHybridSegmentSliderStateUpdater.hpp +49 -0
  98. package/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/Func_void.kt +80 -0
  99. package/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/Func_void_double.kt +80 -0
  100. package/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/HybridSegmentSliderSpec.kt +203 -0
  101. package/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/segmentsliderOnLoad.kt +35 -0
  102. package/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/views/HybridSegmentSliderManager.kt +50 -0
  103. package/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/views/HybridSegmentSliderStateUpdater.kt +23 -0
  104. package/nitrogen/generated/android/segmentslider+autolinking.cmake +83 -0
  105. package/nitrogen/generated/android/segmentslider+autolinking.gradle +27 -0
  106. package/nitrogen/generated/android/segmentsliderOnLoad.cpp +50 -0
  107. package/nitrogen/generated/android/segmentsliderOnLoad.hpp +25 -0
  108. package/nitrogen/generated/ios/SegmentSlider+autolinking.rb +60 -0
  109. package/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Bridge.cpp +49 -0
  110. package/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Bridge.hpp +116 -0
  111. package/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Umbrella.hpp +44 -0
  112. package/nitrogen/generated/ios/SegmentSliderAutolinking.mm +33 -0
  113. package/nitrogen/generated/ios/SegmentSliderAutolinking.swift +25 -0
  114. package/nitrogen/generated/ios/c++/HybridSegmentSliderSpecSwift.cpp +11 -0
  115. package/nitrogen/generated/ios/c++/HybridSegmentSliderSpecSwift.hpp +208 -0
  116. package/nitrogen/generated/ios/c++/views/HybridSegmentSliderComponent.mm +196 -0
  117. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  118. package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  119. package/nitrogen/generated/ios/swift/HybridSegmentSliderSpec.swift +76 -0
  120. package/nitrogen/generated/ios/swift/HybridSegmentSliderSpec_cxx.swift +423 -0
  121. package/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.cpp +62 -0
  122. package/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.hpp +105 -0
  123. package/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.cpp +327 -0
  124. package/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.hpp +128 -0
  125. package/nitrogen/generated/shared/json/SegmentSliderConfig.json +30 -0
  126. package/package.json +170 -0
  127. package/src/SegmentSlider.nitro.ts +80 -0
  128. package/src/index.tsx +59 -0
@@ -0,0 +1,327 @@
1
+ ///
2
+ /// HybridSegmentSliderComponent.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridSegmentSliderComponent.hpp"
9
+
10
+ #include <string>
11
+ #include <exception>
12
+ #include <utility>
13
+ #include <NitroModules/NitroDefines.hpp>
14
+ #include <NitroModules/JSIConverter.hpp>
15
+ #include <react/renderer/core/RawValue.h>
16
+ #include <react/renderer/core/ShadowNode.h>
17
+ #include <react/renderer/core/ComponentDescriptor.h>
18
+ #include <react/renderer/components/view/ViewProps.h>
19
+
20
+ namespace margelo::nitro::segmentslider::views {
21
+
22
+ extern const char HybridSegmentSliderComponentName[] = "SegmentSlider";
23
+
24
+ HybridSegmentSliderProps::HybridSegmentSliderProps(const react::PropsParserContext& context,
25
+ const HybridSegmentSliderProps& sourceProps,
26
+ const react::RawProps& rawProps):
27
+ react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
28
+ value([&]() -> CachedProp<double> {
29
+ try {
30
+ const react::RawValue* rawValue = rawProps.at("value", nullptr, nullptr);
31
+ if (rawValue == nullptr) return sourceProps.value;
32
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
33
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.value);
34
+ } catch (const std::exception& exc) {
35
+ throw std::runtime_error(std::string("SegmentSlider.value: ") + exc.what());
36
+ }
37
+ }()),
38
+ min([&]() -> CachedProp<double> {
39
+ try {
40
+ const react::RawValue* rawValue = rawProps.at("min", nullptr, nullptr);
41
+ if (rawValue == nullptr) return sourceProps.min;
42
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
43
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.min);
44
+ } catch (const std::exception& exc) {
45
+ throw std::runtime_error(std::string("SegmentSlider.min: ") + exc.what());
46
+ }
47
+ }()),
48
+ max([&]() -> CachedProp<double> {
49
+ try {
50
+ const react::RawValue* rawValue = rawProps.at("max", nullptr, nullptr);
51
+ if (rawValue == nullptr) return sourceProps.max;
52
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
53
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.max);
54
+ } catch (const std::exception& exc) {
55
+ throw std::runtime_error(std::string("SegmentSlider.max: ") + exc.what());
56
+ }
57
+ }()),
58
+ segments([&]() -> CachedProp<double> {
59
+ try {
60
+ const react::RawValue* rawValue = rawProps.at("segments", nullptr, nullptr);
61
+ if (rawValue == nullptr) return sourceProps.segments;
62
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
63
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.segments);
64
+ } catch (const std::exception& exc) {
65
+ throw std::runtime_error(std::string("SegmentSlider.segments: ") + exc.what());
66
+ }
67
+ }()),
68
+ sliderHeight([&]() -> CachedProp<double> {
69
+ try {
70
+ const react::RawValue* rawValue = rawProps.at("sliderHeight", nullptr, nullptr);
71
+ if (rawValue == nullptr) return sourceProps.sliderHeight;
72
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
73
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.sliderHeight);
74
+ } catch (const std::exception& exc) {
75
+ throw std::runtime_error(std::string("SegmentSlider.sliderHeight: ") + exc.what());
76
+ }
77
+ }()),
78
+ disabled([&]() -> CachedProp<bool> {
79
+ try {
80
+ const react::RawValue* rawValue = rawProps.at("disabled", nullptr, nullptr);
81
+ if (rawValue == nullptr) return sourceProps.disabled;
82
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
83
+ return CachedProp<bool>::fromRawValue(*runtime, value, sourceProps.disabled);
84
+ } catch (const std::exception& exc) {
85
+ throw std::runtime_error(std::string("SegmentSlider.disabled: ") + exc.what());
86
+ }
87
+ }()),
88
+ showBubble([&]() -> CachedProp<bool> {
89
+ try {
90
+ const react::RawValue* rawValue = rawProps.at("showBubble", nullptr, nullptr);
91
+ if (rawValue == nullptr) return sourceProps.showBubble;
92
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
93
+ return CachedProp<bool>::fromRawValue(*runtime, value, sourceProps.showBubble);
94
+ } catch (const std::exception& exc) {
95
+ throw std::runtime_error(std::string("SegmentSlider.showBubble: ") + exc.what());
96
+ }
97
+ }()),
98
+ centerOrigin([&]() -> CachedProp<bool> {
99
+ try {
100
+ const react::RawValue* rawValue = rawProps.at("centerOrigin", nullptr, nullptr);
101
+ if (rawValue == nullptr) return sourceProps.centerOrigin;
102
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
103
+ return CachedProp<bool>::fromRawValue(*runtime, value, sourceProps.centerOrigin);
104
+ } catch (const std::exception& exc) {
105
+ throw std::runtime_error(std::string("SegmentSlider.centerOrigin: ") + exc.what());
106
+ }
107
+ }()),
108
+ epoch([&]() -> CachedProp<double> {
109
+ try {
110
+ const react::RawValue* rawValue = rawProps.at("epoch", nullptr, nullptr);
111
+ if (rawValue == nullptr) return sourceProps.epoch;
112
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
113
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.epoch);
114
+ } catch (const std::exception& exc) {
115
+ throw std::runtime_error(std::string("SegmentSlider.epoch: ") + exc.what());
116
+ }
117
+ }()),
118
+ fillColor([&]() -> CachedProp<std::string> {
119
+ try {
120
+ const react::RawValue* rawValue = rawProps.at("fillColor", nullptr, nullptr);
121
+ if (rawValue == nullptr) return sourceProps.fillColor;
122
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
123
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.fillColor);
124
+ } catch (const std::exception& exc) {
125
+ throw std::runtime_error(std::string("SegmentSlider.fillColor: ") + exc.what());
126
+ }
127
+ }()),
128
+ trackColor([&]() -> CachedProp<std::string> {
129
+ try {
130
+ const react::RawValue* rawValue = rawProps.at("trackColor", nullptr, nullptr);
131
+ if (rawValue == nullptr) return sourceProps.trackColor;
132
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
133
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.trackColor);
134
+ } catch (const std::exception& exc) {
135
+ throw std::runtime_error(std::string("SegmentSlider.trackColor: ") + exc.what());
136
+ }
137
+ }()),
138
+ thumbColor([&]() -> CachedProp<std::string> {
139
+ try {
140
+ const react::RawValue* rawValue = rawProps.at("thumbColor", nullptr, nullptr);
141
+ if (rawValue == nullptr) return sourceProps.thumbColor;
142
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
143
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.thumbColor);
144
+ } catch (const std::exception& exc) {
145
+ throw std::runtime_error(std::string("SegmentSlider.thumbColor: ") + exc.what());
146
+ }
147
+ }()),
148
+ thumbBorderColor([&]() -> CachedProp<std::string> {
149
+ try {
150
+ const react::RawValue* rawValue = rawProps.at("thumbBorderColor", nullptr, nullptr);
151
+ if (rawValue == nullptr) return sourceProps.thumbBorderColor;
152
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
153
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.thumbBorderColor);
154
+ } catch (const std::exception& exc) {
155
+ throw std::runtime_error(std::string("SegmentSlider.thumbBorderColor: ") + exc.what());
156
+ }
157
+ }()),
158
+ markActiveColor([&]() -> CachedProp<std::string> {
159
+ try {
160
+ const react::RawValue* rawValue = rawProps.at("markActiveColor", nullptr, nullptr);
161
+ if (rawValue == nullptr) return sourceProps.markActiveColor;
162
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
163
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.markActiveColor);
164
+ } catch (const std::exception& exc) {
165
+ throw std::runtime_error(std::string("SegmentSlider.markActiveColor: ") + exc.what());
166
+ }
167
+ }()),
168
+ markInactiveColor([&]() -> CachedProp<std::string> {
169
+ try {
170
+ const react::RawValue* rawValue = rawProps.at("markInactiveColor", nullptr, nullptr);
171
+ if (rawValue == nullptr) return sourceProps.markInactiveColor;
172
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
173
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.markInactiveColor);
174
+ } catch (const std::exception& exc) {
175
+ throw std::runtime_error(std::string("SegmentSlider.markInactiveColor: ") + exc.what());
176
+ }
177
+ }()),
178
+ markBorderColor([&]() -> CachedProp<std::string> {
179
+ try {
180
+ const react::RawValue* rawValue = rawProps.at("markBorderColor", nullptr, nullptr);
181
+ if (rawValue == nullptr) return sourceProps.markBorderColor;
182
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
183
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.markBorderColor);
184
+ } catch (const std::exception& exc) {
185
+ throw std::runtime_error(std::string("SegmentSlider.markBorderColor: ") + exc.what());
186
+ }
187
+ }()),
188
+ bubbleColor([&]() -> CachedProp<std::string> {
189
+ try {
190
+ const react::RawValue* rawValue = rawProps.at("bubbleColor", nullptr, nullptr);
191
+ if (rawValue == nullptr) return sourceProps.bubbleColor;
192
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
193
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.bubbleColor);
194
+ } catch (const std::exception& exc) {
195
+ throw std::runtime_error(std::string("SegmentSlider.bubbleColor: ") + exc.what());
196
+ }
197
+ }()),
198
+ bubbleTextColor([&]() -> CachedProp<std::string> {
199
+ try {
200
+ const react::RawValue* rawValue = rawProps.at("bubbleTextColor", nullptr, nullptr);
201
+ if (rawValue == nullptr) return sourceProps.bubbleTextColor;
202
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
203
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.bubbleTextColor);
204
+ } catch (const std::exception& exc) {
205
+ throw std::runtime_error(std::string("SegmentSlider.bubbleTextColor: ") + exc.what());
206
+ }
207
+ }()),
208
+ onChange([&]() -> CachedProp<std::optional<std::function<void(double /* value */)>>> {
209
+ try {
210
+ const react::RawValue* rawValue = rawProps.at("onChange", nullptr, nullptr);
211
+ if (rawValue == nullptr) return sourceProps.onChange;
212
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
213
+ return CachedProp<std::optional<std::function<void(double /* value */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onChange);
214
+ } catch (const std::exception& exc) {
215
+ throw std::runtime_error(std::string("SegmentSlider.onChange: ") + exc.what());
216
+ }
217
+ }()),
218
+ onSlideStart([&]() -> CachedProp<std::optional<std::function<void()>>> {
219
+ try {
220
+ const react::RawValue* rawValue = rawProps.at("onSlideStart", nullptr, nullptr);
221
+ if (rawValue == nullptr) return sourceProps.onSlideStart;
222
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
223
+ return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onSlideStart);
224
+ } catch (const std::exception& exc) {
225
+ throw std::runtime_error(std::string("SegmentSlider.onSlideStart: ") + exc.what());
226
+ }
227
+ }()),
228
+ onSlideComplete([&]() -> CachedProp<std::optional<std::function<void()>>> {
229
+ try {
230
+ const react::RawValue* rawValue = rawProps.at("onSlideComplete", nullptr, nullptr);
231
+ if (rawValue == nullptr) return sourceProps.onSlideComplete;
232
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
233
+ return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onSlideComplete);
234
+ } catch (const std::exception& exc) {
235
+ throw std::runtime_error(std::string("SegmentSlider.onSlideComplete: ") + exc.what());
236
+ }
237
+ }()),
238
+ hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridSegmentSliderSpec>& /* ref */)>>> {
239
+ try {
240
+ const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
241
+ if (rawValue == nullptr) return sourceProps.hybridRef;
242
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
243
+ return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridSegmentSliderSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.hybridRef);
244
+ } catch (const std::exception& exc) {
245
+ throw std::runtime_error(std::string("SegmentSlider.hybridRef: ") + exc.what());
246
+ }
247
+ }()) { }
248
+
249
+ HybridSegmentSliderProps::HybridSegmentSliderProps(const HybridSegmentSliderProps& other):
250
+ react::ViewProps(),
251
+ value(other.value),
252
+ min(other.min),
253
+ max(other.max),
254
+ segments(other.segments),
255
+ sliderHeight(other.sliderHeight),
256
+ disabled(other.disabled),
257
+ showBubble(other.showBubble),
258
+ centerOrigin(other.centerOrigin),
259
+ epoch(other.epoch),
260
+ fillColor(other.fillColor),
261
+ trackColor(other.trackColor),
262
+ thumbColor(other.thumbColor),
263
+ thumbBorderColor(other.thumbBorderColor),
264
+ markActiveColor(other.markActiveColor),
265
+ markInactiveColor(other.markInactiveColor),
266
+ markBorderColor(other.markBorderColor),
267
+ bubbleColor(other.bubbleColor),
268
+ bubbleTextColor(other.bubbleTextColor),
269
+ onChange(other.onChange),
270
+ onSlideStart(other.onSlideStart),
271
+ onSlideComplete(other.onSlideComplete),
272
+ hybridRef(other.hybridRef) { }
273
+
274
+ bool HybridSegmentSliderProps::filterObjectKeys(const std::string& propName) {
275
+ switch (hashString(propName)) {
276
+ case hashString("value"): return true;
277
+ case hashString("min"): return true;
278
+ case hashString("max"): return true;
279
+ case hashString("segments"): return true;
280
+ case hashString("sliderHeight"): return true;
281
+ case hashString("disabled"): return true;
282
+ case hashString("showBubble"): return true;
283
+ case hashString("centerOrigin"): return true;
284
+ case hashString("epoch"): return true;
285
+ case hashString("fillColor"): return true;
286
+ case hashString("trackColor"): return true;
287
+ case hashString("thumbColor"): return true;
288
+ case hashString("thumbBorderColor"): return true;
289
+ case hashString("markActiveColor"): return true;
290
+ case hashString("markInactiveColor"): return true;
291
+ case hashString("markBorderColor"): return true;
292
+ case hashString("bubbleColor"): return true;
293
+ case hashString("bubbleTextColor"): return true;
294
+ case hashString("onChange"): return true;
295
+ case hashString("onSlideStart"): return true;
296
+ case hashString("onSlideComplete"): return true;
297
+ case hashString("hybridRef"): return true;
298
+ default: return false;
299
+ }
300
+ }
301
+
302
+ HybridSegmentSliderComponentDescriptor::HybridSegmentSliderComponentDescriptor(const react::ComponentDescriptorParameters& parameters)
303
+ : ConcreteComponentDescriptor(parameters,
304
+ react::RawPropsParser(/* enableJsiParser */ true)) {}
305
+
306
+ std::shared_ptr<const react::Props> HybridSegmentSliderComponentDescriptor::cloneProps(const react::PropsParserContext& context,
307
+ const std::shared_ptr<const react::Props>& props,
308
+ react::RawProps rawProps) const {
309
+ // 1. Prepare raw props parser
310
+ rawProps.parse(rawPropsParser_);
311
+ // 2. Copy props with Nitro's cached copy constructor
312
+ return HybridSegmentSliderShadowNode::Props(context, /* & */ rawProps, props);
313
+ }
314
+
315
+ #ifdef ANDROID
316
+ void HybridSegmentSliderComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
317
+ // This is called immediately after `ShadowNode` is created, cloned or in progress.
318
+ // On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
319
+ auto& concreteShadowNode = dynamic_cast<HybridSegmentSliderShadowNode&>(shadowNode);
320
+ const HybridSegmentSliderProps& props = concreteShadowNode.getConcreteProps();
321
+ HybridSegmentSliderState state;
322
+ state.setProps(props);
323
+ concreteShadowNode.setStateData(std::move(state));
324
+ }
325
+ #endif
326
+
327
+ } // namespace margelo::nitro::segmentslider::views
@@ -0,0 +1,128 @@
1
+ ///
2
+ /// HybridSegmentSliderComponent.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <optional>
11
+ #include <NitroModules/NitroDefines.hpp>
12
+ #include <NitroModules/NitroHash.hpp>
13
+ #include <NitroModules/CachedProp.hpp>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/core/PropsParserContext.h>
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <react/renderer/components/view/ViewProps.h>
18
+
19
+ #include <string>
20
+ #include <functional>
21
+ #include <optional>
22
+ #include <memory>
23
+ #include "HybridSegmentSliderSpec.hpp"
24
+
25
+ namespace margelo::nitro::segmentslider::views {
26
+
27
+ using namespace facebook;
28
+
29
+ /**
30
+ * The name of the actual native View.
31
+ */
32
+ extern const char HybridSegmentSliderComponentName[];
33
+
34
+ /**
35
+ * Props for the "SegmentSlider" View.
36
+ */
37
+ class HybridSegmentSliderProps final: public react::ViewProps {
38
+ public:
39
+ HybridSegmentSliderProps() = default;
40
+ HybridSegmentSliderProps(const HybridSegmentSliderProps&);
41
+ HybridSegmentSliderProps(const react::PropsParserContext& context,
42
+ const HybridSegmentSliderProps& sourceProps,
43
+ const react::RawProps& rawProps);
44
+
45
+ public:
46
+ CachedProp<double> value;
47
+ CachedProp<double> min;
48
+ CachedProp<double> max;
49
+ CachedProp<double> segments;
50
+ CachedProp<double> sliderHeight;
51
+ CachedProp<bool> disabled;
52
+ CachedProp<bool> showBubble;
53
+ CachedProp<bool> centerOrigin;
54
+ CachedProp<double> epoch;
55
+ CachedProp<std::string> fillColor;
56
+ CachedProp<std::string> trackColor;
57
+ CachedProp<std::string> thumbColor;
58
+ CachedProp<std::string> thumbBorderColor;
59
+ CachedProp<std::string> markActiveColor;
60
+ CachedProp<std::string> markInactiveColor;
61
+ CachedProp<std::string> markBorderColor;
62
+ CachedProp<std::string> bubbleColor;
63
+ CachedProp<std::string> bubbleTextColor;
64
+ CachedProp<std::optional<std::function<void(double /* value */)>>> onChange;
65
+ CachedProp<std::optional<std::function<void()>>> onSlideStart;
66
+ CachedProp<std::optional<std::function<void()>>> onSlideComplete;
67
+ CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridSegmentSliderSpec>& /* ref */)>>> hybridRef;
68
+
69
+ private:
70
+ static bool filterObjectKeys(const std::string& propName);
71
+ };
72
+
73
+ /**
74
+ * State for the "SegmentSlider" View.
75
+ */
76
+ class HybridSegmentSliderState final {
77
+ public:
78
+ HybridSegmentSliderState() = default;
79
+
80
+ public:
81
+ void setProps(const HybridSegmentSliderProps& props) { _props.emplace(props); }
82
+ const std::optional<HybridSegmentSliderProps>& getProps() const { return _props; }
83
+
84
+ public:
85
+ #ifdef ANDROID
86
+ HybridSegmentSliderState(const HybridSegmentSliderState& /* previousState */, folly::dynamic /* data */) {}
87
+ folly::dynamic getDynamic() const {
88
+ throw std::runtime_error("HybridSegmentSliderState does not support folly!");
89
+ }
90
+ react::MapBuffer getMapBuffer() const {
91
+ throw std::runtime_error("HybridSegmentSliderState does not support MapBuffer!");
92
+ };
93
+ #endif
94
+
95
+ private:
96
+ std::optional<HybridSegmentSliderProps> _props;
97
+ };
98
+
99
+ /**
100
+ * The Shadow Node for the "SegmentSlider" View.
101
+ */
102
+ using HybridSegmentSliderShadowNode = react::ConcreteViewShadowNode<HybridSegmentSliderComponentName /* "HybridSegmentSlider" */,
103
+ HybridSegmentSliderProps /* custom props */,
104
+ react::ViewEventEmitter /* default */,
105
+ HybridSegmentSliderState /* custom state */>;
106
+
107
+ /**
108
+ * The Component Descriptor for the "SegmentSlider" View.
109
+ */
110
+ class HybridSegmentSliderComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridSegmentSliderShadowNode> {
111
+ public:
112
+ HybridSegmentSliderComponentDescriptor(const react::ComponentDescriptorParameters& parameters);
113
+
114
+ public:
115
+ /**
116
+ * A faster path for cloning props - reuses the caching logic from `HybridSegmentSliderProps`.
117
+ */
118
+ std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
119
+ const std::shared_ptr<const react::Props>& props,
120
+ react::RawProps rawProps) const override;
121
+ #ifdef ANDROID
122
+ void adopt(react::ShadowNode& shadowNode) const override;
123
+ #endif
124
+ };
125
+
126
+ /* The actual view for "SegmentSlider" needs to be implemented in platform-specific code. */
127
+
128
+ } // namespace margelo::nitro::segmentslider::views
@@ -0,0 +1,30 @@
1
+ {
2
+ "uiViewClassName": "SegmentSlider",
3
+ "supportsRawText": false,
4
+ "bubblingEventTypes": {},
5
+ "directEventTypes": {},
6
+ "validAttributes": {
7
+ "value": true,
8
+ "min": true,
9
+ "max": true,
10
+ "segments": true,
11
+ "sliderHeight": true,
12
+ "disabled": true,
13
+ "showBubble": true,
14
+ "centerOrigin": true,
15
+ "epoch": true,
16
+ "fillColor": true,
17
+ "trackColor": true,
18
+ "thumbColor": true,
19
+ "thumbBorderColor": true,
20
+ "markActiveColor": true,
21
+ "markInactiveColor": true,
22
+ "markBorderColor": true,
23
+ "bubbleColor": true,
24
+ "bubbleTextColor": true,
25
+ "onChange": true,
26
+ "onSlideStart": true,
27
+ "onSlideComplete": true,
28
+ "hybridRef": true
29
+ }
30
+ }
package/package.json ADDED
@@ -0,0 +1,170 @@
1
+ {
2
+ "name": "@onekeyfe/react-native-segment-slider",
3
+ "version": "3.0.40",
4
+ "description": "react-native-segment-slider",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "android",
19
+ "ios",
20
+ "cpp",
21
+ "nitrogen",
22
+ "nitro.json",
23
+ "*.podspec",
24
+ "react-native.config.js",
25
+ "!ios/build",
26
+ "!android/build",
27
+ "!android/gradle",
28
+ "!android/gradlew",
29
+ "!android/gradlew.bat",
30
+ "!android/local.properties",
31
+ "!**/__tests__",
32
+ "!**/__fixtures__",
33
+ "!**/__mocks__",
34
+ "!**/.*"
35
+ ],
36
+ "scripts": {
37
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
38
+ "prepare": "bob build && cp -r nitrogen lib/nitrogen",
39
+ "nitrogen": "nitrogen",
40
+ "typecheck": "tsc",
41
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
42
+ "test": "jest",
43
+ "release": "yarn nitrogen && yarn prepare && npm whoami && npm publish --access public"
44
+ },
45
+ "keywords": [
46
+ "react-native",
47
+ "ios",
48
+ "android"
49
+ ],
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://github.com/OneKeyHQ/native-views/react-native-segment-slider.git"
53
+ },
54
+ "author": "@onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
55
+ "license": "MIT",
56
+ "bugs": {
57
+ "url": "https://github.com/OneKeyHQ/native-views/react-native-segment-slider/issues"
58
+ },
59
+ "homepage": "https://github.com/OneKeyHQ/native-views/react-native-segment-slider#readme",
60
+ "publishConfig": {
61
+ "registry": "https://registry.npmjs.org/"
62
+ },
63
+ "devDependencies": {
64
+ "@commitlint/config-conventional": "^19.8.1",
65
+ "@eslint/compat": "^1.3.2",
66
+ "@eslint/eslintrc": "^3.3.1",
67
+ "@eslint/js": "^9.35.0",
68
+ "@react-native/babel-preset": "0.83.0",
69
+ "@react-native/eslint-config": "0.83.0",
70
+ "@release-it/conventional-changelog": "^10.0.1",
71
+ "@types/jest": "^29.5.14",
72
+ "@types/react": "^19.2.0",
73
+ "commitlint": "^19.8.1",
74
+ "del-cli": "^6.0.0",
75
+ "eslint": "^9.35.0",
76
+ "eslint-config-prettier": "^10.1.8",
77
+ "eslint-plugin-prettier": "^5.5.4",
78
+ "jest": "^29.7.0",
79
+ "lefthook": "^2.0.3",
80
+ "nitrogen": "0.31.10",
81
+ "prettier": "^2.8.8",
82
+ "react": "19.2.0",
83
+ "react-native": "patch:react-native@npm%3A0.83.0#~/.yarn/patches/react-native-npm-0.83.0-577d0f2d83.patch",
84
+ "react-native-builder-bob": "^0.40.13",
85
+ "react-native-nitro-modules": "0.33.2",
86
+ "release-it": "^19.0.4",
87
+ "turbo": "^2.5.6",
88
+ "typescript": "^5.9.2"
89
+ },
90
+ "peerDependencies": {
91
+ "react": "*",
92
+ "react-native": "*",
93
+ "react-native-nitro-modules": "0.33.2"
94
+ },
95
+ "packageManager": "yarn@4.11.0",
96
+ "react-native-builder-bob": {
97
+ "source": "src",
98
+ "output": "lib",
99
+ "targets": [
100
+ [
101
+ "custom",
102
+ {
103
+ "script": "nitrogen",
104
+ "clean": "nitrogen/"
105
+ }
106
+ ],
107
+ [
108
+ "module",
109
+ {
110
+ "esm": true
111
+ }
112
+ ],
113
+ [
114
+ "typescript",
115
+ {
116
+ "project": "tsconfig.build.json"
117
+ }
118
+ ]
119
+ ]
120
+ },
121
+ "prettier": {
122
+ "quoteProps": "consistent",
123
+ "singleQuote": true,
124
+ "tabWidth": 2,
125
+ "trailingComma": "es5",
126
+ "useTabs": false
127
+ },
128
+ "jest": {
129
+ "preset": "react-native",
130
+ "modulePathIgnorePatterns": [
131
+ "<rootDir>/example/node_modules",
132
+ "<rootDir>/lib/"
133
+ ]
134
+ },
135
+ "commitlint": {
136
+ "extends": [
137
+ "@commitlint/config-conventional"
138
+ ]
139
+ },
140
+ "release-it": {
141
+ "git": {
142
+ "commitMessage": "chore: release ${version}",
143
+ "tagName": "v${version}"
144
+ },
145
+ "npm": {
146
+ "publish": true
147
+ },
148
+ "github": {
149
+ "release": true
150
+ },
151
+ "plugins": {
152
+ "@release-it/conventional-changelog": {
153
+ "preset": {
154
+ "name": "angular"
155
+ }
156
+ }
157
+ }
158
+ },
159
+ "create-react-native-library": {
160
+ "type": "nitro-view",
161
+ "languages": "kotlin-swift",
162
+ "tools": [
163
+ "eslint",
164
+ "jest",
165
+ "lefthook",
166
+ "release-it"
167
+ ],
168
+ "version": "0.56.0"
169
+ }
170
+ }