@onekeyfe/react-native-perp-depth-bar 3.0.49 → 3.0.53

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 (52) hide show
  1. package/android/src/main/java/com/margelo/nitro/perpdepthbar/HybridPerpDepthBars.kt +98 -11
  2. package/android/src/main/java/com/margelo/nitro/perpdepthbar/HybridPerpSideRatio.kt +17 -6
  3. package/ios/ArrayBufferAlias.swift +5 -0
  4. package/ios/HybridPerpDepthBars.swift +56 -5
  5. package/ios/HybridPerpSideRatio.swift +7 -1
  6. package/ios/PerpColorParser.swift +10 -1
  7. package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +40 -0
  8. package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +5 -0
  9. package/lib/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
  10. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +16 -0
  11. package/lib/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +19 -0
  12. package/lib/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
  13. package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +3 -0
  14. package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +33 -0
  15. package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +5 -0
  16. package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +5 -0
  17. package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
  18. package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
  19. package/lib/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
  20. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +40 -0
  21. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +5 -0
  22. package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
  23. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +16 -0
  24. package/lib/nitrogen/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +19 -0
  25. package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
  26. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +3 -0
  27. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +33 -0
  28. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +5 -0
  29. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +5 -0
  30. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
  31. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
  32. package/lib/nitrogen/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
  33. package/lib/typescript/src/PerpDepthBars.nitro.d.ts +64 -3
  34. package/lib/typescript/src/PerpDepthBars.nitro.d.ts.map +1 -1
  35. package/lib/typescript/src/PerpSideRatio.nitro.d.ts +12 -2
  36. package/lib/typescript/src/PerpSideRatio.nitro.d.ts.map +1 -1
  37. package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +40 -0
  38. package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +5 -0
  39. package/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +16 -0
  41. package/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +19 -0
  42. package/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
  43. package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +3 -0
  44. package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +33 -0
  45. package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +5 -0
  46. package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +5 -0
  47. package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
  48. package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
  49. package/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
  50. package/package.json +1 -1
  51. package/src/PerpDepthBars.nitro.ts +66 -8
  52. package/src/PerpSideRatio.nitro.ts +12 -2
@@ -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
  }
@@ -229,6 +229,24 @@ namespace margelo::nitro::perpdepthbar {
229
229
  static const auto method = javaClassStatic()->getMethod<void(double /* textInset */)>("setTextInset");
230
230
  method(_javaPart, textInset);
231
231
  }
232
+ std::string JHybridPerpDepthBarsSpec::getPlaceholderText() {
233
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getPlaceholderText");
234
+ auto __result = method(_javaPart);
235
+ return __result->toStdString();
236
+ }
237
+ void JHybridPerpDepthBarsSpec::setPlaceholderText(const std::string& placeholderText) {
238
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* placeholderText */)>("setPlaceholderText");
239
+ method(_javaPart, jni::make_jstring(placeholderText));
240
+ }
241
+ double JHybridPerpDepthBarsSpec::getPlaceholderRows() {
242
+ static const auto method = javaClassStatic()->getMethod<double()>("getPlaceholderRows");
243
+ auto __result = method(_javaPart);
244
+ return __result;
245
+ }
246
+ void JHybridPerpDepthBarsSpec::setPlaceholderRows(double placeholderRows) {
247
+ static const auto method = javaClassStatic()->getMethod<void(double /* placeholderRows */)>("setPlaceholderRows");
248
+ method(_javaPart, placeholderRows);
249
+ }
232
250
  std::optional<std::function<void(double /* rowIndex */)>> JHybridPerpDepthBarsSpec::getOnRowPress() {
233
251
  static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_double::javaobject>()>("getOnRowPress_cxx");
234
252
  auto __result = method(_javaPart);
@@ -252,5 +270,27 @@ namespace margelo::nitro::perpdepthbar {
252
270
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JArrayBuffer::javaobject> /* buffer */)>("setDepth");
253
271
  method(_javaPart, JArrayBuffer::wrap(buffer));
254
272
  }
273
+ void JHybridPerpDepthBarsSpec::setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) {
274
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* prices */, jni::alias_ref<jni::JArrayClass<jni::JString>> /* sizes */)>("setText");
275
+ method(_javaPart, [&]() {
276
+ size_t __size = prices.size();
277
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
278
+ for (size_t __i = 0; __i < __size; __i++) {
279
+ const auto& __element = prices[__i];
280
+ auto __elementJni = jni::make_jstring(__element);
281
+ __array->setElement(__i, *__elementJni);
282
+ }
283
+ return __array;
284
+ }(), [&]() {
285
+ size_t __size = sizes.size();
286
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
287
+ for (size_t __i = 0; __i < __size; __i++) {
288
+ const auto& __element = sizes[__i];
289
+ auto __elementJni = jni::make_jstring(__element);
290
+ __array->setElement(__i, *__elementJni);
291
+ }
292
+ return __array;
293
+ }());
294
+ }
255
295
 
256
296
  } // namespace margelo::nitro::perpdepthbar
@@ -80,12 +80,17 @@ namespace margelo::nitro::perpdepthbar {
80
80
  void setSizeFontSize(double sizeFontSize) override;
81
81
  double getTextInset() override;
82
82
  void setTextInset(double textInset) override;
83
+ std::string getPlaceholderText() override;
84
+ void setPlaceholderText(const std::string& placeholderText) override;
85
+ double getPlaceholderRows() override;
86
+ void setPlaceholderRows(double placeholderRows) override;
83
87
  std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() override;
84
88
  void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) override;
85
89
 
86
90
  public:
87
91
  // Methods
88
92
  void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) override;
93
+ void setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) override;
89
94
 
90
95
  private:
91
96
  friend HybridBase;
@@ -96,6 +96,14 @@ void JHybridPerpDepthBarsStateUpdater::updateViewProps(jni::alias_ref<jni::JClas
96
96
  view->setTextInset(props.textInset.value);
97
97
  // TODO: Set isDirty = false
98
98
  }
99
+ if (props.placeholderText.isDirty) {
100
+ view->setPlaceholderText(props.placeholderText.value);
101
+ // TODO: Set isDirty = false
102
+ }
103
+ if (props.placeholderRows.isDirty) {
104
+ view->setPlaceholderRows(props.placeholderRows.value);
105
+ // TODO: Set isDirty = false
106
+ }
99
107
  if (props.onRowPress.isDirty) {
100
108
  view->setOnRowPress(props.onRowPress.value);
101
109
  // TODO: Set isDirty = false
@@ -133,6 +133,18 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
133
133
  @set:Keep
134
134
  abstract var textInset: Double
135
135
 
136
+ @get:DoNotStrip
137
+ @get:Keep
138
+ @set:DoNotStrip
139
+ @set:Keep
140
+ abstract var placeholderText: String
141
+
142
+ @get:DoNotStrip
143
+ @get:Keep
144
+ @set:DoNotStrip
145
+ @set:Keep
146
+ abstract var placeholderRows: Double
147
+
136
148
  abstract var onRowPress: ((rowIndex: Double) -> Unit)?
137
149
 
138
150
  private var onRowPress_cxx: Func_void_double?
@@ -151,6 +163,10 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
151
163
  @DoNotStrip
152
164
  @Keep
153
165
  abstract fun setDepth(buffer: ArrayBuffer): Unit
166
+
167
+ @DoNotStrip
168
+ @Keep
169
+ abstract fun setText(prices: Array<String>, sizes: Array<String>): Unit
154
170
 
155
171
  private external fun initHybrid(): HybridData
156
172
 
@@ -159,6 +159,19 @@ namespace margelo::nitro::perpdepthbar {
159
159
  inline void setTextInset(double textInset) noexcept override {
160
160
  _swiftPart.setTextInset(std::forward<decltype(textInset)>(textInset));
161
161
  }
162
+ inline std::string getPlaceholderText() noexcept override {
163
+ auto __result = _swiftPart.getPlaceholderText();
164
+ return __result;
165
+ }
166
+ inline void setPlaceholderText(const std::string& placeholderText) noexcept override {
167
+ _swiftPart.setPlaceholderText(placeholderText);
168
+ }
169
+ inline double getPlaceholderRows() noexcept override {
170
+ return _swiftPart.getPlaceholderRows();
171
+ }
172
+ inline void setPlaceholderRows(double placeholderRows) noexcept override {
173
+ _swiftPart.setPlaceholderRows(std::forward<decltype(placeholderRows)>(placeholderRows));
174
+ }
162
175
  inline std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() noexcept override {
163
176
  auto __result = _swiftPart.getOnRowPress();
164
177
  return __result;
@@ -175,6 +188,12 @@ namespace margelo::nitro::perpdepthbar {
175
188
  std::rethrow_exception(__result.error());
176
189
  }
177
190
  }
191
+ inline void setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) override {
192
+ auto __result = _swiftPart.setText(prices, sizes);
193
+ if (__result.hasError()) [[unlikely]] {
194
+ std::rethrow_exception(__result.error());
195
+ }
196
+ }
178
197
 
179
198
  private:
180
199
  PerpDepthBar::HybridPerpDepthBarsSpec_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 {
@@ -341,6 +363,17 @@ open class HybridPerpDepthBarsSpec_cxx {
341
363
  }
342
364
  }
343
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
+
344
377
  public final func getView() -> UnsafeMutableRawPointer {
345
378
  return Unmanaged.passRetained(__implementation.view).toOpaque()
346
379
  }
@@ -44,9 +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);
49
53
  prototype.registerHybridMethod("setDepth", &HybridPerpDepthBarsSpec::setDepth);
54
+ prototype.registerHybridMethod("setText", &HybridPerpDepthBarsSpec::setText);
50
55
  });
51
56
  }
52
57
 
@@ -78,12 +78,17 @@ namespace margelo::nitro::perpdepthbar {
78
78
  virtual void setSizeFontSize(double sizeFontSize) = 0;
79
79
  virtual double getTextInset() = 0;
80
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;
81
85
  virtual std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() = 0;
82
86
  virtual void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) = 0;
83
87
 
84
88
  public:
85
89
  // Methods
86
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;
87
92
 
88
93
  protected:
89
94
  // 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
  }
@@ -11,7 +11,17 @@ import type { HybridView, HybridViewMethods, HybridViewProps } from 'react-nativ
11
11
  * All values are in points (DIP); the native side quantizes to physical pixels.
12
12
  */
13
13
  export interface PerpDepthBarsProps extends HybridViewProps {
14
- /** Depth percentage per row, 0..100. Length == number of rows on this side. */
14
+ /**
15
+ * Depth percentage per row, 0..100. Length == number of rows on this side.
16
+ *
17
+ * INITIAL VALUE ONLY when using the imperative path. The first
18
+ * `setDepth(buffer)` call switches the view into imperative mode; from then on
19
+ * this prop is IGNORED on every prop-update transaction (so unrelated
20
+ * high-frequency prop commits like `prices`/`sizes` can't wipe the bars —
21
+ * REACT-NATIVE-1JZ). For high-frequency depth updates ALWAYS call `setDepth`;
22
+ * do NOT keep writing this prop at tick rate. Callers that never call
23
+ * `setDepth` may drive the bars purely through this prop (each write retargets).
24
+ */
15
25
  percents: number[];
16
26
  /** Row height in points (matches the sibling RN text row height). */
17
27
  rowHeight: number;
@@ -30,9 +40,28 @@ export interface PerpDepthBarsProps extends HybridViewProps {
30
40
  * empty<->full so native snaps to the new values WITHOUT animating.
31
41
  */
32
42
  epoch: number;
33
- /** Formatted price string per row (e.g. "1981.4"). */
43
+ /**
44
+ * Per-row price text, parallel to `percents` (same length / order). Drawn
45
+ * natively per row (price left-aligned), so the order-book ladder needs NO
46
+ * sibling RN <Text> rows. Empty => the view renders bars only.
47
+ *
48
+ * INITIAL VALUE ONLY for high-frequency callers: the first `setText` call
49
+ * switches the text layer into imperative mode and this prop is then IGNORED on
50
+ * every prop-update transaction. For high-frequency text updates ALWAYS call
51
+ * `setText`; do NOT keep writing this prop at tick rate (string-array prop
52
+ * commits are the heaviest part of the Fabric props + JSI path — exactly what
53
+ * REACT-NATIVE-1JZ avoids). Callers that update infrequently may drive it
54
+ * purely through this prop.
55
+ */
34
56
  prices: string[];
35
- /** Formatted size string per row (e.g. "389.04"). */
57
+ /**
58
+ * Per-row size text, parallel to `percents`. Drawn natively per row (size
59
+ * right-aligned). Empty => bars only.
60
+ *
61
+ * INITIAL VALUE ONLY for high-frequency callers: update via `setText`; this
62
+ * prop is IGNORED once `setText` has been called (see `prices` —
63
+ * REACT-NATIVE-1JZ).
64
+ */
36
65
  sizes: string[];
37
66
  /** Price text color: hex or rgba()/rgb(). */
38
67
  priceColor: string;
@@ -44,6 +73,23 @@ export interface PerpDepthBarsProps extends HybridViewProps {
44
73
  sizeFontSize: number;
45
74
  /** Horizontal text inset in points (price padding-left, size padding-right). */
46
75
  textInset: number;
76
+ /**
77
+ * Per-row placeholder text drawn while the column has NO real data (no rows
78
+ * from `percents`/`setDepth` and no `prices`/`sizes`/`setText`), e.g. "--".
79
+ * Empty string disables the placeholder. This replaces any RN skeleton/overlay:
80
+ * the view draws the placeholder itself, then atomically swaps to real numbers
81
+ * the moment data lands — so there is never a blank frame between the two
82
+ * (the old overlay approach removed the JS skeleton a few frames before the
83
+ * native view had painted, flashing blank). Drawn in `priceColor` (left) and
84
+ * `sizeColor` (right); no bar fill.
85
+ */
86
+ placeholderText: string;
87
+ /**
88
+ * How many placeholder rows to draw when `placeholderText` is shown. Match the
89
+ * order book's rows-per-side so the column reserves a stable height before any
90
+ * data arrives. Ignored once real data is present.
91
+ */
92
+ placeholderRows: number;
47
93
  /**
48
94
  * Fired natively when a row is tapped. `rowIndex` is the 0-based row
49
95
  * (top→bottom, parallel to `percents`/`prices`/`sizes`). The view handles
@@ -69,6 +115,21 @@ export interface PerpDepthBarsMethods extends HybridViewMethods {
69
115
  * use either path.
70
116
  */
71
117
  setDepth(buffer: ArrayBuffer): void;
118
+ /**
119
+ * Imperatively update the per-row price/size text, bypassing the
120
+ * high-frequency `prices`/`sizes` prop write path (and its props/JSICache lock
121
+ * contention — REACT-NATIVE-1JZ). Companion to [setDepth] for the text layer.
122
+ *
123
+ * `prices[i]` / `sizes[i]` are the formatted strings for row `i`, parallel to
124
+ * the depth buffer pushed via `setDepth` (same length / order). Pass `[]` for a
125
+ * side that draws bars only. Call this in the SAME frame/effect as `setDepth`
126
+ * so the bar fill and its row text always come from one source frame (no
127
+ * fill-vs-text misalignment).
128
+ *
129
+ * The `prices`/`sizes` props are retained for backward compatibility; callers
130
+ * may use either path.
131
+ */
132
+ setText(prices: string[], sizes: string[]): void;
72
133
  }
73
134
  export type PerpDepthBars = HybridView<PerpDepthBarsProps, PerpDepthBarsMethods>;
74
135
  //# sourceMappingURL=PerpDepthBars.nitro.d.ts.map
@@ -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;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;IAC7D;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CACrC;AAED,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;;;;;;;;;;OAUG;IACH,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;IAEd;;;;;;;;;;;;OAYG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;;;OAOG;IACH,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;;;;;;;;;OASG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAEpC;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAClD;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
@@ -6,9 +6,19 @@ import type { HybridView, HybridViewMethods, HybridViewProps } from 'react-nativ
6
6
  * alignment risk is low.
7
7
  */
8
8
  export interface PerpSideRatioProps extends HybridViewProps {
9
- /** Bid (long) share, 0..100. */
9
+ /**
10
+ * Bid (long) share, 0..100. INITIAL VALUE ONLY for high-frequency callers:
11
+ * the first `setRatio` call switches the view into imperative mode and this
12
+ * prop is then ignored, so unrelated prop commits can't reset the split to the
13
+ * static initial value (REACT-NATIVE-1JZ). Update via `setRatio`. Callers that
14
+ * update infrequently may drive it purely through this prop.
15
+ */
10
16
  bidPercentage: number;
11
- /** Ask (short) share, 0..100. */
17
+ /**
18
+ * Ask (short) share, 0..100. INITIAL VALUE ONLY for high-frequency callers:
19
+ * this prop is IGNORED once `setRatio` has been called; update via `setRatio`
20
+ * (see `bidPercentage` — REACT-NATIVE-1JZ).
21
+ */
12
22
  askPercentage: number;
13
23
  /** Resolved long (bid) color. */
14
24
  longColor: string;
@@ -1 +1 @@
1
- {"version":3,"file":"PerpSideRatio.nitro.d.ts","sourceRoot":"","sources":["../../../src/PerpSideRatio.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9D;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"PerpSideRatio.nitro.d.ts","sourceRoot":"","sources":["../../../src/PerpSideRatio.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9D;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
@@ -229,6 +229,24 @@ namespace margelo::nitro::perpdepthbar {
229
229
  static const auto method = javaClassStatic()->getMethod<void(double /* textInset */)>("setTextInset");
230
230
  method(_javaPart, textInset);
231
231
  }
232
+ std::string JHybridPerpDepthBarsSpec::getPlaceholderText() {
233
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getPlaceholderText");
234
+ auto __result = method(_javaPart);
235
+ return __result->toStdString();
236
+ }
237
+ void JHybridPerpDepthBarsSpec::setPlaceholderText(const std::string& placeholderText) {
238
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* placeholderText */)>("setPlaceholderText");
239
+ method(_javaPart, jni::make_jstring(placeholderText));
240
+ }
241
+ double JHybridPerpDepthBarsSpec::getPlaceholderRows() {
242
+ static const auto method = javaClassStatic()->getMethod<double()>("getPlaceholderRows");
243
+ auto __result = method(_javaPart);
244
+ return __result;
245
+ }
246
+ void JHybridPerpDepthBarsSpec::setPlaceholderRows(double placeholderRows) {
247
+ static const auto method = javaClassStatic()->getMethod<void(double /* placeholderRows */)>("setPlaceholderRows");
248
+ method(_javaPart, placeholderRows);
249
+ }
232
250
  std::optional<std::function<void(double /* rowIndex */)>> JHybridPerpDepthBarsSpec::getOnRowPress() {
233
251
  static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_double::javaobject>()>("getOnRowPress_cxx");
234
252
  auto __result = method(_javaPart);
@@ -252,5 +270,27 @@ namespace margelo::nitro::perpdepthbar {
252
270
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JArrayBuffer::javaobject> /* buffer */)>("setDepth");
253
271
  method(_javaPart, JArrayBuffer::wrap(buffer));
254
272
  }
273
+ void JHybridPerpDepthBarsSpec::setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) {
274
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* prices */, jni::alias_ref<jni::JArrayClass<jni::JString>> /* sizes */)>("setText");
275
+ method(_javaPart, [&]() {
276
+ size_t __size = prices.size();
277
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
278
+ for (size_t __i = 0; __i < __size; __i++) {
279
+ const auto& __element = prices[__i];
280
+ auto __elementJni = jni::make_jstring(__element);
281
+ __array->setElement(__i, *__elementJni);
282
+ }
283
+ return __array;
284
+ }(), [&]() {
285
+ size_t __size = sizes.size();
286
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
287
+ for (size_t __i = 0; __i < __size; __i++) {
288
+ const auto& __element = sizes[__i];
289
+ auto __elementJni = jni::make_jstring(__element);
290
+ __array->setElement(__i, *__elementJni);
291
+ }
292
+ return __array;
293
+ }());
294
+ }
255
295
 
256
296
  } // namespace margelo::nitro::perpdepthbar
@@ -80,12 +80,17 @@ namespace margelo::nitro::perpdepthbar {
80
80
  void setSizeFontSize(double sizeFontSize) override;
81
81
  double getTextInset() override;
82
82
  void setTextInset(double textInset) override;
83
+ std::string getPlaceholderText() override;
84
+ void setPlaceholderText(const std::string& placeholderText) override;
85
+ double getPlaceholderRows() override;
86
+ void setPlaceholderRows(double placeholderRows) override;
83
87
  std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() override;
84
88
  void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) override;
85
89
 
86
90
  public:
87
91
  // Methods
88
92
  void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) override;
93
+ void setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) override;
89
94
 
90
95
  private:
91
96
  friend HybridBase;
@@ -96,6 +96,14 @@ void JHybridPerpDepthBarsStateUpdater::updateViewProps(jni::alias_ref<jni::JClas
96
96
  view->setTextInset(props.textInset.value);
97
97
  // TODO: Set isDirty = false
98
98
  }
99
+ if (props.placeholderText.isDirty) {
100
+ view->setPlaceholderText(props.placeholderText.value);
101
+ // TODO: Set isDirty = false
102
+ }
103
+ if (props.placeholderRows.isDirty) {
104
+ view->setPlaceholderRows(props.placeholderRows.value);
105
+ // TODO: Set isDirty = false
106
+ }
99
107
  if (props.onRowPress.isDirty) {
100
108
  view->setOnRowPress(props.onRowPress.value);
101
109
  // TODO: Set isDirty = false
@@ -133,6 +133,18 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
133
133
  @set:Keep
134
134
  abstract var textInset: Double
135
135
 
136
+ @get:DoNotStrip
137
+ @get:Keep
138
+ @set:DoNotStrip
139
+ @set:Keep
140
+ abstract var placeholderText: String
141
+
142
+ @get:DoNotStrip
143
+ @get:Keep
144
+ @set:DoNotStrip
145
+ @set:Keep
146
+ abstract var placeholderRows: Double
147
+
136
148
  abstract var onRowPress: ((rowIndex: Double) -> Unit)?
137
149
 
138
150
  private var onRowPress_cxx: Func_void_double?
@@ -151,6 +163,10 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
151
163
  @DoNotStrip
152
164
  @Keep
153
165
  abstract fun setDepth(buffer: ArrayBuffer): Unit
166
+
167
+ @DoNotStrip
168
+ @Keep
169
+ abstract fun setText(prices: Array<String>, sizes: Array<String>): Unit
154
170
 
155
171
  private external fun initHybrid(): HybridData
156
172