Skip to content

Commit

Permalink
Fix Float32Array check
Browse files Browse the repository at this point in the history
  • Loading branch information
louix committed Jan 17, 2024
1 parent cad5a03 commit 7d41178
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions package/cpp/api/JsiSkColor.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ class JsiSkColor : public RNJsi::JsiHostObject {
runtime, SkColorSetARGB(color.a * 255, color.r, color.g, color.b));
} else if (arguments[0].isObject()) {
auto obj = arguments[0].getObject(runtime);
if (obj.isArrayBuffer(runtime)) {
return obj;
} else if (obj.isArray(runtime)) {
if (obj.isArray(runtime)) {
auto array = obj.asArray(runtime);
double r = std::clamp(array.getValueAtIndex(runtime, 0).getNumber(),
0.0, 255.0);
Expand All @@ -90,6 +88,8 @@ class JsiSkColor : public RNJsi::JsiHostObject {
double a = std::clamp(array.getValueAtIndex(runtime, 3).getNumber(),
0.0, 255.0);
return JsiSkColor::toValue(runtime, SkColorSetARGB(a, r, g, b));
} else if (obj.hasProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer"))) {
return obj;
}
}
return jsi::Value::undefined();
Expand Down

0 comments on commit 7d41178

Please sign in to comment.