@onekeyfe/react-native-perp-depth-bar 3.0.39 → 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 (72) hide show
  1. package/android/src/main/java/com/margelo/nitro/perpdepthbar/HybridPerpDepthBars.kt +100 -1
  2. package/ios/HybridPerpDepthBars.swift +97 -1
  3. package/ios/PerpColorParser.swift +8 -0
  4. package/lib/module/index.js +25 -2
  5. package/lib/module/index.js.map +1 -1
  6. package/lib/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  7. package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +120 -0
  8. package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +16 -0
  9. package/lib/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +32 -0
  10. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/Func_void_double.kt +80 -0
  11. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +56 -0
  12. package/lib/nitrogen/generated/android/perpdepthbarOnLoad.cpp +2 -0
  13. package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.cpp +8 -0
  14. package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +51 -0
  15. package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +2 -0
  16. package/lib/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +55 -0
  17. package/lib/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +40 -0
  18. package/lib/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  19. package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +8 -0
  20. package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +121 -0
  21. package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +16 -0
  22. package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +18 -0
  23. package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +96 -0
  24. package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +10 -2
  25. package/lib/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +8 -0
  26. package/lib/nitrogen/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  27. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +120 -0
  28. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +16 -0
  29. package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +32 -0
  30. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/Func_void_double.kt +80 -0
  31. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +56 -0
  32. package/lib/nitrogen/nitrogen/generated/android/perpdepthbarOnLoad.cpp +2 -0
  33. package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.cpp +8 -0
  34. package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +51 -0
  35. package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +2 -0
  36. package/lib/nitrogen/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +55 -0
  37. package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +40 -0
  38. package/lib/nitrogen/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  39. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +8 -0
  40. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +121 -0
  41. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +16 -0
  42. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +18 -0
  43. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +96 -0
  44. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +10 -2
  45. package/lib/nitrogen/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +8 -0
  46. package/lib/typescript/src/PerpDepthBars.nitro.d.ts +20 -0
  47. package/lib/typescript/src/PerpDepthBars.nitro.d.ts.map +1 -1
  48. package/lib/typescript/src/index.d.ts +7 -1
  49. package/lib/typescript/src/index.d.ts.map +1 -1
  50. package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  51. package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +120 -0
  52. package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +16 -0
  53. package/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +32 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/Func_void_double.kt +80 -0
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +56 -0
  56. package/nitrogen/generated/android/perpdepthbarOnLoad.cpp +2 -0
  57. package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.cpp +8 -0
  58. package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +51 -0
  59. package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +2 -0
  60. package/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +55 -0
  61. package/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +40 -0
  62. package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  63. package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +8 -0
  64. package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +121 -0
  65. package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +16 -0
  66. package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +18 -0
  67. package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +96 -0
  68. package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +10 -2
  69. package/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +8 -0
  70. package/package.json +1 -1
  71. package/src/PerpDepthBars.nitro.ts +27 -0
  72. package/src/index.tsx +28 -2
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_double.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ rowIndex: Double) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_double {
16
+ public typealias bridge = margelo.nitro.perpdepthbar.bridge.swift
17
+
18
+ private let closure: (_ rowIndex: Double) -> Void
19
+
20
+ public init(_ closure: @escaping (_ rowIndex: Double) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(rowIndex: Double) -> Void {
26
+ self.closure(rowIndex)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_double`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_double>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double {
45
+ return Unmanaged<Func_void_double>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -19,6 +19,14 @@ public protocol HybridPerpDepthBarsSpec_protocol: HybridObject, HybridView {
19
19
  var origin: String { get set }
20
20
  var reducedMotion: Bool { get set }
21
21
  var epoch: Double { get set }
22
+ var prices: [String] { get set }
23
+ var sizes: [String] { get set }
24
+ var priceColor: String { get set }
25
+ var sizeColor: String { get set }
26
+ var priceFontSize: Double { get set }
27
+ var sizeFontSize: Double { get set }
28
+ var textInset: Double { get set }
29
+ var onRowPress: ((_ rowIndex: Double) -> Void)? { get set }
22
30
 
23
31
  // Methods
24
32
 
@@ -207,6 +207,127 @@ open class HybridPerpDepthBarsSpec_cxx {
207
207
  self.__implementation.epoch = newValue
208
208
  }
209
209
  }
210
+
211
+ public final var prices: bridge.std__vector_std__string_ {
212
+ @inline(__always)
213
+ get {
214
+ return { () -> bridge.std__vector_std__string_ in
215
+ var __vector = bridge.create_std__vector_std__string_(self.__implementation.prices.count)
216
+ for __item in self.__implementation.prices {
217
+ __vector.push_back(std.string(__item))
218
+ }
219
+ return __vector
220
+ }()
221
+ }
222
+ @inline(__always)
223
+ set {
224
+ self.__implementation.prices = newValue.map({ __item in String(__item) })
225
+ }
226
+ }
227
+
228
+ public final var sizes: bridge.std__vector_std__string_ {
229
+ @inline(__always)
230
+ get {
231
+ return { () -> bridge.std__vector_std__string_ in
232
+ var __vector = bridge.create_std__vector_std__string_(self.__implementation.sizes.count)
233
+ for __item in self.__implementation.sizes {
234
+ __vector.push_back(std.string(__item))
235
+ }
236
+ return __vector
237
+ }()
238
+ }
239
+ @inline(__always)
240
+ set {
241
+ self.__implementation.sizes = newValue.map({ __item in String(__item) })
242
+ }
243
+ }
244
+
245
+ public final var priceColor: std.string {
246
+ @inline(__always)
247
+ get {
248
+ return std.string(self.__implementation.priceColor)
249
+ }
250
+ @inline(__always)
251
+ set {
252
+ self.__implementation.priceColor = String(newValue)
253
+ }
254
+ }
255
+
256
+ public final var sizeColor: std.string {
257
+ @inline(__always)
258
+ get {
259
+ return std.string(self.__implementation.sizeColor)
260
+ }
261
+ @inline(__always)
262
+ set {
263
+ self.__implementation.sizeColor = String(newValue)
264
+ }
265
+ }
266
+
267
+ public final var priceFontSize: Double {
268
+ @inline(__always)
269
+ get {
270
+ return self.__implementation.priceFontSize
271
+ }
272
+ @inline(__always)
273
+ set {
274
+ self.__implementation.priceFontSize = newValue
275
+ }
276
+ }
277
+
278
+ public final var sizeFontSize: Double {
279
+ @inline(__always)
280
+ get {
281
+ return self.__implementation.sizeFontSize
282
+ }
283
+ @inline(__always)
284
+ set {
285
+ self.__implementation.sizeFontSize = newValue
286
+ }
287
+ }
288
+
289
+ public final var textInset: Double {
290
+ @inline(__always)
291
+ get {
292
+ return self.__implementation.textInset
293
+ }
294
+ @inline(__always)
295
+ set {
296
+ self.__implementation.textInset = newValue
297
+ }
298
+ }
299
+
300
+ public final var onRowPress: bridge.std__optional_std__function_void_double____rowIndex______ {
301
+ @inline(__always)
302
+ get {
303
+ return { () -> bridge.std__optional_std__function_void_double____rowIndex______ in
304
+ if let __unwrappedValue = self.__implementation.onRowPress {
305
+ return bridge.create_std__optional_std__function_void_double____rowIndex______({ () -> bridge.Func_void_double in
306
+ let __closureWrapper = Func_void_double(__unwrappedValue)
307
+ return bridge.create_Func_void_double(__closureWrapper.toUnsafe())
308
+ }())
309
+ } else {
310
+ return .init()
311
+ }
312
+ }()
313
+ }
314
+ @inline(__always)
315
+ set {
316
+ self.__implementation.onRowPress = { () -> ((_ rowIndex: Double) -> Void)? in
317
+ if bridge.has_value_std__optional_std__function_void_double____rowIndex______(newValue) {
318
+ let __unwrapped = bridge.get_std__optional_std__function_void_double____rowIndex______(newValue)
319
+ return { () -> (Double) -> Void in
320
+ let __wrappedFunction = bridge.wrap_Func_void_double(__unwrapped)
321
+ return { (__rowIndex: Double) -> Void in
322
+ __wrappedFunction.call(__rowIndex)
323
+ }
324
+ }()
325
+ } else {
326
+ return nil
327
+ }
328
+ }()
329
+ }
330
+ }
210
331
 
211
332
  // Methods
212
333
  public final func getView() -> UnsafeMutableRawPointer {
@@ -30,6 +30,22 @@ namespace margelo::nitro::perpdepthbar {
30
30
  prototype.registerHybridSetter("reducedMotion", &HybridPerpDepthBarsSpec::setReducedMotion);
31
31
  prototype.registerHybridGetter("epoch", &HybridPerpDepthBarsSpec::getEpoch);
32
32
  prototype.registerHybridSetter("epoch", &HybridPerpDepthBarsSpec::setEpoch);
33
+ prototype.registerHybridGetter("prices", &HybridPerpDepthBarsSpec::getPrices);
34
+ prototype.registerHybridSetter("prices", &HybridPerpDepthBarsSpec::setPrices);
35
+ prototype.registerHybridGetter("sizes", &HybridPerpDepthBarsSpec::getSizes);
36
+ prototype.registerHybridSetter("sizes", &HybridPerpDepthBarsSpec::setSizes);
37
+ prototype.registerHybridGetter("priceColor", &HybridPerpDepthBarsSpec::getPriceColor);
38
+ prototype.registerHybridSetter("priceColor", &HybridPerpDepthBarsSpec::setPriceColor);
39
+ prototype.registerHybridGetter("sizeColor", &HybridPerpDepthBarsSpec::getSizeColor);
40
+ prototype.registerHybridSetter("sizeColor", &HybridPerpDepthBarsSpec::setSizeColor);
41
+ prototype.registerHybridGetter("priceFontSize", &HybridPerpDepthBarsSpec::getPriceFontSize);
42
+ prototype.registerHybridSetter("priceFontSize", &HybridPerpDepthBarsSpec::setPriceFontSize);
43
+ prototype.registerHybridGetter("sizeFontSize", &HybridPerpDepthBarsSpec::getSizeFontSize);
44
+ prototype.registerHybridSetter("sizeFontSize", &HybridPerpDepthBarsSpec::setSizeFontSize);
45
+ prototype.registerHybridGetter("textInset", &HybridPerpDepthBarsSpec::getTextInset);
46
+ prototype.registerHybridSetter("textInset", &HybridPerpDepthBarsSpec::setTextInset);
47
+ prototype.registerHybridGetter("onRowPress", &HybridPerpDepthBarsSpec::getOnRowPress);
48
+ prototype.registerHybridSetter("onRowPress", &HybridPerpDepthBarsSpec::setOnRowPress);
33
49
  });
34
50
  }
35
51
 
@@ -17,6 +17,8 @@
17
17
 
18
18
  #include <vector>
19
19
  #include <string>
20
+ #include <functional>
21
+ #include <optional>
20
22
 
21
23
  namespace margelo::nitro::perpdepthbar {
22
24
 
@@ -61,6 +63,22 @@ namespace margelo::nitro::perpdepthbar {
61
63
  virtual void setReducedMotion(bool reducedMotion) = 0;
62
64
  virtual double getEpoch() = 0;
63
65
  virtual void setEpoch(double epoch) = 0;
66
+ virtual std::vector<std::string> getPrices() = 0;
67
+ virtual void setPrices(const std::vector<std::string>& prices) = 0;
68
+ virtual std::vector<std::string> getSizes() = 0;
69
+ virtual void setSizes(const std::vector<std::string>& sizes) = 0;
70
+ virtual std::string getPriceColor() = 0;
71
+ virtual void setPriceColor(const std::string& priceColor) = 0;
72
+ virtual std::string getSizeColor() = 0;
73
+ virtual void setSizeColor(const std::string& sizeColor) = 0;
74
+ virtual double getPriceFontSize() = 0;
75
+ virtual void setPriceFontSize(double priceFontSize) = 0;
76
+ virtual double getSizeFontSize() = 0;
77
+ virtual void setSizeFontSize(double sizeFontSize) = 0;
78
+ virtual double getTextInset() = 0;
79
+ virtual void setTextInset(double textInset) = 0;
80
+ virtual std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() = 0;
81
+ virtual void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) = 0;
64
82
 
65
83
  public:
66
84
  // Methods
@@ -105,6 +105,86 @@ namespace margelo::nitro::perpdepthbar::views {
105
105
  throw std::runtime_error(std::string("PerpDepthBars.epoch: ") + exc.what());
106
106
  }
107
107
  }()),
108
+ prices([&]() -> CachedProp<std::vector<std::string>> {
109
+ try {
110
+ const react::RawValue* rawValue = rawProps.at("prices", nullptr, nullptr);
111
+ if (rawValue == nullptr) return sourceProps.prices;
112
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
113
+ return CachedProp<std::vector<std::string>>::fromRawValue(*runtime, value, sourceProps.prices);
114
+ } catch (const std::exception& exc) {
115
+ throw std::runtime_error(std::string("PerpDepthBars.prices: ") + exc.what());
116
+ }
117
+ }()),
118
+ sizes([&]() -> CachedProp<std::vector<std::string>> {
119
+ try {
120
+ const react::RawValue* rawValue = rawProps.at("sizes", nullptr, nullptr);
121
+ if (rawValue == nullptr) return sourceProps.sizes;
122
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
123
+ return CachedProp<std::vector<std::string>>::fromRawValue(*runtime, value, sourceProps.sizes);
124
+ } catch (const std::exception& exc) {
125
+ throw std::runtime_error(std::string("PerpDepthBars.sizes: ") + exc.what());
126
+ }
127
+ }()),
128
+ priceColor([&]() -> CachedProp<std::string> {
129
+ try {
130
+ const react::RawValue* rawValue = rawProps.at("priceColor", nullptr, nullptr);
131
+ if (rawValue == nullptr) return sourceProps.priceColor;
132
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
133
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.priceColor);
134
+ } catch (const std::exception& exc) {
135
+ throw std::runtime_error(std::string("PerpDepthBars.priceColor: ") + exc.what());
136
+ }
137
+ }()),
138
+ sizeColor([&]() -> CachedProp<std::string> {
139
+ try {
140
+ const react::RawValue* rawValue = rawProps.at("sizeColor", nullptr, nullptr);
141
+ if (rawValue == nullptr) return sourceProps.sizeColor;
142
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
143
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.sizeColor);
144
+ } catch (const std::exception& exc) {
145
+ throw std::runtime_error(std::string("PerpDepthBars.sizeColor: ") + exc.what());
146
+ }
147
+ }()),
148
+ priceFontSize([&]() -> CachedProp<double> {
149
+ try {
150
+ const react::RawValue* rawValue = rawProps.at("priceFontSize", nullptr, nullptr);
151
+ if (rawValue == nullptr) return sourceProps.priceFontSize;
152
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
153
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.priceFontSize);
154
+ } catch (const std::exception& exc) {
155
+ throw std::runtime_error(std::string("PerpDepthBars.priceFontSize: ") + exc.what());
156
+ }
157
+ }()),
158
+ sizeFontSize([&]() -> CachedProp<double> {
159
+ try {
160
+ const react::RawValue* rawValue = rawProps.at("sizeFontSize", nullptr, nullptr);
161
+ if (rawValue == nullptr) return sourceProps.sizeFontSize;
162
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
163
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.sizeFontSize);
164
+ } catch (const std::exception& exc) {
165
+ throw std::runtime_error(std::string("PerpDepthBars.sizeFontSize: ") + exc.what());
166
+ }
167
+ }()),
168
+ textInset([&]() -> CachedProp<double> {
169
+ try {
170
+ const react::RawValue* rawValue = rawProps.at("textInset", nullptr, nullptr);
171
+ if (rawValue == nullptr) return sourceProps.textInset;
172
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
173
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.textInset);
174
+ } catch (const std::exception& exc) {
175
+ throw std::runtime_error(std::string("PerpDepthBars.textInset: ") + exc.what());
176
+ }
177
+ }()),
178
+ onRowPress([&]() -> CachedProp<std::optional<std::function<void(double /* rowIndex */)>>> {
179
+ try {
180
+ const react::RawValue* rawValue = rawProps.at("onRowPress", nullptr, nullptr);
181
+ if (rawValue == nullptr) return sourceProps.onRowPress;
182
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
183
+ return CachedProp<std::optional<std::function<void(double /* rowIndex */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onRowPress);
184
+ } catch (const std::exception& exc) {
185
+ throw std::runtime_error(std::string("PerpDepthBars.onRowPress: ") + exc.what());
186
+ }
187
+ }()),
108
188
  hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridPerpDepthBarsSpec>& /* ref */)>>> {
109
189
  try {
110
190
  const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
@@ -126,6 +206,14 @@ namespace margelo::nitro::perpdepthbar::views {
126
206
  origin(other.origin),
127
207
  reducedMotion(other.reducedMotion),
128
208
  epoch(other.epoch),
209
+ prices(other.prices),
210
+ sizes(other.sizes),
211
+ priceColor(other.priceColor),
212
+ sizeColor(other.sizeColor),
213
+ priceFontSize(other.priceFontSize),
214
+ sizeFontSize(other.sizeFontSize),
215
+ textInset(other.textInset),
216
+ onRowPress(other.onRowPress),
129
217
  hybridRef(other.hybridRef) { }
130
218
 
131
219
  bool HybridPerpDepthBarsProps::filterObjectKeys(const std::string& propName) {
@@ -138,6 +226,14 @@ namespace margelo::nitro::perpdepthbar::views {
138
226
  case hashString("origin"): return true;
139
227
  case hashString("reducedMotion"): return true;
140
228
  case hashString("epoch"): return true;
229
+ case hashString("prices"): return true;
230
+ case hashString("sizes"): return true;
231
+ case hashString("priceColor"): return true;
232
+ case hashString("sizeColor"): return true;
233
+ case hashString("priceFontSize"): return true;
234
+ case hashString("sizeFontSize"): return true;
235
+ case hashString("textInset"): return true;
236
+ case hashString("onRowPress"): return true;
141
237
  case hashString("hybridRef"): return true;
142
238
  default: return false;
143
239
  }
@@ -18,10 +18,10 @@
18
18
 
19
19
  #include <vector>
20
20
  #include <string>
21
- #include <memory>
22
- #include "HybridPerpDepthBarsSpec.hpp"
23
21
  #include <functional>
24
22
  #include <optional>
23
+ #include <memory>
24
+ #include "HybridPerpDepthBarsSpec.hpp"
25
25
 
26
26
  namespace margelo::nitro::perpdepthbar::views {
27
27
 
@@ -52,6 +52,14 @@ namespace margelo::nitro::perpdepthbar::views {
52
52
  CachedProp<std::string> origin;
53
53
  CachedProp<bool> reducedMotion;
54
54
  CachedProp<double> epoch;
55
+ CachedProp<std::vector<std::string>> prices;
56
+ CachedProp<std::vector<std::string>> sizes;
57
+ CachedProp<std::string> priceColor;
58
+ CachedProp<std::string> sizeColor;
59
+ CachedProp<double> priceFontSize;
60
+ CachedProp<double> sizeFontSize;
61
+ CachedProp<double> textInset;
62
+ CachedProp<std::optional<std::function<void(double /* rowIndex */)>>> onRowPress;
55
63
  CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridPerpDepthBarsSpec>& /* ref */)>>> hybridRef;
56
64
 
57
65
  private:
@@ -12,6 +12,14 @@
12
12
  "origin": true,
13
13
  "reducedMotion": true,
14
14
  "epoch": true,
15
+ "prices": true,
16
+ "sizes": true,
17
+ "priceColor": true,
18
+ "sizeColor": true,
19
+ "priceFontSize": true,
20
+ "sizeFontSize": true,
21
+ "textInset": true,
22
+ "onRowPress": true,
15
23
  "hybridRef": true
16
24
  }
17
25
  }
@@ -30,6 +30,26 @@ export interface PerpDepthBarsProps extends HybridViewProps {
30
30
  * empty<->full so native snaps to the new values WITHOUT animating.
31
31
  */
32
32
  epoch: number;
33
+ /** Formatted price string per row (e.g. "1981.4"). */
34
+ prices: string[];
35
+ /** Formatted size string per row (e.g. "389.04"). */
36
+ sizes: string[];
37
+ /** Price text color: hex or rgba()/rgb(). */
38
+ priceColor: string;
39
+ /** Size text color: hex or rgba()/rgb(). */
40
+ sizeColor: string;
41
+ /** Price text font size in points. */
42
+ priceFontSize: number;
43
+ /** Size text font size in points. */
44
+ sizeFontSize: number;
45
+ /** Horizontal text inset in points (price padding-left, size padding-right). */
46
+ textInset: number;
47
+ /**
48
+ * Fired natively when a row is tapped. `rowIndex` is the 0-based row
49
+ * (top→bottom, parallel to `percents`/`prices`/`sizes`). The view handles
50
+ * the touch itself — no RN overlay / JS hit-testing needed.
51
+ */
52
+ onRowPress?: (rowIndex: number) => void;
33
53
  }
34
54
  export interface PerpDepthBarsMethods extends HybridViewMethods {
35
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PerpDepthBars.nitro.d.ts","sourceRoot":"","sources":["../../../src/PerpDepthBars.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,aAAa,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;CAAG;AAElE,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"PerpDepthBars.nitro.d.ts","sourceRoot":"","sources":["../../../src/PerpDepthBars.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,aAAa,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAOd,sDAAsD;IACtD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,qDAAqD;IACrD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;CAAG;AAElE,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
@@ -1,6 +1,12 @@
1
1
  import type { PerpDepthBarsMethods, PerpDepthBarsProps } from './PerpDepthBars.nitro';
2
2
  import type { PerpSideRatioMethods, PerpSideRatioProps } from './PerpSideRatio.nitro';
3
3
  export type { PerpDepthBarsMethods, PerpDepthBarsProps, PerpSideRatioMethods, PerpSideRatioProps, };
4
- export declare const PerpDepthBarsView: import("react-native-nitro-modules").ReactNativeView<PerpDepthBarsProps, PerpDepthBarsMethods>;
4
+ /**
5
+ * Thin wrapper so consumers pass a plain `onRowPress` function. Nitro view
6
+ * callbacks must be wrapped with `callback(...)` to cross the JSI boundary;
7
+ * we encapsulate that here (with a ref so the underlying callback stays
8
+ * stable across re-renders) instead of leaking it to every call site.
9
+ */
10
+ export declare function PerpDepthBarsView({ onRowPress, ...props }: PerpDepthBarsProps): import("react/jsx-runtime").JSX.Element;
5
11
  export declare const PerpSideRatioView: import("react-native-nitro-modules").ReactNativeView<PerpSideRatioProps, PerpSideRatioMethods>;
6
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAK/B,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,CAAC;AAEF,eAAO,MAAM,iBAAiB,gGAGe,CAAC;AAE9C,eAAO,MAAM,iBAAiB,gGAGe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAK/B,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,CAAC;AAOF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,GAAG,KAAK,EACT,EAAE,kBAAkB,2CAcpB;AAED,eAAO,MAAM,iBAAiB,gGAGe,CAAC"}
@@ -0,0 +1,75 @@
1
+ ///
2
+ /// JFunc_void_double.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 <fbjni/fbjni.h>
11
+ #include <functional>
12
+
13
+ #include <functional>
14
+ #include <NitroModules/JNICallable.hpp>
15
+
16
+ namespace margelo::nitro::perpdepthbar {
17
+
18
+ using namespace facebook;
19
+
20
+ /**
21
+ * Represents the Java/Kotlin callback `(rowIndex: Double) -> Unit`.
22
+ * This can be passed around between C++ and Java/Kotlin.
23
+ */
24
+ struct JFunc_void_double: public jni::JavaClass<JFunc_void_double> {
25
+ public:
26
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/perpdepthbar/Func_void_double;";
27
+
28
+ public:
29
+ /**
30
+ * Invokes the function this `JFunc_void_double` instance holds through JNI.
31
+ */
32
+ void invoke(double rowIndex) const {
33
+ static const auto method = javaClassStatic()->getMethod<void(double /* rowIndex */)>("invoke");
34
+ method(self(), rowIndex);
35
+ }
36
+ };
37
+
38
+ /**
39
+ * An implementation of Func_void_double that is backed by a C++ implementation (using `std::function<...>`)
40
+ */
41
+ class JFunc_void_double_cxx final: public jni::HybridClass<JFunc_void_double_cxx, JFunc_void_double> {
42
+ public:
43
+ static jni::local_ref<JFunc_void_double::javaobject> fromCpp(const std::function<void(double /* rowIndex */)>& func) {
44
+ return JFunc_void_double_cxx::newObjectCxxArgs(func);
45
+ }
46
+
47
+ public:
48
+ /**
49
+ * Invokes the C++ `std::function<...>` this `JFunc_void_double_cxx` instance holds.
50
+ */
51
+ void invoke_cxx(double rowIndex) {
52
+ _func(rowIndex);
53
+ }
54
+
55
+ public:
56
+ [[nodiscard]]
57
+ inline const std::function<void(double /* rowIndex */)>& getFunction() const {
58
+ return _func;
59
+ }
60
+
61
+ public:
62
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/perpdepthbar/Func_void_double_cxx;";
63
+ static void registerNatives() {
64
+ registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_double_cxx::invoke_cxx)});
65
+ }
66
+
67
+ private:
68
+ explicit JFunc_void_double_cxx(const std::function<void(double /* rowIndex */)>& func): _func(func) { }
69
+
70
+ private:
71
+ friend HybridBase;
72
+ std::function<void(double /* rowIndex */)> _func;
73
+ };
74
+
75
+ } // namespace margelo::nitro::perpdepthbar
@@ -11,6 +11,10 @@
11
11
 
12
12
  #include <vector>
13
13
  #include <string>
14
+ #include <functional>
15
+ #include <optional>
16
+ #include "JFunc_void_double.hpp"
17
+ #include <NitroModules/JNICallable.hpp>
14
18
 
15
19
  namespace margelo::nitro::perpdepthbar {
16
20
 
@@ -123,6 +127,122 @@ namespace margelo::nitro::perpdepthbar {
123
127
  static const auto method = javaClassStatic()->getMethod<void(double /* epoch */)>("setEpoch");
124
128
  method(_javaPart, epoch);
125
129
  }
130
+ std::vector<std::string> JHybridPerpDepthBarsSpec::getPrices() {
131
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<jni::JString>>()>("getPrices");
132
+ auto __result = method(_javaPart);
133
+ return [&]() {
134
+ size_t __size = __result->size();
135
+ std::vector<std::string> __vector;
136
+ __vector.reserve(__size);
137
+ for (size_t __i = 0; __i < __size; __i++) {
138
+ auto __element = __result->getElement(__i);
139
+ __vector.push_back(__element->toStdString());
140
+ }
141
+ return __vector;
142
+ }();
143
+ }
144
+ void JHybridPerpDepthBarsSpec::setPrices(const std::vector<std::string>& prices) {
145
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* prices */)>("setPrices");
146
+ method(_javaPart, [&]() {
147
+ size_t __size = prices.size();
148
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
149
+ for (size_t __i = 0; __i < __size; __i++) {
150
+ const auto& __element = prices[__i];
151
+ auto __elementJni = jni::make_jstring(__element);
152
+ __array->setElement(__i, *__elementJni);
153
+ }
154
+ return __array;
155
+ }());
156
+ }
157
+ std::vector<std::string> JHybridPerpDepthBarsSpec::getSizes() {
158
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<jni::JString>>()>("getSizes");
159
+ auto __result = method(_javaPart);
160
+ return [&]() {
161
+ size_t __size = __result->size();
162
+ std::vector<std::string> __vector;
163
+ __vector.reserve(__size);
164
+ for (size_t __i = 0; __i < __size; __i++) {
165
+ auto __element = __result->getElement(__i);
166
+ __vector.push_back(__element->toStdString());
167
+ }
168
+ return __vector;
169
+ }();
170
+ }
171
+ void JHybridPerpDepthBarsSpec::setSizes(const std::vector<std::string>& sizes) {
172
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* sizes */)>("setSizes");
173
+ method(_javaPart, [&]() {
174
+ size_t __size = sizes.size();
175
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
176
+ for (size_t __i = 0; __i < __size; __i++) {
177
+ const auto& __element = sizes[__i];
178
+ auto __elementJni = jni::make_jstring(__element);
179
+ __array->setElement(__i, *__elementJni);
180
+ }
181
+ return __array;
182
+ }());
183
+ }
184
+ std::string JHybridPerpDepthBarsSpec::getPriceColor() {
185
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getPriceColor");
186
+ auto __result = method(_javaPart);
187
+ return __result->toStdString();
188
+ }
189
+ void JHybridPerpDepthBarsSpec::setPriceColor(const std::string& priceColor) {
190
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* priceColor */)>("setPriceColor");
191
+ method(_javaPart, jni::make_jstring(priceColor));
192
+ }
193
+ std::string JHybridPerpDepthBarsSpec::getSizeColor() {
194
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getSizeColor");
195
+ auto __result = method(_javaPart);
196
+ return __result->toStdString();
197
+ }
198
+ void JHybridPerpDepthBarsSpec::setSizeColor(const std::string& sizeColor) {
199
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* sizeColor */)>("setSizeColor");
200
+ method(_javaPart, jni::make_jstring(sizeColor));
201
+ }
202
+ double JHybridPerpDepthBarsSpec::getPriceFontSize() {
203
+ static const auto method = javaClassStatic()->getMethod<double()>("getPriceFontSize");
204
+ auto __result = method(_javaPart);
205
+ return __result;
206
+ }
207
+ void JHybridPerpDepthBarsSpec::setPriceFontSize(double priceFontSize) {
208
+ static const auto method = javaClassStatic()->getMethod<void(double /* priceFontSize */)>("setPriceFontSize");
209
+ method(_javaPart, priceFontSize);
210
+ }
211
+ double JHybridPerpDepthBarsSpec::getSizeFontSize() {
212
+ static const auto method = javaClassStatic()->getMethod<double()>("getSizeFontSize");
213
+ auto __result = method(_javaPart);
214
+ return __result;
215
+ }
216
+ void JHybridPerpDepthBarsSpec::setSizeFontSize(double sizeFontSize) {
217
+ static const auto method = javaClassStatic()->getMethod<void(double /* sizeFontSize */)>("setSizeFontSize");
218
+ method(_javaPart, sizeFontSize);
219
+ }
220
+ double JHybridPerpDepthBarsSpec::getTextInset() {
221
+ static const auto method = javaClassStatic()->getMethod<double()>("getTextInset");
222
+ auto __result = method(_javaPart);
223
+ return __result;
224
+ }
225
+ void JHybridPerpDepthBarsSpec::setTextInset(double textInset) {
226
+ static const auto method = javaClassStatic()->getMethod<void(double /* textInset */)>("setTextInset");
227
+ method(_javaPart, textInset);
228
+ }
229
+ std::optional<std::function<void(double /* rowIndex */)>> JHybridPerpDepthBarsSpec::getOnRowPress() {
230
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_double::javaobject>()>("getOnRowPress_cxx");
231
+ auto __result = method(_javaPart);
232
+ return __result != nullptr ? std::make_optional([&]() -> std::function<void(double /* rowIndex */)> {
233
+ if (__result->isInstanceOf(JFunc_void_double_cxx::javaClassStatic())) [[likely]] {
234
+ auto downcast = jni::static_ref_cast<JFunc_void_double_cxx::javaobject>(__result);
235
+ return downcast->cthis()->getFunction();
236
+ } else {
237
+ auto __resultRef = jni::make_global(__result);
238
+ return JNICallable<JFunc_void_double, void(double)>(std::move(__resultRef));
239
+ }
240
+ }()) : std::nullopt;
241
+ }
242
+ void JHybridPerpDepthBarsSpec::setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) {
243
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_double::javaobject> /* onRowPress */)>("setOnRowPress_cxx");
244
+ method(_javaPart, onRowPress.has_value() ? JFunc_void_double_cxx::fromCpp(onRowPress.value()) : nullptr);
245
+ }
126
246
 
127
247
  // Methods
128
248