Skip to content

Commit

Permalink
set native state
Browse files Browse the repository at this point in the history
  • Loading branch information
tjzel committed May 17, 2024
1 parent adec927 commit bbcb11f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Common/cpp/SharedItems/Shareables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,16 @@ jsi::Value ShareableObject::toJSValue(jsi::Runtime &rt) {
rt, data_[i].first.c_str(), data_[i].second->getJSValue(rt));
}
if (nativeState_ != nullptr) {
obj.setNativeState(rt, nativeState_);
if (nativeStateAccess_ == NativeStateAccess::Safe) {
obj.setNativeState(rt, nativeState_);
} else if (nativeStateAccess_ == NativeStateAccess::Unknown) {
try {
obj.setNativeState(rt, nativeState_);
nativeStateAccess_ = NativeStateAccess::Safe;
} catch (...) {
nativeStateAccess_ = NativeStateAccess::Unsafe;
}
}
}
return obj;
}
Expand Down

0 comments on commit bbcb11f

Please sign in to comment.