mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
EventTarget (native)/InstanceHandle (JS) is not optional, assert that it's non-null
Summary: When EventTarget is created in createNode, it's currently treated as optional in native, but it's not optional in JS. We should assert that it's non-null to make the contract more clear. For now, we keep it as an assert so we catch issues in debug/dev, but it won't impact prod. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D27002506 fbshipit-source-id: c541dc02d3de22df19292deaef1a3b68fe57ba1f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
423453e105
commit
3b0800a49a
@@ -10,6 +10,7 @@
|
||||
#include <folly/dynamic.h>
|
||||
#include <jsi/JSIDynamic.h>
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/renderer/core/EventHandler.h>
|
||||
#include <react/renderer/core/ShadowNode.h>
|
||||
|
||||
@@ -110,6 +111,7 @@ inline static SharedEventTarget eventTargetFromValue(
|
||||
jsi::Runtime &runtime,
|
||||
jsi::Value const &eventTargetValue,
|
||||
jsi::Value const &tagValue) {
|
||||
react_native_assert(!eventTargetValue.isNull());
|
||||
if (eventTargetValue.isNull()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user