@onekeyfe/react-native-chart-webview 3.0.54 → 3.0.56

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 (49) hide show
  1. package/ChartWebview.podspec +3 -0
  2. package/android/src/main/java/com/margelo/nitro/chartwebview/ChartWebview.kt +74 -16
  3. package/android/src/main/java/com/margelo/nitro/chartwebview/PooledChartWebView.kt +139 -13
  4. package/ios/ChartWebview.swift +185 -31
  5. package/lib/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +9 -0
  6. package/lib/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +2 -0
  7. package/lib/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +4 -0
  8. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +6 -0
  9. package/lib/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +7 -0
  10. package/lib/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +5 -0
  11. package/lib/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +1 -0
  12. package/lib/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +24 -0
  13. package/lib/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +2 -0
  14. package/lib/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +2 -0
  15. package/lib/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +12 -0
  16. package/lib/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +1 -0
  17. package/lib/nitrogen/generated/shared/json/ChartWebviewConfig.json +1 -0
  18. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +9 -0
  19. package/lib/nitrogen/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +2 -0
  20. package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +4 -0
  21. package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +6 -0
  22. package/lib/nitrogen/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +7 -0
  23. package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +5 -0
  24. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +1 -0
  25. package/lib/nitrogen/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +24 -0
  26. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +2 -0
  27. package/lib/nitrogen/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +2 -0
  28. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +12 -0
  29. package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +1 -0
  30. package/lib/nitrogen/nitrogen/generated/shared/json/ChartWebviewConfig.json +1 -0
  31. package/lib/typescript/src/ChartWebview.nitro.d.ts +1 -0
  32. package/lib/typescript/src/ChartWebview.nitro.d.ts.map +1 -1
  33. package/lib/typescript/src/index.d.ts +1 -0
  34. package/lib/typescript/src/index.d.ts.map +1 -1
  35. package/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +9 -0
  36. package/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +2 -0
  37. package/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +4 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +6 -0
  39. package/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +7 -0
  40. package/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +5 -0
  41. package/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +1 -0
  42. package/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +24 -0
  43. package/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +2 -0
  44. package/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +2 -0
  45. package/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +12 -0
  46. package/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +1 -0
  47. package/nitrogen/generated/shared/json/ChartWebviewConfig.json +1 -0
  48. package/package.json +1 -1
  49. package/src/ChartWebview.nitro.ts +10 -0
@@ -90,6 +90,12 @@ abstract class HybridChartWebviewSpec: HybridView() {
90
90
  @set:Keep
91
91
  abstract var active: Boolean?
92
92
 
93
+ @get:DoNotStrip
94
+ @get:Keep
95
+ @set:DoNotStrip
96
+ @set:Keep
97
+ abstract var webviewDebuggingEnabled: Boolean?
98
+
93
99
  abstract var onMessage: ((message: String) -> Unit)?
94
100
 
95
101
  private var onMessage_cxx: Func_void_std__string?
@@ -114,6 +114,13 @@ namespace margelo::nitro::chartwebview {
114
114
  inline void setActive(std::optional<bool> active) noexcept override {
115
115
  _swiftPart.setActive(active);
116
116
  }
117
+ inline std::optional<bool> getWebviewDebuggingEnabled() noexcept override {
118
+ auto __result = _swiftPart.getWebviewDebuggingEnabled();
119
+ return __result;
120
+ }
121
+ inline void setWebviewDebuggingEnabled(std::optional<bool> webviewDebuggingEnabled) noexcept override {
122
+ _swiftPart.setWebviewDebuggingEnabled(webviewDebuggingEnabled);
123
+ }
117
124
  inline std::optional<std::function<void(const std::string& /* message */)>> getOnMessage() noexcept override {
118
125
  auto __result = _swiftPart.getOnMessage();
119
126
  return __result;
@@ -111,6 +111,11 @@ using namespace margelo::nitro::chartwebview::views;
111
111
  swiftPart.setActive(newViewProps.active.value);
112
112
  newViewProps.active.isDirty = false;
113
113
  }
114
+ // webviewDebuggingEnabled: optional
115
+ if (newViewProps.webviewDebuggingEnabled.isDirty) {
116
+ swiftPart.setWebviewDebuggingEnabled(newViewProps.webviewDebuggingEnabled.value);
117
+ newViewProps.webviewDebuggingEnabled.isDirty = false;
118
+ }
114
119
  // onMessage: optional
115
120
  if (newViewProps.onMessage.isDirty) {
116
121
  swiftPart.setOnMessage(newViewProps.onMessage.value);
@@ -19,6 +19,7 @@ public protocol HybridChartWebviewSpec_protocol: HybridObject, HybridView {
19
19
  var reuseKey: String? { get set }
20
20
  var pooled: Bool? { get set }
21
21
  var active: Bool? { get set }
22
+ var webviewDebuggingEnabled: Bool? { get set }
22
23
  var onMessage: ((_ message: String) -> Void)? { get set }
23
24
  var onLoadEnd: (() -> Void)? { get set }
24
25
  var onError: ((_ message: String) -> Void)? { get set }
@@ -306,6 +306,30 @@ open class HybridChartWebviewSpec_cxx {
306
306
  }
307
307
  }
308
308
 
309
+ public final var webviewDebuggingEnabled: bridge.std__optional_bool_ {
310
+ @inline(__always)
311
+ get {
312
+ return { () -> bridge.std__optional_bool_ in
313
+ if let __unwrappedValue = self.__implementation.webviewDebuggingEnabled {
314
+ return bridge.create_std__optional_bool_(__unwrappedValue)
315
+ } else {
316
+ return .init()
317
+ }
318
+ }()
319
+ }
320
+ @inline(__always)
321
+ set {
322
+ self.__implementation.webviewDebuggingEnabled = { () -> Bool? in
323
+ if bridge.has_value_std__optional_bool_(newValue) {
324
+ let __unwrapped = bridge.get_std__optional_bool_(newValue)
325
+ return __unwrapped
326
+ } else {
327
+ return nil
328
+ }
329
+ }()
330
+ }
331
+ }
332
+
309
333
  public final var onMessage: bridge.std__optional_std__function_void_const_std__string_____message______ {
310
334
  @inline(__always)
311
335
  get {
@@ -30,6 +30,8 @@ namespace margelo::nitro::chartwebview {
30
30
  prototype.registerHybridSetter("pooled", &HybridChartWebviewSpec::setPooled);
31
31
  prototype.registerHybridGetter("active", &HybridChartWebviewSpec::getActive);
32
32
  prototype.registerHybridSetter("active", &HybridChartWebviewSpec::setActive);
33
+ prototype.registerHybridGetter("webviewDebuggingEnabled", &HybridChartWebviewSpec::getWebviewDebuggingEnabled);
34
+ prototype.registerHybridSetter("webviewDebuggingEnabled", &HybridChartWebviewSpec::setWebviewDebuggingEnabled);
33
35
  prototype.registerHybridGetter("onMessage", &HybridChartWebviewSpec::getOnMessage);
34
36
  prototype.registerHybridSetter("onMessage", &HybridChartWebviewSpec::setOnMessage);
35
37
  prototype.registerHybridGetter("onLoadEnd", &HybridChartWebviewSpec::getOnLoadEnd);
@@ -62,6 +62,8 @@ namespace margelo::nitro::chartwebview {
62
62
  virtual void setPooled(std::optional<bool> pooled) = 0;
63
63
  virtual std::optional<bool> getActive() = 0;
64
64
  virtual void setActive(std::optional<bool> active) = 0;
65
+ virtual std::optional<bool> getWebviewDebuggingEnabled() = 0;
66
+ virtual void setWebviewDebuggingEnabled(std::optional<bool> webviewDebuggingEnabled) = 0;
65
67
  virtual std::optional<std::function<void(const std::string& /* message */)>> getOnMessage() = 0;
66
68
  virtual void setOnMessage(const std::optional<std::function<void(const std::string& /* message */)>>& onMessage) = 0;
67
69
  virtual std::optional<std::function<void()>> getOnLoadEnd() = 0;
@@ -105,6 +105,16 @@ namespace margelo::nitro::chartwebview::views {
105
105
  throw std::runtime_error(std::string("ChartWebview.active: ") + exc.what());
106
106
  }
107
107
  }()),
108
+ webviewDebuggingEnabled([&]() -> CachedProp<std::optional<bool>> {
109
+ try {
110
+ const react::RawValue* rawValue = rawProps.at("webviewDebuggingEnabled", nullptr, nullptr);
111
+ if (rawValue == nullptr) return sourceProps.webviewDebuggingEnabled;
112
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
113
+ return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.webviewDebuggingEnabled);
114
+ } catch (const std::exception& exc) {
115
+ throw std::runtime_error(std::string("ChartWebview.webviewDebuggingEnabled: ") + exc.what());
116
+ }
117
+ }()),
108
118
  onMessage([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> {
109
119
  try {
110
120
  const react::RawValue* rawValue = rawProps.at("onMessage", nullptr, nullptr);
@@ -156,6 +166,7 @@ namespace margelo::nitro::chartwebview::views {
156
166
  reuseKey(other.reuseKey),
157
167
  pooled(other.pooled),
158
168
  active(other.active),
169
+ webviewDebuggingEnabled(other.webviewDebuggingEnabled),
159
170
  onMessage(other.onMessage),
160
171
  onLoadEnd(other.onLoadEnd),
161
172
  onError(other.onError),
@@ -171,6 +182,7 @@ namespace margelo::nitro::chartwebview::views {
171
182
  case hashString("reuseKey"): return true;
172
183
  case hashString("pooled"): return true;
173
184
  case hashString("active"): return true;
185
+ case hashString("webviewDebuggingEnabled"): return true;
174
186
  case hashString("onMessage"): return true;
175
187
  case hashString("onLoadEnd"): return true;
176
188
  case hashString("onError"): return true;
@@ -51,6 +51,7 @@ namespace margelo::nitro::chartwebview::views {
51
51
  CachedProp<std::optional<std::string>> reuseKey;
52
52
  CachedProp<std::optional<bool>> pooled;
53
53
  CachedProp<std::optional<bool>> active;
54
+ CachedProp<std::optional<bool>> webviewDebuggingEnabled;
54
55
  CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> onMessage;
55
56
  CachedProp<std::optional<std::function<void()>>> onLoadEnd;
56
57
  CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> onError;
@@ -12,6 +12,7 @@
12
12
  "reuseKey": true,
13
13
  "pooled": true,
14
14
  "active": true,
15
+ "webviewDebuggingEnabled": true,
15
16
  "onMessage": true,
16
17
  "onLoadEnd": true,
17
18
  "onError": true,
@@ -8,6 +8,7 @@ export interface ChartWebviewProps extends HybridViewProps {
8
8
  reuseKey?: string;
9
9
  pooled?: boolean;
10
10
  active?: boolean;
11
+ webviewDebuggingEnabled?: boolean;
11
12
  onMessage?: (message: string) => void;
12
13
  onLoadEnd?: () => void;
13
14
  onError?: (message: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWebview.nitro.d.ts","sourceRoot":"","sources":["../../../src/ChartWebview.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAKpC,MAAM,WAAW,iBAAkB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C;IAUjB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAIlC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAG5D,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,IAAI,IAAI,CAAC;IAGf,aAAa,IAAI,IAAI,CAAC;CACvB;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC"}
@@ -20,6 +20,7 @@ export declare function ChartWebviewView({ bridgeScript, hybridRef, onMessage, o
20
20
  reuseKey?: string | undefined;
21
21
  pooled?: boolean | undefined;
22
22
  active?: boolean | undefined;
23
+ webviewDebuggingEnabled?: boolean | undefined;
23
24
  onMessage?: NitroViewWrappedCallback<((message: string) => void) | undefined> | undefined;
24
25
  onLoadEnd?: NitroViewWrappedCallback<(() => void) | undefined> | undefined;
25
26
  onError?: NitroViewWrappedCallback<((message: string) => void) | undefined> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGnF,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAO3C,KAAK,oBAAoB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG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,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,IACxD,CAAC,GACD,wBAAwB,CAAC,CAAC,CAAC,CAAC;AAEhC,KAAK,qBAAqB,GAAG,IAAI,CAC/B,iBAAiB,EACjB,WAAW,GAAG,WAAW,GAAG,SAAS,CACtC,GACC,SAAS,GAAG;IACV,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,oBAAoB,CAAC,MAAM,IAAI,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;CAC3D,CAAC;AAcJ,wBAAgB,gBAAgB,CAAC,EAC/B,YAAY,EACZ,SAAS,EACT,SAAS,EACT,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDvB"}
@@ -117,6 +117,15 @@ namespace margelo::nitro::chartwebview {
117
117
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* active */)>("setActive");
118
118
  method(_javaPart, active.has_value() ? jni::JBoolean::valueOf(active.value()) : nullptr);
119
119
  }
120
+ std::optional<bool> JHybridChartWebviewSpec::getWebviewDebuggingEnabled() {
121
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getWebviewDebuggingEnabled");
122
+ auto __result = method(_javaPart);
123
+ return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
124
+ }
125
+ void JHybridChartWebviewSpec::setWebviewDebuggingEnabled(std::optional<bool> webviewDebuggingEnabled) {
126
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* webviewDebuggingEnabled */)>("setWebviewDebuggingEnabled");
127
+ method(_javaPart, webviewDebuggingEnabled.has_value() ? jni::JBoolean::valueOf(webviewDebuggingEnabled.value()) : nullptr);
128
+ }
120
129
  std::optional<std::function<void(const std::string& /* message */)>> JHybridChartWebviewSpec::getOnMessage() {
121
130
  static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__string::javaobject>()>("getOnMessage_cxx");
122
131
  auto __result = method(_javaPart);
@@ -66,6 +66,8 @@ namespace margelo::nitro::chartwebview {
66
66
  void setPooled(std::optional<bool> pooled) override;
67
67
  std::optional<bool> getActive() override;
68
68
  void setActive(std::optional<bool> active) override;
69
+ std::optional<bool> getWebviewDebuggingEnabled() override;
70
+ void setWebviewDebuggingEnabled(std::optional<bool> webviewDebuggingEnabled) override;
69
71
  std::optional<std::function<void(const std::string& /* message */)>> getOnMessage() override;
70
72
  void setOnMessage(const std::optional<std::function<void(const std::string& /* message */)>>& onMessage) override;
71
73
  std::optional<std::function<void()>> getOnLoadEnd() override;
@@ -68,6 +68,10 @@ void JHybridChartWebviewStateUpdater::updateViewProps(jni::alias_ref<jni::JClass
68
68
  view->setActive(props.active.value);
69
69
  // TODO: Set isDirty = false
70
70
  }
71
+ if (props.webviewDebuggingEnabled.isDirty) {
72
+ view->setWebviewDebuggingEnabled(props.webviewDebuggingEnabled.value);
73
+ // TODO: Set isDirty = false
74
+ }
71
75
  if (props.onMessage.isDirty) {
72
76
  view->setOnMessage(props.onMessage.value);
73
77
  // TODO: Set isDirty = false
@@ -90,6 +90,12 @@ abstract class HybridChartWebviewSpec: HybridView() {
90
90
  @set:Keep
91
91
  abstract var active: Boolean?
92
92
 
93
+ @get:DoNotStrip
94
+ @get:Keep
95
+ @set:DoNotStrip
96
+ @set:Keep
97
+ abstract var webviewDebuggingEnabled: Boolean?
98
+
93
99
  abstract var onMessage: ((message: String) -> Unit)?
94
100
 
95
101
  private var onMessage_cxx: Func_void_std__string?
@@ -114,6 +114,13 @@ namespace margelo::nitro::chartwebview {
114
114
  inline void setActive(std::optional<bool> active) noexcept override {
115
115
  _swiftPart.setActive(active);
116
116
  }
117
+ inline std::optional<bool> getWebviewDebuggingEnabled() noexcept override {
118
+ auto __result = _swiftPart.getWebviewDebuggingEnabled();
119
+ return __result;
120
+ }
121
+ inline void setWebviewDebuggingEnabled(std::optional<bool> webviewDebuggingEnabled) noexcept override {
122
+ _swiftPart.setWebviewDebuggingEnabled(webviewDebuggingEnabled);
123
+ }
117
124
  inline std::optional<std::function<void(const std::string& /* message */)>> getOnMessage() noexcept override {
118
125
  auto __result = _swiftPart.getOnMessage();
119
126
  return __result;
@@ -111,6 +111,11 @@ using namespace margelo::nitro::chartwebview::views;
111
111
  swiftPart.setActive(newViewProps.active.value);
112
112
  newViewProps.active.isDirty = false;
113
113
  }
114
+ // webviewDebuggingEnabled: optional
115
+ if (newViewProps.webviewDebuggingEnabled.isDirty) {
116
+ swiftPart.setWebviewDebuggingEnabled(newViewProps.webviewDebuggingEnabled.value);
117
+ newViewProps.webviewDebuggingEnabled.isDirty = false;
118
+ }
114
119
  // onMessage: optional
115
120
  if (newViewProps.onMessage.isDirty) {
116
121
  swiftPart.setOnMessage(newViewProps.onMessage.value);
@@ -19,6 +19,7 @@ public protocol HybridChartWebviewSpec_protocol: HybridObject, HybridView {
19
19
  var reuseKey: String? { get set }
20
20
  var pooled: Bool? { get set }
21
21
  var active: Bool? { get set }
22
+ var webviewDebuggingEnabled: Bool? { get set }
22
23
  var onMessage: ((_ message: String) -> Void)? { get set }
23
24
  var onLoadEnd: (() -> Void)? { get set }
24
25
  var onError: ((_ message: String) -> Void)? { get set }
@@ -306,6 +306,30 @@ open class HybridChartWebviewSpec_cxx {
306
306
  }
307
307
  }
308
308
 
309
+ public final var webviewDebuggingEnabled: bridge.std__optional_bool_ {
310
+ @inline(__always)
311
+ get {
312
+ return { () -> bridge.std__optional_bool_ in
313
+ if let __unwrappedValue = self.__implementation.webviewDebuggingEnabled {
314
+ return bridge.create_std__optional_bool_(__unwrappedValue)
315
+ } else {
316
+ return .init()
317
+ }
318
+ }()
319
+ }
320
+ @inline(__always)
321
+ set {
322
+ self.__implementation.webviewDebuggingEnabled = { () -> Bool? in
323
+ if bridge.has_value_std__optional_bool_(newValue) {
324
+ let __unwrapped = bridge.get_std__optional_bool_(newValue)
325
+ return __unwrapped
326
+ } else {
327
+ return nil
328
+ }
329
+ }()
330
+ }
331
+ }
332
+
309
333
  public final var onMessage: bridge.std__optional_std__function_void_const_std__string_____message______ {
310
334
  @inline(__always)
311
335
  get {
@@ -30,6 +30,8 @@ namespace margelo::nitro::chartwebview {
30
30
  prototype.registerHybridSetter("pooled", &HybridChartWebviewSpec::setPooled);
31
31
  prototype.registerHybridGetter("active", &HybridChartWebviewSpec::getActive);
32
32
  prototype.registerHybridSetter("active", &HybridChartWebviewSpec::setActive);
33
+ prototype.registerHybridGetter("webviewDebuggingEnabled", &HybridChartWebviewSpec::getWebviewDebuggingEnabled);
34
+ prototype.registerHybridSetter("webviewDebuggingEnabled", &HybridChartWebviewSpec::setWebviewDebuggingEnabled);
33
35
  prototype.registerHybridGetter("onMessage", &HybridChartWebviewSpec::getOnMessage);
34
36
  prototype.registerHybridSetter("onMessage", &HybridChartWebviewSpec::setOnMessage);
35
37
  prototype.registerHybridGetter("onLoadEnd", &HybridChartWebviewSpec::getOnLoadEnd);
@@ -62,6 +62,8 @@ namespace margelo::nitro::chartwebview {
62
62
  virtual void setPooled(std::optional<bool> pooled) = 0;
63
63
  virtual std::optional<bool> getActive() = 0;
64
64
  virtual void setActive(std::optional<bool> active) = 0;
65
+ virtual std::optional<bool> getWebviewDebuggingEnabled() = 0;
66
+ virtual void setWebviewDebuggingEnabled(std::optional<bool> webviewDebuggingEnabled) = 0;
65
67
  virtual std::optional<std::function<void(const std::string& /* message */)>> getOnMessage() = 0;
66
68
  virtual void setOnMessage(const std::optional<std::function<void(const std::string& /* message */)>>& onMessage) = 0;
67
69
  virtual std::optional<std::function<void()>> getOnLoadEnd() = 0;
@@ -105,6 +105,16 @@ namespace margelo::nitro::chartwebview::views {
105
105
  throw std::runtime_error(std::string("ChartWebview.active: ") + exc.what());
106
106
  }
107
107
  }()),
108
+ webviewDebuggingEnabled([&]() -> CachedProp<std::optional<bool>> {
109
+ try {
110
+ const react::RawValue* rawValue = rawProps.at("webviewDebuggingEnabled", nullptr, nullptr);
111
+ if (rawValue == nullptr) return sourceProps.webviewDebuggingEnabled;
112
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
113
+ return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.webviewDebuggingEnabled);
114
+ } catch (const std::exception& exc) {
115
+ throw std::runtime_error(std::string("ChartWebview.webviewDebuggingEnabled: ") + exc.what());
116
+ }
117
+ }()),
108
118
  onMessage([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> {
109
119
  try {
110
120
  const react::RawValue* rawValue = rawProps.at("onMessage", nullptr, nullptr);
@@ -156,6 +166,7 @@ namespace margelo::nitro::chartwebview::views {
156
166
  reuseKey(other.reuseKey),
157
167
  pooled(other.pooled),
158
168
  active(other.active),
169
+ webviewDebuggingEnabled(other.webviewDebuggingEnabled),
159
170
  onMessage(other.onMessage),
160
171
  onLoadEnd(other.onLoadEnd),
161
172
  onError(other.onError),
@@ -171,6 +182,7 @@ namespace margelo::nitro::chartwebview::views {
171
182
  case hashString("reuseKey"): return true;
172
183
  case hashString("pooled"): return true;
173
184
  case hashString("active"): return true;
185
+ case hashString("webviewDebuggingEnabled"): return true;
174
186
  case hashString("onMessage"): return true;
175
187
  case hashString("onLoadEnd"): return true;
176
188
  case hashString("onError"): return true;
@@ -51,6 +51,7 @@ namespace margelo::nitro::chartwebview::views {
51
51
  CachedProp<std::optional<std::string>> reuseKey;
52
52
  CachedProp<std::optional<bool>> pooled;
53
53
  CachedProp<std::optional<bool>> active;
54
+ CachedProp<std::optional<bool>> webviewDebuggingEnabled;
54
55
  CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> onMessage;
55
56
  CachedProp<std::optional<std::function<void()>>> onLoadEnd;
56
57
  CachedProp<std::optional<std::function<void(const std::string& /* message */)>>> onError;
@@ -12,6 +12,7 @@
12
12
  "reuseKey": true,
13
13
  "pooled": true,
14
14
  "active": true,
15
+ "webviewDebuggingEnabled": true,
15
16
  "onMessage": true,
16
17
  "onLoadEnd": true,
17
18
  "onError": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-chart-webview",
3
- "version": "3.0.54",
3
+ "version": "3.0.56",
4
4
  "description": "react-native-chart-webview",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -39,6 +39,16 @@ export interface ChartWebviewProps extends HybridViewProps {
39
39
  // hardcodes `setIsActive`/`getIsActive`, causing a NoSuchMethodError at runtime.
40
40
  active?: boolean;
41
41
 
42
+ // --- Debugging ---
43
+ // Make the backing WebView inspectable (Safari Web Inspector on iOS,
44
+ // chrome://inspect on Android). Driven by the app's "Enable Native Webview
45
+ // Debugging" dev-mode toggle, mirroring how the main react-native-webview
46
+ // honors it. When omitted, the native side defaults to its dev-build default
47
+ // (iOS DEBUG / Android leaves it off). NOTE (Android): the underlying call
48
+ // WebView.setWebContentsDebuggingEnabled is PROCESS-GLOBAL — once any WebView
49
+ // enables it, it stays enabled process-wide until the app is killed.
50
+ webviewDebuggingEnabled?: boolean;
51
+
42
52
  // --- Events ---
43
53
  // page -> JS, raw JSON string (the JS layer parses the $private payload).
44
54
  onMessage?: (message: string) => void;