Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/react-native/ReactCommon/jsc/JSCRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,14 @@ void JSCRuntime::setPropertyValue(
}

bool JSCRuntime::isArray(const jsi::Object& obj) const {
return JSValueIsArray(ctx_, objectRef(obj));
// JSValueIsArray only returns true if the object is a JS array. There's no
// public JSC API equivalent to Array.isArray, so we call the JS function
// through JSI directly.
auto constRt = const_cast<JSCRuntime*>(this);
auto isArrayFn = constRt->global()
.getPropertyAsObject(*constRt, "Array")
.getPropertyAsFunction(*constRt, "isArray");
return isArrayFn.call(*constRt, obj).asBool();
}

bool JSCRuntime::isArrayBuffer(const jsi::Object& obj) const {
Expand Down
Loading