Skip to content

Commit 1d886cf

Browse files
authored
fix(🐎): fix Reanimated ArrayBuffer unmarshalling (#3384)
1 parent de551eb commit 1d886cf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/skia/cpp/api/recorder/Convertor.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,22 @@ SkColor getPropertyValue(jsi::Runtime &runtime, const jsi::Value &value) {
160160
auto a = array.getValueAtIndex(runtime, 3).asNumber();
161161
return SkColorSetARGB(a * 255, r * 255, g * 255, b * 255);
162162
}
163+
164+
// Check for properties "0", "1", "2", "3" (even if not an array)
165+
auto prop0 = jsi::PropNameID::forAscii(runtime, "0");
166+
auto prop1 = jsi::PropNameID::forAscii(runtime, "1");
167+
auto prop2 = jsi::PropNameID::forAscii(runtime, "2");
168+
auto prop3 = jsi::PropNameID::forAscii(runtime, "3");
169+
if (object.hasProperty(runtime, prop0) &&
170+
object.hasProperty(runtime, prop1) &&
171+
object.hasProperty(runtime, prop2) &&
172+
object.hasProperty(runtime, prop3)) {
173+
auto r = object.getProperty(runtime, prop0).asNumber();
174+
auto g = object.getProperty(runtime, prop1).asNumber();
175+
auto b = object.getProperty(runtime, prop2).asNumber();
176+
auto a = object.getProperty(runtime, prop3).asNumber();
177+
return SkColorSetARGB(a * 255, r * 255, g * 255, b * 255);
178+
}
163179
jsi::ArrayBuffer buffer =
164180
object
165181
.getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer"))

0 commit comments

Comments
 (0)