From 1bf2f72abe7100b14df45e15e13924311369f4ff Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 8 Oct 2019 09:02:56 -0700 Subject: [PATCH] Add support for commands Summary: We need commands to work with `LegacyViewManagerInterop`. We will need to rethink this once Fabric has command-execution pipeline in place. Reviewed By: shergin Differential Revision: D17787294 fbshipit-source-id: a6b3dbfae41f04e7e7f5bafb1f7b4ad0de0eedc3 --- .../RCTLegacyViewManagerInteropComponentView.mm | 7 +++++++ .../RCTLegacyViewManagerInteropCoordinator.h | 2 ++ .../RCTLegacyViewManagerInteropCoordinator.mm | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/React/Fabric/Mounting/ComponentViews/InteropView/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/InteropView/RCTLegacyViewManagerInteropComponentView.mm index 3d769fd9107..3495a35a63d 100644 --- a/React/Fabric/Mounting/ComponentViews/InteropView/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InteropView/RCTLegacyViewManagerInteropComponentView.mm @@ -46,6 +46,13 @@ using namespace facebook::react; } } +- (NSString *)componentViewName_DO_NOT_USE_THIS_IS_BROKEN +{ + const auto &state = _state->getData(); + RCTLegacyViewManagerInteropCoordinator *coordinator = unwrapManagedObject(state.coordinator); + return coordinator.componentViewName; +} + #pragma mark - RCTComponentViewProtocol + (ComponentDescriptorProvider)componentDescriptorProvider diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h b/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h index 7a44725cb39..b8b512a9a61 100644 --- a/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +++ b/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h @@ -23,6 +23,8 @@ typedef void (^InterceptorBlock)(std::string eventName, folly::dynamic event); - (void)setProps:(folly::dynamic const &)props forView:(UIView *)view; +- (NSString *)componentViewName; + @end NS_ASSUME_NONNULL_END diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm b/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm index 9a41afa46ec..bf0b2052d28 100644 --- a/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +++ b/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm @@ -8,6 +8,7 @@ #include "RCTLegacyViewManagerInteropCoordinator.h" #include #include +#include #include using namespace facebook::react; @@ -54,4 +55,9 @@ using namespace facebook::react; [_componentData setProps:convertedProps forView:view]; } +- (NSString *)componentViewName +{ + return RCTDropReactPrefixes(_componentData.name); +} + @end