Fabric: Temporary workaround to enable commands in Fabric
Summary: This is a temporary workaround that we need only temporary and will get rid of soon. Reviewed By: mdvacca Differential Revision: D15501203 fbshipit-source-id: cec4891b6a185ea9e39f50bfedf9e1dae8993b66
This commit is contained in:
Родитель
d88e4701fc
Коммит
94dfc153a4
|
@ -79,6 +79,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask NS_REQUIRES_SUPER;
|
||||
- (void)prepareForRecycle NS_REQUIRES_SUPER;
|
||||
|
||||
/*
|
||||
* This is a fragment of temporary workaround that we need only temporary and will get rid of soon.
|
||||
*/
|
||||
- (NSString *)componentViewName_DO_NOT_USE_THIS_IS_BROKEN;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -564,4 +564,9 @@ static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
|
|||
return _eventEmitter;
|
||||
}
|
||||
|
||||
- (NSString *)componentViewName_DO_NOT_USE_THIS_IS_BROKEN
|
||||
{
|
||||
return RCTNSStringFromString([[self class] componentDescriptorProvider].name);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1065,6 +1065,25 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand:(nonnull NSNumber *)reactTag
|
|||
{
|
||||
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
|
||||
RCTComponentData *componentData = _componentDataByName[shadowView.viewName];
|
||||
|
||||
// Achtung! Achtung!
|
||||
// This is a remarkably hacky and ugly workaround.
|
||||
// We need this only temporary for some testing. We need this hack until Fabric fully implements command-execution pipeline.
|
||||
// This does not affect non-Fabric apps.
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wundeclared-selector"
|
||||
if (!componentData) {
|
||||
__block UIView *view;
|
||||
RCTUnsafeExecuteOnMainQueueSync(^{
|
||||
view = self->_viewRegistry[reactTag];
|
||||
});
|
||||
if ([view respondsToSelector:@selector(componentViewName_DO_NOT_USE_THIS_IS_BROKEN)]) {
|
||||
NSString *name = [view performSelector:@selector(componentViewName_DO_NOT_USE_THIS_IS_BROKEN)];
|
||||
componentData = _componentDataByName[[NSString stringWithFormat:@"RCT%@", name]];
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
Class managerClass = componentData.managerClass;
|
||||
RCTModuleData *moduleData = [_bridge moduleDataForName:RCTBridgeModuleNameForClass(managerClass)];
|
||||
id<RCTBridgeMethod> method = moduleData.methods[commandID];
|
||||
|
|
Загрузка…
Ссылка в новой задаче