Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add react-native 0.72 support #182

Merged
merged 2 commits into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
rn-version: ['0.71']
rn-version: ['0.72', '0.71']
v8-android-variant:
[v8-android-jit, v8-android-jit-nointl, v8-android, v8-android-nointl]
# include:
Expand Down
16 changes: 16 additions & 0 deletions src/v8runtime/V8Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,11 @@ bool V8Runtime::hasProperty(
}

void V8Runtime::setPropertyValue(
#if REACT_NATIVE_TARGET_VERSION >= 72
const jsi::Object &object,
#else
jsi::Object &object,
#endif
const jsi::PropNameID &name,
const jsi::Value &value) {
v8::Locker locker(isolate_);
Expand All @@ -1098,7 +1102,11 @@ void V8Runtime::setPropertyValue(
}

void V8Runtime::setPropertyValue(
#if REACT_NATIVE_TARGET_VERSION >= 72
const jsi::Object &object,
#else
jsi::Object &object,
#endif
const jsi::String &name,
const jsi::Value &value) {
v8::Locker locker(isolate_);
Expand Down Expand Up @@ -1220,7 +1228,11 @@ jsi::WeakObject V8Runtime::createWeakObject(const jsi::Object &weakObject) {
new V8PointerValue(isolate_, std::move(weakRef)));
}

#if REACT_NATIVE_TARGET_VERSION >= 72
jsi::Value V8Runtime::lockWeakObject(const jsi::WeakObject &weakObject) {
#else
jsi::Value V8Runtime::lockWeakObject(jsi::WeakObject &weakObject) {
#endif
v8::Locker locker(isolate_);
v8::Isolate::Scope scopedIsolate(isolate_);
v8::HandleScope scopedHandle(isolate_);
Expand Down Expand Up @@ -1302,7 +1314,11 @@ jsi::Value V8Runtime::getValueAtIndex(const jsi::Array &array, size_t i) {
}

void V8Runtime::setValueAtIndexImpl(
#if REACT_NATIVE_TARGET_VERSION >= 72
const jsi::Array &array,
#else
jsi::Array &array,
#endif
size_t i,
const jsi::Value &value) {
v8::Locker locker(isolate_);
Expand Down
23 changes: 23 additions & 0 deletions src/v8runtime/V8Runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ class V8Runtime : public facebook::jsi::Runtime {
bool hasProperty(
const facebook::jsi::Object &,
const facebook::jsi::String &name) override;
#if REACT_NATIVE_TARGET_VERSION >= 72
void setPropertyValue(
const facebook::jsi::Object &,
const facebook::jsi::PropNameID &name,
const facebook::jsi::Value &value) override;
void setPropertyValue(
const facebook::jsi::Object &,
const facebook::jsi::String &name,
const facebook::jsi::Value &value) override;
#else
void setPropertyValue(
facebook::jsi::Object &,
const facebook::jsi::PropNameID &name,
Expand All @@ -158,6 +168,7 @@ class V8Runtime : public facebook::jsi::Runtime {
facebook::jsi::Object &,
const facebook::jsi::String &name,
const facebook::jsi::Value &value) override;
#endif

bool isArray(const facebook::jsi::Object &) const override;
bool isArrayBuffer(const facebook::jsi::Object &) const override;
Expand All @@ -168,7 +179,12 @@ class V8Runtime : public facebook::jsi::Runtime {

facebook::jsi::WeakObject createWeakObject(
const facebook::jsi::Object &) override;
#if REACT_NATIVE_TARGET_VERSION >= 72
facebook::jsi::Value lockWeakObject(
const facebook::jsi::WeakObject &) override;
#else
facebook::jsi::Value lockWeakObject(facebook::jsi::WeakObject &) override;
#endif

facebook::jsi::Array createArray(size_t length) override;
facebook::jsi::ArrayBuffer createArrayBuffer(
Expand All @@ -178,10 +194,17 @@ class V8Runtime : public facebook::jsi::Runtime {
uint8_t *data(const facebook::jsi::ArrayBuffer &) override;
facebook::jsi::Value getValueAtIndex(const facebook::jsi::Array &, size_t i)
override;
#if REACT_NATIVE_TARGET_VERSION >= 72
void setValueAtIndexImpl(
const facebook::jsi::Array &,
size_t i,
const facebook::jsi::Value &value) override;
#else
void setValueAtIndexImpl(
facebook::jsi::Array &,
size_t i,
const facebook::jsi::Value &value) override;
#endif

facebook::jsi::Function createFunctionFromHostFunction(
const facebook::jsi::PropNameID &name,
Expand Down