@goliapkg/sentori-react-native 1.0.0-rc.4 → 1.0.0-rc.5

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.
@@ -1,6 +1,10 @@
1
1
  package com.sentori
2
2
 
3
3
  import android.app.Activity
4
+ import android.graphics.drawable.ColorDrawable
5
+ import android.graphics.drawable.Drawable
6
+ import android.graphics.drawable.GradientDrawable
7
+ import android.graphics.drawable.RippleDrawable
4
8
  import android.view.View
5
9
  import android.view.ViewGroup
6
10
  import android.widget.EditText
@@ -214,8 +218,18 @@ object SentoriReplayCapture {
214
218
  }
215
219
  view.background != null -> {
216
220
  node.put("kind", "rect")
217
- // Background drawables don't always expose color directly.
218
- // Skip color for non-ColorDrawable; renderer falls back to neutral.
221
+ // rc.5 extract the fill colour from the
222
+ // background Drawable so wireframes show the host
223
+ // app's actual brand palette, not a uniform grey
224
+ // grid. iOS' UIView.backgroundColor already drives
225
+ // this path; the Android side had been emitting
226
+ // null since v0.9.6 and the dashboard fell back to
227
+ // a neutral fill for every coloured CTA. Insight
228
+ // 2026-05-18 verify event made the gap visible.
229
+ val color = extractDrawableColor(view.background)
230
+ if (color != null && (color shr 24 and 0xff) != 0) {
231
+ node.put("color", colorToHex(color))
232
+ }
219
233
  kindEmitted = true
220
234
  }
221
235
  }
@@ -241,4 +255,40 @@ object SentoriReplayCapture {
241
255
  val b = c and 0xff
242
256
  return String.format("#%02X%02X%02X%02X", r, g, b, a)
243
257
  }
258
+
259
+ /** rc.5 — best-effort fill-colour extraction for the View's
260
+ * background Drawable. RN's `backgroundColor: '#...'` style
261
+ * lands as a ColorDrawable in flat cases and a GradientDrawable
262
+ * whenever the View also carries `borderRadius` or
263
+ * `borderWidth`; Pressables wrap the painted child in a
264
+ * RippleDrawable layer list. We cover all three. Returns
265
+ * the packed ARGB int or null when nothing usable is exposed
266
+ * (StateListDrawable with no current state, opaque image
267
+ * drawables, etc.). */
268
+ private fun extractDrawableColor(drawable: Drawable?): Int? {
269
+ return when (drawable) {
270
+ null -> null
271
+ is ColorDrawable -> drawable.color
272
+ is GradientDrawable -> {
273
+ // API 24+ exposes the ColorStateList for the
274
+ // `setColor()` value. RN's typical solid-colour
275
+ // GradientDrawable returns a single default colour
276
+ // here; gradients with multiple stops still surface
277
+ // a reasonable representative colour.
278
+ val csl = drawable.color
279
+ csl?.defaultColor
280
+ }
281
+ is RippleDrawable -> {
282
+ // Iterate the layer list; the inner painted layer
283
+ // is what carries the brand colour.
284
+ for (i in 0 until drawable.numberOfLayers) {
285
+ val inner = drawable.getDrawable(i)
286
+ val c = extractDrawableColor(inner)
287
+ if (c != null && (c shr 24 and 0xff) != 0) return c
288
+ }
289
+ null
290
+ }
291
+ else -> null
292
+ }
293
+ }
244
294
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goliapkg/sentori-react-native",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.0.0-rc.5",
4
4
  "description": "Sentori SDK for React Native \u2014 JS-layer error capture, native crash handlers (iOS / Android), batched transport, fetch + react-navigation tracing.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://sentori.golia.jp",