From d9e7be76cd5bcb97da7c86d9e78d0a864aaea425 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sat, 10 Dec 2022 10:30:47 -0800 Subject: [PATCH] Delete ComponentDeprecatedAPI Summary: Deletes references to ComponentDeprecatedAPI in favour of Component API changelog: [internal] internal Reviewed By: rshest Differential Revision: D41638892 fbshipit-source-id: c83b2303650475aa59b438e46e96f976db586a27 --- .../cxxcomponents/ComponentDeprecatedAPI.h | 61 ------------------- .../react/cxxcomponents/ComponentManager.h | 5 -- .../jni/react/fabric/CppComponentRegistry.cpp | 21 ------- .../jni/react/fabric/CppComponentRegistry.h | 13 ---- 4 files changed, 100 deletions(-) delete mode 100644 ReactAndroid/src/main/jni/react/cxxcomponents/ComponentDeprecatedAPI.h diff --git a/ReactAndroid/src/main/jni/react/cxxcomponents/ComponentDeprecatedAPI.h b/ReactAndroid/src/main/jni/react/cxxcomponents/ComponentDeprecatedAPI.h deleted file mode 100644 index e6eed080549..00000000000 --- a/ReactAndroid/src/main/jni/react/cxxcomponents/ComponentDeprecatedAPI.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include - -namespace facebook::react { - -class ComponentDeprecatedAPI { - public: - ComponentDeprecatedAPI(Tag tag, Props::Shared initialProps) - : tag_(tag), props_(std::move(initialProps)) {} - - virtual ~ComponentDeprecatedAPI() = default; - - /* - * Called for updating component's props. - * Receiver must update native view props accordingly changed props. - */ - virtual void updateProps( - Props::Shared const &oldProps, - Props::Shared const &newProps) = 0; - - /* - * Called for mounting (attaching) a child component view inside `self` - * component view. - * Receiver must add `childComponent` as a sub component. - */ - virtual void mountChildComponent( - std::shared_ptr childComponent, - int index){}; - - /* - * Called for unmounting (detaching) a child component view from `self` - * component view. - * Receiver must remove `childComponent` from a sub component - */ - virtual void unmountChildComponent( - std::shared_ptr childComponent, - int index){}; - - /* - * Called for updating component's state. - * Receiver must update native view according to changed state. - */ - virtual void updateState(){}; - - protected: - Tag tag_ = -1; - Props::Shared props_; -}; - -} // namespace facebook::react diff --git a/ReactAndroid/src/main/jni/react/cxxcomponents/ComponentManager.h b/ReactAndroid/src/main/jni/react/cxxcomponents/ComponentManager.h index 0c870fa5f61..aae9290839a 100644 --- a/ReactAndroid/src/main/jni/react/cxxcomponents/ComponentManager.h +++ b/ReactAndroid/src/main/jni/react/cxxcomponents/ComponentManager.h @@ -8,7 +8,6 @@ #pragma once #include -#include #include namespace facebook::react { @@ -17,10 +16,6 @@ class ComponentManager { public: ComponentManager() {} - virtual std::shared_ptr createComponent( - Tag tag, - Props::Shared initialProps) = 0; - virtual std::shared_ptr createComponent(Tag tag) = 0; virtual ~ComponentManager() = default; diff --git a/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.cpp b/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.cpp index 43cc9a440ae..1a02370284c 100644 --- a/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.cpp +++ b/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.cpp @@ -42,30 +42,9 @@ CppComponentRegistry::getComponentManager(const std::string &name) const { return componentManagerResolver_.getComponentManager(name); } -std::shared_ptr -CppComponentRegistry::getComponentInstance(Tag tag) const { - return components_[tag]; -} - bool CppComponentRegistry::isRootComponent(std::string name) const { return componentManagerResolver_.isRootComponent(name); } -std::shared_ptr -CppComponentRegistry::createComponentInstance( - const std::string &componentName, - Tag tag, - Props::Shared initialProps) const { - // TODO: cache component managers - auto componentManager = getComponentManager(componentName); - auto component = componentManager->createComponent(tag, initialProps); - components_[tag] = component; - return component; -} - -void CppComponentRegistry::deleteComponentInstance(Tag tag) const { - components_.erase(tag); -} - } // namespace react } // namespace facebook diff --git a/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.h b/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.h index 442e2d603c0..bc6fa330a0e 100644 --- a/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.h +++ b/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.h @@ -14,7 +14,6 @@ #include #include -#include #include #include @@ -43,23 +42,11 @@ class CppComponentRegistry : public jni::HybridClass { std::shared_ptr getComponentManager( const std::string &name) const; - std::shared_ptr getComponentInstance( - Tag tag) const; - - std::shared_ptr - createComponentInstance( - const std::string &componentName, - Tag tag, - Props::Shared initialProps) const; - void deleteComponentInstance(Tag tag) const; private: static jni::local_ref initHybrid(jni::alias_ref); ComponentRegistryResolver componentManagerResolver_{}; - mutable butter:: - map> - components_{}; }; } // namespace react