mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Don't error to Logview APIs not supported by new architecture that are expected to happen often
Summary: Changelog: [Internal] In the new architecture, when an interop component is being called, log instead of warn/error, since at the moment we expect this to happen often. Reviewed By: fkgozali Differential Revision: D34252666 fbshipit-source-id: 971156a1cd9ef9b788f677c49fa2c55bd86ad4fa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f11dcfaea1
commit
af793dd14d
@@ -118,8 +118,7 @@ module.exports = {
|
||||
console.error(errorMessageForMethod('measureLayoutRelativeToParent')),
|
||||
setJSResponder: (reactTag: ?number, blockNativeResponder: boolean): void =>
|
||||
console.error(errorMessageForMethod('setJSResponder')),
|
||||
clearJSResponder: (): void =>
|
||||
console.error(errorMessageForMethod('clearJSResponder')),
|
||||
clearJSResponder: (): void => {}, // Don't log error here because we're aware it gets called
|
||||
configureNextLayoutAnimation: (
|
||||
config: Object,
|
||||
callback: () => void,
|
||||
|
||||
@@ -186,3 +186,5 @@ __attribute__((used)) RCT_EXTERN void RCTEnforceNotAllowedForNewArchitecture(id
|
||||
// When reporting is enabled, trigger an error but do not crash. Use this to prepare a specific callsite
|
||||
// for stricter enforcement. When ready, switch it to use the variant above.
|
||||
__attribute__((used)) RCT_EXTERN void RCTErrorNotAllowedForNewArchitecture(id context, NSString *extra);
|
||||
// When reporting is enabled, log an message. When ready, switch it to use the variant above.
|
||||
__attribute__((used)) RCT_EXTERN void RCTLogNotAllowedForNewArchitecture(id context, NSString *extra);
|
||||
|
||||
@@ -282,3 +282,12 @@ void RCTErrorNotAllowedForNewArchitecture(id context, NSString *extra)
|
||||
|
||||
RCTLogError(@"%@", getNewArchitectureViolationMessage(context, extra));
|
||||
}
|
||||
|
||||
void RCTLogNotAllowedForNewArchitecture(id context, NSString *extra)
|
||||
{
|
||||
if (!newArchitectureViolationReporting) {
|
||||
return;
|
||||
}
|
||||
|
||||
RCTLogInfo(@"%@", getNewArchitectureViolationMessage(context, extra));
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ NSArray<Class> *RCTGetModuleClasses(void)
|
||||
void RCTRegisterModule(Class);
|
||||
void RCTRegisterModule(Class moduleClass)
|
||||
{
|
||||
RCTErrorNotAllowedForNewArchitecture(
|
||||
RCTLogNotAllowedForNewArchitecture(
|
||||
@"RCTRegisterModule()", [NSString stringWithFormat:@"'%@' was registered unexpectedly", moduleClass]);
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
|
||||
+6
-2
@@ -29,8 +29,6 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
RCTErrorNotAllowedForNewArchitecture(
|
||||
self, @"ViewManager with interop layer is not allowed in the new architecture.");
|
||||
static const auto defaultProps = std::make_shared<const LegacyViewManagerInteropViewProps>();
|
||||
_props = defaultProps;
|
||||
_viewsToBeMounted = [NSMutableArray new];
|
||||
@@ -67,6 +65,12 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
|
||||
|
||||
+ (BOOL)isSupported:(NSString *)componentName
|
||||
{
|
||||
RCTLogNotAllowedForNewArchitecture(
|
||||
self,
|
||||
[NSString
|
||||
stringWithFormat:
|
||||
@"Legacy ViewManagers should be migrated to Fabric ComponentViews in the new architecture to reduce risk. Component using interop layer: %@",
|
||||
componentName]);
|
||||
return [[RCTLegacyViewManagerInteropComponentView supportedViewManagers] containsObject:componentName];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user