@onekeyfe/react-native-perp-depth-bar 3.0.48 → 3.0.52

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 (81) hide show
  1. package/android/src/main/java/com/margelo/nitro/perpdepthbar/HybridPerpDepthBars.kt +121 -15
  2. package/android/src/main/java/com/margelo/nitro/perpdepthbar/HybridPerpSideRatio.kt +30 -0
  3. package/ios/HybridPerpDepthBars.swift +84 -5
  4. package/ios/HybridPerpSideRatio.swift +19 -1
  5. package/ios/PerpColorParser.swift +10 -1
  6. package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +47 -1
  7. package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +6 -1
  8. package/lib/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.cpp +4 -1
  9. package/lib/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.hpp +1 -1
  10. package/lib/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
  11. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +19 -0
  12. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpSideRatioSpec.kt +3 -1
  13. package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +11 -0
  14. package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +3 -0
  15. package/lib/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +29 -2
  16. package/lib/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
  17. package/lib/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
  18. package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +4 -1
  19. package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +44 -0
  20. package/lib/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec.swift +1 -1
  21. package/lib/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec_cxx.swift +11 -0
  22. package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +6 -0
  23. package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +7 -1
  24. package/lib/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.cpp +1 -0
  25. package/lib/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.hpp +1 -1
  26. package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
  27. package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
  28. package/lib/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
  29. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +47 -1
  30. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +6 -1
  31. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.cpp +4 -1
  32. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.hpp +1 -1
  33. package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
  34. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +19 -0
  35. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpSideRatioSpec.kt +3 -1
  36. package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +11 -0
  37. package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +3 -0
  38. package/lib/nitrogen/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +29 -2
  39. package/lib/nitrogen/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
  40. package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
  41. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +4 -1
  42. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +44 -0
  43. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec.swift +1 -1
  44. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec_cxx.swift +11 -0
  45. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +6 -0
  46. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +7 -1
  47. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.cpp +1 -0
  48. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.hpp +1 -1
  49. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
  50. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
  51. package/lib/nitrogen/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
  52. package/lib/typescript/src/PerpDepthBars.nitro.d.ts +81 -3
  53. package/lib/typescript/src/PerpDepthBars.nitro.d.ts.map +1 -1
  54. package/lib/typescript/src/PerpSideRatio.nitro.d.ts +25 -2
  55. package/lib/typescript/src/PerpSideRatio.nitro.d.ts.map +1 -1
  56. package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +47 -1
  57. package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +6 -1
  58. package/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.cpp +4 -1
  59. package/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.hpp +1 -1
  60. package/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +19 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpSideRatioSpec.kt +3 -1
  63. package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +11 -0
  64. package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +3 -0
  65. package/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +29 -2
  66. package/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
  67. package/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
  68. package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +4 -1
  69. package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +44 -0
  70. package/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec.swift +1 -1
  71. package/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec_cxx.swift +11 -0
  72. package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +6 -0
  73. package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +7 -1
  74. package/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.cpp +1 -0
  75. package/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.hpp +1 -1
  76. package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
  77. package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
  78. package/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
  79. package/package.json +1 -1
  80. package/src/PerpDepthBars.nitro.ts +85 -9
  81. package/src/PerpSideRatio.nitro.ts +27 -3
@@ -109,7 +109,12 @@ namespace margelo::nitro::perpdepthbar {
109
109
 
110
110
  public:
111
111
  // Methods
112
-
112
+ inline void setRatio(double bidPercentage, double askPercentage) override {
113
+ auto __result = _swiftPart.setRatio(std::forward<decltype(bidPercentage)>(bidPercentage), std::forward<decltype(askPercentage)>(askPercentage));
114
+ if (__result.hasError()) [[unlikely]] {
115
+ std::rethrow_exception(__result.error());
116
+ }
117
+ }
113
118
 
114
119
  private:
115
120
  PerpDepthBar::HybridPerpSideRatioSpec_cxx _swiftPart;
@@ -146,6 +146,16 @@ using namespace margelo::nitro::perpdepthbar::views;
146
146
  swiftPart.setTextInset(newViewProps.textInset.value);
147
147
  newViewProps.textInset.isDirty = false;
148
148
  }
149
+ // placeholderText: string
150
+ if (newViewProps.placeholderText.isDirty) {
151
+ swiftPart.setPlaceholderText(newViewProps.placeholderText.value);
152
+ newViewProps.placeholderText.isDirty = false;
153
+ }
154
+ // placeholderRows: number
155
+ if (newViewProps.placeholderRows.isDirty) {
156
+ swiftPart.setPlaceholderRows(newViewProps.placeholderRows.value);
157
+ newViewProps.placeholderRows.isDirty = false;
158
+ }
149
159
  // onRowPress: optional
150
160
  if (newViewProps.onRowPress.isDirty) {
151
161
  swiftPart.setOnRowPress(newViewProps.onRowPress.value);
@@ -26,10 +26,13 @@ public protocol HybridPerpDepthBarsSpec_protocol: HybridObject, HybridView {
26
26
  var priceFontSize: Double { get set }
27
27
  var sizeFontSize: Double { get set }
28
28
  var textInset: Double { get set }
29
+ var placeholderText: String { get set }
30
+ var placeholderRows: Double { get set }
29
31
  var onRowPress: ((_ rowIndex: Double) -> Void)? { get set }
30
32
 
31
33
  // Methods
32
-
34
+ func setDepth(buffer: ArrayBuffer) throws -> Void
35
+ func setText(prices: [String], sizes: [String]) throws -> Void
33
36
  }
34
37
 
35
38
  public extension HybridPerpDepthBarsSpec_protocol {
@@ -297,6 +297,28 @@ open class HybridPerpDepthBarsSpec_cxx {
297
297
  }
298
298
  }
299
299
 
300
+ public final var placeholderText: std.string {
301
+ @inline(__always)
302
+ get {
303
+ return std.string(self.__implementation.placeholderText)
304
+ }
305
+ @inline(__always)
306
+ set {
307
+ self.__implementation.placeholderText = String(newValue)
308
+ }
309
+ }
310
+
311
+ public final var placeholderRows: Double {
312
+ @inline(__always)
313
+ get {
314
+ return self.__implementation.placeholderRows
315
+ }
316
+ @inline(__always)
317
+ set {
318
+ self.__implementation.placeholderRows = newValue
319
+ }
320
+ }
321
+
300
322
  public final var onRowPress: bridge.std__optional_std__function_void_double____rowIndex______ {
301
323
  @inline(__always)
302
324
  get {
@@ -330,6 +352,28 @@ open class HybridPerpDepthBarsSpec_cxx {
330
352
  }
331
353
 
332
354
  // Methods
355
+ @inline(__always)
356
+ public final func setDepth(buffer: ArrayBuffer) -> bridge.Result_void_ {
357
+ do {
358
+ try self.__implementation.setDepth(buffer: buffer)
359
+ return bridge.create_Result_void_()
360
+ } catch (let __error) {
361
+ let __exceptionPtr = __error.toCpp()
362
+ return bridge.create_Result_void_(__exceptionPtr)
363
+ }
364
+ }
365
+
366
+ @inline(__always)
367
+ public final func setText(prices: bridge.std__vector_std__string_, sizes: bridge.std__vector_std__string_) -> bridge.Result_void_ {
368
+ do {
369
+ try self.__implementation.setText(prices: prices.map({ __item in String(__item) }), sizes: sizes.map({ __item in String(__item) }))
370
+ return bridge.create_Result_void_()
371
+ } catch (let __error) {
372
+ let __exceptionPtr = __error.toCpp()
373
+ return bridge.create_Result_void_(__exceptionPtr)
374
+ }
375
+ }
376
+
333
377
  public final func getView() -> UnsafeMutableRawPointer {
334
378
  return Unmanaged.passRetained(__implementation.view).toOpaque()
335
379
  }
@@ -21,7 +21,7 @@ public protocol HybridPerpSideRatioSpec_protocol: HybridObject, HybridView {
21
21
  var reducedMotion: Bool { get set }
22
22
 
23
23
  // Methods
24
-
24
+ func setRatio(bidPercentage: Double, askPercentage: Double) throws -> Void
25
25
  }
26
26
 
27
27
  public extension HybridPerpSideRatioSpec_protocol {
@@ -203,6 +203,17 @@ open class HybridPerpSideRatioSpec_cxx {
203
203
  }
204
204
 
205
205
  // Methods
206
+ @inline(__always)
207
+ public final func setRatio(bidPercentage: Double, askPercentage: Double) -> bridge.Result_void_ {
208
+ do {
209
+ try self.__implementation.setRatio(bidPercentage: bidPercentage, askPercentage: askPercentage)
210
+ return bridge.create_Result_void_()
211
+ } catch (let __error) {
212
+ let __exceptionPtr = __error.toCpp()
213
+ return bridge.create_Result_void_(__exceptionPtr)
214
+ }
215
+ }
216
+
206
217
  public final func getView() -> UnsafeMutableRawPointer {
207
218
  return Unmanaged.passRetained(__implementation.view).toOpaque()
208
219
  }
@@ -44,8 +44,14 @@ namespace margelo::nitro::perpdepthbar {
44
44
  prototype.registerHybridSetter("sizeFontSize", &HybridPerpDepthBarsSpec::setSizeFontSize);
45
45
  prototype.registerHybridGetter("textInset", &HybridPerpDepthBarsSpec::getTextInset);
46
46
  prototype.registerHybridSetter("textInset", &HybridPerpDepthBarsSpec::setTextInset);
47
+ prototype.registerHybridGetter("placeholderText", &HybridPerpDepthBarsSpec::getPlaceholderText);
48
+ prototype.registerHybridSetter("placeholderText", &HybridPerpDepthBarsSpec::setPlaceholderText);
49
+ prototype.registerHybridGetter("placeholderRows", &HybridPerpDepthBarsSpec::getPlaceholderRows);
50
+ prototype.registerHybridSetter("placeholderRows", &HybridPerpDepthBarsSpec::setPlaceholderRows);
47
51
  prototype.registerHybridGetter("onRowPress", &HybridPerpDepthBarsSpec::getOnRowPress);
48
52
  prototype.registerHybridSetter("onRowPress", &HybridPerpDepthBarsSpec::setOnRowPress);
53
+ prototype.registerHybridMethod("setDepth", &HybridPerpDepthBarsSpec::setDepth);
54
+ prototype.registerHybridMethod("setText", &HybridPerpDepthBarsSpec::setText);
49
55
  });
50
56
  }
51
57
 
@@ -19,6 +19,7 @@
19
19
  #include <string>
20
20
  #include <functional>
21
21
  #include <optional>
22
+ #include <NitroModules/ArrayBuffer.hpp>
22
23
 
23
24
  namespace margelo::nitro::perpdepthbar {
24
25
 
@@ -77,12 +78,17 @@ namespace margelo::nitro::perpdepthbar {
77
78
  virtual void setSizeFontSize(double sizeFontSize) = 0;
78
79
  virtual double getTextInset() = 0;
79
80
  virtual void setTextInset(double textInset) = 0;
81
+ virtual std::string getPlaceholderText() = 0;
82
+ virtual void setPlaceholderText(const std::string& placeholderText) = 0;
83
+ virtual double getPlaceholderRows() = 0;
84
+ virtual void setPlaceholderRows(double placeholderRows) = 0;
80
85
  virtual std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() = 0;
81
86
  virtual void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) = 0;
82
87
 
83
88
  public:
84
89
  // Methods
85
-
90
+ virtual void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) = 0;
91
+ virtual void setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) = 0;
86
92
 
87
93
  protected:
88
94
  // Hybrid Setup
@@ -30,6 +30,7 @@ namespace margelo::nitro::perpdepthbar {
30
30
  prototype.registerHybridSetter("gap", &HybridPerpSideRatioSpec::setGap);
31
31
  prototype.registerHybridGetter("reducedMotion", &HybridPerpSideRatioSpec::getReducedMotion);
32
32
  prototype.registerHybridSetter("reducedMotion", &HybridPerpSideRatioSpec::setReducedMotion);
33
+ prototype.registerHybridMethod("setRatio", &HybridPerpSideRatioSpec::setRatio);
33
34
  });
34
35
  }
35
36
 
@@ -63,7 +63,7 @@ namespace margelo::nitro::perpdepthbar {
63
63
 
64
64
  public:
65
65
  // Methods
66
-
66
+ virtual void setRatio(double bidPercentage, double askPercentage) = 0;
67
67
 
68
68
  protected:
69
69
  // Hybrid Setup
@@ -175,6 +175,26 @@ namespace margelo::nitro::perpdepthbar::views {
175
175
  throw std::runtime_error(std::string("PerpDepthBars.textInset: ") + exc.what());
176
176
  }
177
177
  }()),
178
+ placeholderText([&]() -> CachedProp<std::string> {
179
+ try {
180
+ const react::RawValue* rawValue = rawProps.at("placeholderText", nullptr, nullptr);
181
+ if (rawValue == nullptr) return sourceProps.placeholderText;
182
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
183
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.placeholderText);
184
+ } catch (const std::exception& exc) {
185
+ throw std::runtime_error(std::string("PerpDepthBars.placeholderText: ") + exc.what());
186
+ }
187
+ }()),
188
+ placeholderRows([&]() -> CachedProp<double> {
189
+ try {
190
+ const react::RawValue* rawValue = rawProps.at("placeholderRows", nullptr, nullptr);
191
+ if (rawValue == nullptr) return sourceProps.placeholderRows;
192
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
193
+ return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.placeholderRows);
194
+ } catch (const std::exception& exc) {
195
+ throw std::runtime_error(std::string("PerpDepthBars.placeholderRows: ") + exc.what());
196
+ }
197
+ }()),
178
198
  onRowPress([&]() -> CachedProp<std::optional<std::function<void(double /* rowIndex */)>>> {
179
199
  try {
180
200
  const react::RawValue* rawValue = rawProps.at("onRowPress", nullptr, nullptr);
@@ -213,6 +233,8 @@ namespace margelo::nitro::perpdepthbar::views {
213
233
  priceFontSize(other.priceFontSize),
214
234
  sizeFontSize(other.sizeFontSize),
215
235
  textInset(other.textInset),
236
+ placeholderText(other.placeholderText),
237
+ placeholderRows(other.placeholderRows),
216
238
  onRowPress(other.onRowPress),
217
239
  hybridRef(other.hybridRef) { }
218
240
 
@@ -233,6 +255,8 @@ namespace margelo::nitro::perpdepthbar::views {
233
255
  case hashString("priceFontSize"): return true;
234
256
  case hashString("sizeFontSize"): return true;
235
257
  case hashString("textInset"): return true;
258
+ case hashString("placeholderText"): return true;
259
+ case hashString("placeholderRows"): return true;
236
260
  case hashString("onRowPress"): return true;
237
261
  case hashString("hybridRef"): return true;
238
262
  default: return false;
@@ -59,6 +59,8 @@ namespace margelo::nitro::perpdepthbar::views {
59
59
  CachedProp<double> priceFontSize;
60
60
  CachedProp<double> sizeFontSize;
61
61
  CachedProp<double> textInset;
62
+ CachedProp<std::string> placeholderText;
63
+ CachedProp<double> placeholderRows;
62
64
  CachedProp<std::optional<std::function<void(double /* rowIndex */)>>> onRowPress;
63
65
  CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridPerpDepthBarsSpec>& /* ref */)>>> hybridRef;
64
66
 
@@ -19,6 +19,8 @@
19
19
  "priceFontSize": true,
20
20
  "sizeFontSize": true,
21
21
  "textInset": true,
22
+ "placeholderText": true,
23
+ "placeholderRows": true,
22
24
  "onRowPress": true,
23
25
  "hybridRef": true
24
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-perp-depth-bar",
3
- "version": "3.0.48",
3
+ "version": "3.0.52",
4
4
  "description": "react-native-perp-depth-bar",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -16,7 +16,17 @@ import type {
16
16
  * All values are in points (DIP); the native side quantizes to physical pixels.
17
17
  */
18
18
  export interface PerpDepthBarsProps extends HybridViewProps {
19
- /** Depth percentage per row, 0..100. Length == number of rows on this side. */
19
+ /**
20
+ * Depth percentage per row, 0..100. Length == number of rows on this side.
21
+ *
22
+ * INITIAL VALUE ONLY when using the imperative path. The first
23
+ * `setDepth(buffer)` call switches the view into imperative mode; from then on
24
+ * this prop is IGNORED on every prop-update transaction (so unrelated
25
+ * high-frequency prop commits like `prices`/`sizes` can't wipe the bars —
26
+ * REACT-NATIVE-1JZ). For high-frequency depth updates ALWAYS call `setDepth`;
27
+ * do NOT keep writing this prop at tick rate. Callers that never call
28
+ * `setDepth` may drive the bars purely through this prop (each write retargets).
29
+ */
20
30
  percents: number[];
21
31
  /** Row height in points (matches the sibling RN text row height). */
22
32
  rowHeight: number;
@@ -36,14 +46,28 @@ export interface PerpDepthBarsProps extends HybridViewProps {
36
46
  */
37
47
  epoch: number;
38
48
 
39
- // --- Per-row text (optional). When `prices`/`sizes` are empty the view
40
- // renders bars only (backward compatible). When provided they are drawn
41
- // natively per row price left-aligned, size right-aligned, vertically
42
- // centred so the order-book ladder needs NO sibling RN <Text> rows.
43
- // Each array is parallel to `percents` (same length / order).
44
- /** Formatted price string per row (e.g. "1981.4"). */
49
+ /**
50
+ * Per-row price text, parallel to `percents` (same length / order). Drawn
51
+ * natively per row (price left-aligned), so the order-book ladder needs NO
52
+ * sibling RN <Text> rows. Empty => the view renders bars only.
53
+ *
54
+ * INITIAL VALUE ONLY for high-frequency callers: the first `setText` call
55
+ * switches the text layer into imperative mode and this prop is then IGNORED on
56
+ * every prop-update transaction. For high-frequency text updates ALWAYS call
57
+ * `setText`; do NOT keep writing this prop at tick rate (string-array prop
58
+ * commits are the heaviest part of the Fabric props + JSI path — exactly what
59
+ * REACT-NATIVE-1JZ avoids). Callers that update infrequently may drive it
60
+ * purely through this prop.
61
+ */
45
62
  prices: string[];
46
- /** Formatted size string per row (e.g. "389.04"). */
63
+ /**
64
+ * Per-row size text, parallel to `percents`. Drawn natively per row (size
65
+ * right-aligned). Empty => bars only.
66
+ *
67
+ * INITIAL VALUE ONLY for high-frequency callers: update via `setText`; this
68
+ * prop is IGNORED once `setText` has been called (see `prices` —
69
+ * REACT-NATIVE-1JZ).
70
+ */
47
71
  sizes: string[];
48
72
  /** Price text color: hex or rgba()/rgb(). */
49
73
  priceColor: string;
@@ -56,6 +80,24 @@ export interface PerpDepthBarsProps extends HybridViewProps {
56
80
  /** Horizontal text inset in points (price padding-left, size padding-right). */
57
81
  textInset: number;
58
82
 
83
+ /**
84
+ * Per-row placeholder text drawn while the column has NO real data (no rows
85
+ * from `percents`/`setDepth` and no `prices`/`sizes`/`setText`), e.g. "--".
86
+ * Empty string disables the placeholder. This replaces any RN skeleton/overlay:
87
+ * the view draws the placeholder itself, then atomically swaps to real numbers
88
+ * the moment data lands — so there is never a blank frame between the two
89
+ * (the old overlay approach removed the JS skeleton a few frames before the
90
+ * native view had painted, flashing blank). Drawn in `priceColor` (left) and
91
+ * `sizeColor` (right); no bar fill.
92
+ */
93
+ placeholderText: string;
94
+ /**
95
+ * How many placeholder rows to draw when `placeholderText` is shown. Match the
96
+ * order book's rows-per-side so the column reserves a stable height before any
97
+ * data arrives. Ignored once real data is present.
98
+ */
99
+ placeholderRows: number;
100
+
59
101
  /**
60
102
  * Fired natively when a row is tapped. `rowIndex` is the 0-based row
61
103
  * (top→bottom, parallel to `percents`/`prices`/`sizes`). The view handles
@@ -64,6 +106,40 @@ export interface PerpDepthBarsProps extends HybridViewProps {
64
106
  onRowPress?: (rowIndex: number) => void;
65
107
  }
66
108
 
67
- export interface PerpDepthBarsMethods extends HybridViewMethods {}
109
+ export interface PerpDepthBarsMethods extends HybridViewMethods {
110
+ /**
111
+ * Imperatively update the per-row depth percentages, bypassing the
112
+ * high-frequency `percents` prop write path (and its props/JSICache lock
113
+ * contention — REACT-NATIVE-1JZ).
114
+ *
115
+ * `buffer` is a packed `Float32Array` (little-endian): one float per row,
116
+ * each the row's depth percentage with the SAME semantics as the
117
+ * `percents: number[]` prop (0..100, clamped natively exactly like the prop
118
+ * setter). Row count == `buffer.byteLength / 4`. The native side rebuilds
119
+ * its animation targets from these values and reuses the identical
120
+ * clamp/target/frame-loop logic as the `percents` prop path — only the data
121
+ * source differs.
122
+ *
123
+ * The `percents` prop is retained for backward compatibility; callers may
124
+ * use either path.
125
+ */
126
+ setDepth(buffer: ArrayBuffer): void;
127
+
128
+ /**
129
+ * Imperatively update the per-row price/size text, bypassing the
130
+ * high-frequency `prices`/`sizes` prop write path (and its props/JSICache lock
131
+ * contention — REACT-NATIVE-1JZ). Companion to [setDepth] for the text layer.
132
+ *
133
+ * `prices[i]` / `sizes[i]` are the formatted strings for row `i`, parallel to
134
+ * the depth buffer pushed via `setDepth` (same length / order). Pass `[]` for a
135
+ * side that draws bars only. Call this in the SAME frame/effect as `setDepth`
136
+ * so the bar fill and its row text always come from one source frame (no
137
+ * fill-vs-text misalignment).
138
+ *
139
+ * The `prices`/`sizes` props are retained for backward compatibility; callers
140
+ * may use either path.
141
+ */
142
+ setText(prices: string[], sizes: string[]): void;
143
+ }
68
144
 
69
145
  export type PerpDepthBars = HybridView<PerpDepthBarsProps, PerpDepthBarsMethods>;
@@ -11,9 +11,19 @@ import type {
11
11
  * alignment risk is low.
12
12
  */
13
13
  export interface PerpSideRatioProps extends HybridViewProps {
14
- /** Bid (long) share, 0..100. */
14
+ /**
15
+ * Bid (long) share, 0..100. INITIAL VALUE ONLY for high-frequency callers:
16
+ * the first `setRatio` call switches the view into imperative mode and this
17
+ * prop is then ignored, so unrelated prop commits can't reset the split to the
18
+ * static initial value (REACT-NATIVE-1JZ). Update via `setRatio`. Callers that
19
+ * update infrequently may drive it purely through this prop.
20
+ */
15
21
  bidPercentage: number;
16
- /** Ask (short) share, 0..100. */
22
+ /**
23
+ * Ask (short) share, 0..100. INITIAL VALUE ONLY for high-frequency callers:
24
+ * this prop is IGNORED once `setRatio` has been called; update via `setRatio`
25
+ * (see `bidPercentage` — REACT-NATIVE-1JZ).
26
+ */
17
27
  askPercentage: number;
18
28
  /** Resolved long (bid) color. */
19
29
  longColor: string;
@@ -29,6 +39,20 @@ export interface PerpSideRatioProps extends HybridViewProps {
29
39
  reducedMotion: boolean;
30
40
  }
31
41
 
32
- export interface PerpSideRatioMethods extends HybridViewMethods {}
42
+ export interface PerpSideRatioMethods extends HybridViewMethods {
43
+ /**
44
+ * Imperatively update the bid/ask ratio, bypassing the high-frequency
45
+ * `bidPercentage`/`askPercentage` prop write path (and its props/JSICache
46
+ * lock contention — REACT-NATIVE-1JZ). Companion to `PerpDepthBars.setDepth`.
47
+ *
48
+ * `bidPercentage`/`askPercentage` carry the EXACT SAME semantics as the
49
+ * props of the same name (0..100 shares; the native side derives the split
50
+ * fraction identically). The native side routes these through the same
51
+ * clamp/target/animation path the prop setters use — only the data source
52
+ * differs. The `bidPercentage`/`askPercentage` props are retained for
53
+ * backward compatibility; callers may use either path.
54
+ */
55
+ setRatio(bidPercentage: number, askPercentage: number): void;
56
+ }
33
57
 
34
58
  export type PerpSideRatio = HybridView<PerpSideRatioProps, PerpSideRatioMethods>;