Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,21 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &

#ifndef NS_BLOCK_ASSERTIONS
auto propsRawPtr = _props.get();
RCTAssert(
propsRawPtr &&
([self class] == [RCTViewComponentView class] ||
typeid(*propsRawPtr).hash_code() != typeid(const ViewProps).hash_code()),
@"`RCTViewComponentView` subclasses (and `%@` particularly) must setup `_props`"
" instance variable with a default value in the constructor.",
NSStringFromClass([self class]));
// SOFTENED: third-party component views that reset _props to base ViewProps
// in prepareForRecycle (observed: react-native-maps RNMapsGoogleMapView) can
// receive updateProps with base ViewProps on the deep-link mount path
// (RN 0.88 + new arch). Aborting there takes the whole app down on a
// diagnostic-only invariant, and the static_casts below are valid for base
// ViewProps anyway. Log instead of abort.
if (!(propsRawPtr &&
([self class] == [RCTViewComponentView class] ||
typeid(*propsRawPtr).hash_code() != typeid(const ViewProps).hash_code()))) {
RCTLogError(
@"`RCTViewComponentView` subclass `%@` received updateProps with base "
"ViewProps (_props not set by the subclass constructor or recycled). "
"Continuing with base props.",
NSStringFromClass([self class]));
}
#endif

const auto &oldViewProps = static_cast<const ViewProps &>(*_props);
Expand Down
Loading