diff --git a/packages/rn-tester/BUCK b/packages/rn-tester/BUCK index 0e8402e1dc4474..1fa18acfb8f0c9 100644 --- a/packages/rn-tester/BUCK +++ b/packages/rn-tester/BUCK @@ -51,7 +51,6 @@ rn_library( "js", "NativeModuleExample", "NativeComponentExample", - "NativeComponentWithState", "RCTTest", ], excludes = [ @@ -85,7 +84,6 @@ fb_native.filegroup( ], exclude = [ "NativeComponentExample/**/*", - "NativeComponentWithState/**/*", ], ), visibility = ["PUBLIC"], @@ -322,42 +320,3 @@ rn_xplat_cxx_library2( "//xplat/js/react-native-github:RCTFabricComponentViewsBase", ], ) - -rn_xplat_cxx_library2( - name = "NativeComponentWithState", - plugins_only = True, - srcs = glob( - [ - "NativeComponentWithState/ios/*.m", - "NativeComponentWithState/ios/*.mm", - "NativeComponentWithState/ios/*.cpp", - ], - ), - headers = glob( - [ - "NativeComponentWithState/ios/*.h", - ], - ), - header_namespace = "", - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++17", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - labels = [ - "pfh:ReactNative_CommonInfrastructurePlaceholder", - "supermodule:xplat/default/public.react_native.infra", - ], - plugins = [ - react_fabric_component_plugin_provider("RNTNativeComponentWithStateView", "RNTNativeComponentWithStateCls"), - ], - plugins_header = "RCTFabricComponentsPlugins.h", - reexport_all_header_dependencies = False, - visibility = ["PUBLIC"], - deps = [ - ":generated_components-AppSpecs", - "//xplat/js/react-native-github:RCTFabricComponentViewsBase", - ], -) diff --git a/packages/rn-tester/NativeComponentWithState/NativeComponentWithState.podspec b/packages/rn-tester/NativeComponentWithState/NativeComponentWithState.podspec deleted file mode 100644 index 264743e9812489..00000000000000 --- a/packages/rn-tester/NativeComponentWithState/NativeComponentWithState.podspec +++ /dev/null @@ -1,38 +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. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "../" "package.json"))) - -Pod::Spec.new do |s| - s.name = "NativeComponentWithState" - s.version = package["version"] - s.summary = package["description"] - s.description = "native-component-with-state" - s.homepage = "https://github.com/sota000/my-native-view.git" - s.license = "MIT" - s.platforms = { :ios => "12.4", :tvos => "12.4" } - s.compiler_flags = '-Wno-documentation -Wno-nullability-completeness' - s.author = "Facebook, Inc. and its affiliates" - s.source = { :git => "https://github.com/facebook/my-native-view.git", :tag => "#{s.version}" } - s.pod_target_xcconfig = { - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"", - "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" - } - - s.source_files = "{ios,cxx}/**/*.{h,m,mm,cpp}" - s.requires_arc = true - - install_modules_dependencies(s) - - # Enable codegen for this library - use_react_native_codegen!(s, { - :library_name => "NativeComponentWithStateSpec", - :react_native_path => "../../../", - :js_srcs_dir => "./js", - :library_type => "components" - }) -end diff --git a/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomComponentDescriptor.h b/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomComponentDescriptor.h deleted file mode 100644 index 988a1ac05966c9..00000000000000 --- a/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomComponentDescriptor.h +++ /dev/null @@ -1,45 +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. - */ - -#include -#include "RNTNativeComponentWithStateCustomShadowNode.h" - -namespace facebook { -namespace react { - -/* - * Descriptor for - * component. - */ -class RNTNativeComponentWithStateCustomComponentDescriptor final - : public ConcreteComponentDescriptor< - RNTNativeComponentWithStateCustomShadowNode> { - public: - RNTNativeComponentWithStateCustomComponentDescriptor( - ComponentDescriptorParameters const ¶meters) - : ConcreteComponentDescriptor(parameters), - imageManager_(std::make_shared(contextContainer_)) {} - - void adopt(ShadowNode::Unshared const &shadowNode) const override { - ConcreteComponentDescriptor::adopt(shadowNode); - - auto compShadowNode = - std::static_pointer_cast( - shadowNode); - - // `RNTNativeComponentWithStateCustomShadowNode` uses `ImageManager` to - // initiate image loading and communicate the loading state - // and results to mounting layer. - compShadowNode->setImageManager(imageManager_); - } - - private: - const SharedImageManager imageManager_; -}; - -} // namespace react -} // namespace facebook diff --git a/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomShadowNode.cpp b/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomShadowNode.cpp deleted file mode 100644 index 831eac6589a8dc..00000000000000 --- a/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomShadowNode.cpp +++ /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. - */ - -#include "RNTNativeComponentWithStateCustomShadowNode.h" - -#include - -namespace facebook { -namespace react { - -extern const char RNTNativeComponentWithStateComponentName[] = - "RNTNativeComponentWithState"; - -void RNTNativeComponentWithStateCustomShadowNode::setImageManager( - const SharedImageManager &imageManager) { - ensureUnsealed(); - imageManager_ = imageManager; -} - -void RNTNativeComponentWithStateCustomShadowNode::updateStateIfNeeded() { - const auto &newImageSource = getImageSource(); - - auto const ¤tState = getStateData(); - - auto imageSource = currentState.getImageSource(); - - bool anyChanged = newImageSource != imageSource; - - if (!anyChanged) { - return; - } - - // Now we are about to mutate the Shadow Node. - ensureUnsealed(); - - // It is not possible to copy or move image requests from SliderLocalData, - // so instead we recreate any image requests (that may already be in-flight?) - // TODO: check if multiple requests are cached or if it's a net loss - auto state = RNTNativeComponentWithStateState{ - newImageSource, - imageManager_->requestImage(newImageSource, getSurfaceId())}; - setStateData(std::move(state)); -} - -ImageSource RNTNativeComponentWithStateCustomShadowNode::getImageSource() - const { - return getConcreteProps().imageSource; -} - -void RNTNativeComponentWithStateCustomShadowNode::layout( - LayoutContext layoutContext) { - updateStateIfNeeded(); - ConcreteViewShadowNode::layout(layoutContext); -} - -} // namespace react -} // namespace facebook diff --git a/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomShadowNode.h b/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomShadowNode.h deleted file mode 100644 index 355733f3e9a245..00000000000000 --- a/packages/rn-tester/NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomShadowNode.h +++ /dev/null @@ -1,60 +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 -#include - -#include -#include - -namespace facebook { -namespace react { - -JSI_EXPORT extern const char RNTNativeComponentWithStateComponentName[]; - -/* - * `ShadowNode` for component. - */ -class RNTNativeComponentWithStateCustomShadowNode final - : public ConcreteViewShadowNode< - RNTNativeComponentWithStateComponentName, - RNTNativeComponentWithStateProps, - RNTNativeComponentWithStateEventEmitter, - RNTNativeComponentWithStateState> { - public: - using ConcreteViewShadowNode::ConcreteViewShadowNode; - - // Associates a shared `ImageManager` with the node. - void setImageManager(const SharedImageManager &imageManager); - - static RNTNativeComponentWithStateState initialStateData( - ShadowNodeFragment const &fragment, - ShadowNodeFamilyFragment const &familyFragment, - ComponentDescriptor const &componentDescriptor) { - auto imageSource = ImageSource{ImageSource::Type::Invalid}; - return {imageSource, {imageSource, nullptr}}; - } - -#pragma mark - LayoutableShadowNode - - void layout(LayoutContext layoutContext) override; - - private: - void updateStateIfNeeded(); - - ImageSource getImageSource() const; - - SharedImageManager imageManager_; -}; - -} // namespace react -} // namespace facebook diff --git a/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateView.h b/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateView.h deleted file mode 100644 index 7b736ea61f2f1f..00000000000000 --- a/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateView.h +++ /dev/null @@ -1,17 +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. - */ - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RNTNativeComponentWithStateView : RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateView.mm b/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateView.mm deleted file mode 100644 index 1af81940f8a49b..00000000000000 --- a/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateView.mm +++ /dev/null @@ -1,145 +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. - */ - -#import "RNTNativeComponentWithStateView.h" - -#import -#import -#import -#import -#import "RNTNativeComponentWithStateCustomComponentDescriptor.h" - -#import -#import - -#import "RCTFabricComponentsPlugins.h" - -using namespace facebook::react; - -@interface RNTNativeComponentWithStateView () -@end - -@implementation RNTNativeComponentWithStateView { - UIView *_view; - UIImageView *_imageView; - UIImage *_image; - ImageResponseObserverCoordinator const *_imageCoordinator; - RCTImageResponseObserverProxy _imageResponseObserverProxy; -} - -+ (ComponentDescriptorProvider)componentDescriptorProvider -{ - return concreteComponentDescriptorProvider(); -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - - _view = [[UIView alloc] init]; - _view.backgroundColor = [UIColor redColor]; - - _imageView = [[UIImageView alloc] init]; - [_view addSubview:_imageView]; - - _imageView.translatesAutoresizingMaskIntoConstraints = NO; - [NSLayoutConstraint activateConstraints:@[ - [_imageView.topAnchor constraintEqualToAnchor:_view.topAnchor constant:10], - [_imageView.leftAnchor constraintEqualToAnchor:_view.leftAnchor constant:10], - [_imageView.bottomAnchor constraintEqualToAnchor:_view.bottomAnchor constant:-10], - [_imageView.rightAnchor constraintEqualToAnchor:_view.rightAnchor constant:-10], - ]]; - _imageView.image = _image; - - _imageResponseObserverProxy = RCTImageResponseObserverProxy(self); - - self.contentView = _view; - } - - return self; -} - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - self.imageCoordinator = nullptr; - _image = nil; -} - -- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps -{ - [super updateProps:props oldProps:oldProps]; -} - -- (void)updateState:(facebook::react::State::Shared const &)state - oldState:(facebook::react::State::Shared const &)oldState -{ - auto _state = std::static_pointer_cast(state); - auto _oldState = std::static_pointer_cast(oldState); - - auto data = _state->getData(); - - bool havePreviousData = _oldState != nullptr; - - auto getCoordinator = [](ImageRequest const *request) -> ImageResponseObserverCoordinator const * { - if (request) { - return &request->getObserverCoordinator(); - } else { - return nullptr; - } - }; - - if (!havePreviousData || data.getImageSource() != _oldState->getData().getImageSource()) { - self.imageCoordinator = getCoordinator(&data.getImageRequest()); - } -} - -- (void)setImageCoordinator:(const ImageResponseObserverCoordinator *)coordinator -{ - if (_imageCoordinator) { - _imageCoordinator->removeObserver(_imageResponseObserverProxy); - } - _imageCoordinator = coordinator; - if (_imageCoordinator) { - _imageCoordinator->addObserver(_imageResponseObserverProxy); - } -} - -- (void)setImage:(UIImage *)image -{ - if ([image isEqual:_image]) { - return; - } - - _imageView.image = image; -} - -#pragma mark - RCTImageResponseDelegate - -- (void)didReceiveImage:(UIImage *)image metadata:(id)metadata fromObserver:(void const *)observer -{ - if (observer == &_imageResponseObserverProxy) { - self.image = image; - } -} - -- (void)didReceiveProgress:(float)progress fromObserver:(void const *)observer -{ -} - -- (void)didReceiveFailureFromObserver:(void const *)observer -{ -} - -@end - -Class RNTNativeComponentWithStateCls(void) -{ - return RNTNativeComponentWithStateView.class; -} diff --git a/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateViewManager.mm b/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateViewManager.mm deleted file mode 100644 index 4237e1538e7348..00000000000000 --- a/packages/rn-tester/NativeComponentWithState/ios/RNTNativeComponentWithStateViewManager.mm +++ /dev/null @@ -1,26 +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. - */ - -#import -#import -#import - -@interface RNTNativeComponentWithStateViewManager : RCTViewManager -@end - -@implementation RNTNativeComponentWithStateViewManager - -RCT_EXPORT_MODULE(RNTNativeComponentWithState) - -RCT_EXPORT_VIEW_PROPERTY(imageSource, UIImage *) - -- (UIView *)view -{ - return [[UIView alloc] init]; -} - -@end diff --git a/packages/rn-tester/NativeComponentWithState/js/NativeComponentWithState.js b/packages/rn-tester/NativeComponentWithState/js/NativeComponentWithState.js deleted file mode 100644 index 4663185c6854d9..00000000000000 --- a/packages/rn-tester/NativeComponentWithState/js/NativeComponentWithState.js +++ /dev/null @@ -1,32 +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. - * - * @flow strict-local - * @format - */ - -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; - -import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; -import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; - -type NativeProps = $ReadOnly<{| - ...ViewProps, - imageSource: ImageSource, -|}>; - -// The NativeState is not used in JS-land, so we don't have to export it. -// eslint-disable-next-line no-unused-vars -type ComponentNativeState = $ReadOnly<{| - imageSource: ImageSource, - //$FlowFixMe[cannot-resolve-name]: this type is not exposed in JS but we can use it in the Native State. - imageRequest: ImageRequest, -|}>; - -export default (codegenNativeComponent( - 'RNTNativeComponentWithState', -): HostComponent); diff --git a/packages/rn-tester/Podfile b/packages/rn-tester/Podfile index 1c9279c50c19ba..386a55c6e09131 100644 --- a/packages/rn-tester/Podfile +++ b/packages/rn-tester/Podfile @@ -28,7 +28,6 @@ def pods(options = {}, use_flipper: !IN_CI && !USE_FRAMEWORKS) if ENV['RCT_NEW_ARCH_ENABLED'] == '1' # Custom fabric component is only supported when using codegen discovery. pod 'MyNativeView', :path => "NativeComponentExample" - pod 'NativeComponentWithState', :path => "NativeComponentWithState" end use_react_native!( diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index cb0cf78326e88a..dbe96b11d6d167 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -959,7 +959,7 @@ SPEC CHECKSUMS: FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b - hermes-engine: 34601a4ede336b281b66fbcc4ec113c7813dbc9d + hermes-engine: 041c211d43030d9aeff8faa388c019d19e752172 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda @@ -1002,6 +1002,6 @@ SPEC CHECKSUMS: Yoga: 1b1a12ff3d86a10565ea7cbe057d42f5e5fb2a07 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 6e26aac84dafab208188a8c6e45de8b3cf2a9f62 +PODFILE CHECKSUM: e86c02825ce4e267e6fb3975bae791feb32a94a0 COCOAPODS: 1.11.3 diff --git a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java index d5247b0bb9a7a9..cdc5ac628282a9 100644 --- a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java +++ b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java @@ -23,11 +23,9 @@ import com.facebook.react.module.model.ReactModuleInfoProvider; import com.facebook.react.shell.MainReactPackage; import com.facebook.react.uiapp.component.MyNativeViewManager; -import com.facebook.react.uiapp.component.NativeViewWithStateManager; import com.facebook.react.uimanager.ViewManager; import com.facebook.react.views.text.ReactFontManager; import com.facebook.soloader.SoLoader; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -108,10 +106,7 @@ public List createNativeModules( @Override public List createViewManagers( @NonNull ReactApplicationContext reactContext) { - ArrayList list = new ArrayList(); - list.add(new MyNativeViewManager()); - list.add(new NativeViewWithStateManager()); - return list; + return Collections.singletonList(new MyNativeViewManager()); } }); } diff --git a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/componentWithState/NativeViewWithState.java b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/componentWithState/NativeViewWithState.java deleted file mode 100644 index dc99afad502ade..00000000000000 --- a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/componentWithState/NativeViewWithState.java +++ /dev/null @@ -1,27 +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. - */ - -package com.facebook.react.uiapp.component; - -import android.content.Context; -import android.net.Uri; -import androidx.annotation.Nullable; -import com.facebook.drawee.view.SimpleDraweeView; -import com.facebook.react.bridge.ReadableMap; - -class NativeViewWithState extends SimpleDraweeView { - - public NativeViewWithState(Context context) { - super(context); - } - - void setImageSource(@Nullable ReadableMap source) { - String uri = source != null ? source.getString("uri") : null; - Uri imageUri = Uri.parse(uri); - this.setImageURI(imageUri); - } -} diff --git a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/componentWithState/NativeViewWithStateManager.java b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/componentWithState/NativeViewWithStateManager.java deleted file mode 100644 index c3bb143ceb67d1..00000000000000 --- a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/componentWithState/NativeViewWithStateManager.java +++ /dev/null @@ -1,54 +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. - */ - -package com.facebook.react.uiapp.component; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.module.annotations.ReactModule; -import com.facebook.react.uimanager.SimpleViewManager; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.ViewManagerDelegate; -import com.facebook.react.uimanager.annotations.ReactProp; -import com.facebook.react.viewmanagers.RNTNativeComponentWithStateManagerDelegate; -import com.facebook.react.viewmanagers.RNTNativeComponentWithStateManagerInterface; - -/** View manager for {@link NativeViewVithState} components. */ -@ReactModule(name = NativeViewWithStateManager.REACT_CLASS) -public class NativeViewWithStateManager extends SimpleViewManager - implements RNTNativeComponentWithStateManagerInterface { - - public static final String REACT_CLASS = "RNTNativeComponentWithState"; - - private final ViewManagerDelegate mDelegate = - new RNTNativeComponentWithStateManagerDelegate<>(this); - - @Nullable - @Override - protected ViewManagerDelegate getDelegate() { - return mDelegate; - } - - @NonNull - @Override - public String getName() { - return REACT_CLASS; - } - - @NonNull - @Override - protected NativeViewWithState createViewInstance(@NonNull ThemedReactContext reactContext) { - return new NativeViewWithState(reactContext); - } - - @Override - @ReactProp(name = "imageSource") - public void setImageSource(NativeViewWithState view, @Nullable ReadableMap value) { - view.setImageSource(value); - } -} diff --git a/packages/rn-tester/android/app/src/main/jni/CMakeLists.txt b/packages/rn-tester/android/app/src/main/jni/CMakeLists.txt index d6a9733d60f659..e263a03350c428 100644 --- a/packages/rn-tester/android/app/src/main/jni/CMakeLists.txt +++ b/packages/rn-tester/android/app/src/main/jni/CMakeLists.txt @@ -10,22 +10,6 @@ project(appmodules) include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake) -# === Include NativeComponentWithState C++ files === -# The following lines are used to tell CMake to build some source code -# that is not contained in the regular folder path for an Android app. -# This is happening because the NativeComponentWithState component -# has some C++ code that is shared between iOS and Android. -# An alternative approach could have been to create a library within the -# component folder, adding a CMakeList.txt file. -target_sources(${CMAKE_PROJECT_NAME} - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../NativeComponentWithState/cxx/RNTNativeComponentWithStateCustomShadowNode.cpp) - -target_include_directories(${CMAKE_PROJECT_NAME} - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../NativeComponentWithState/cxx) -# === END Include NativeComponentWithState === - add_subdirectory(${PROJECT_BUILD_DIR}/generated/source/codegen/jni/ codegen_build) add_subdirectory(${REACT_COMMON_DIR}/react/nativemodule/samples/platform/android/ sampleturbomodule_build) diff --git a/packages/rn-tester/android/app/src/main/jni/OnLoad.cpp b/packages/rn-tester/android/app/src/main/jni/OnLoad.cpp index 2d92a502d87fe0..ae21e72a4dccff 100644 --- a/packages/rn-tester/android/app/src/main/jni/OnLoad.cpp +++ b/packages/rn-tester/android/app/src/main/jni/OnLoad.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -22,8 +21,6 @@ void registerComponents( std::shared_ptr registry) { registry->add(concreteComponentDescriptorProvider< RNTMyNativeViewComponentDescriptor>()); - registry->add(concreteComponentDescriptorProvider< - RNTNativeComponentWithStateCustomComponentDescriptor>()); } std::shared_ptr provideModules( diff --git a/packages/rn-tester/js/examples/NewArchitecture/ComponentWithState.js b/packages/rn-tester/js/examples/NewArchitecture/ComponentWithState.js deleted file mode 100644 index 1194e4ec41a194..00000000000000 --- a/packages/rn-tester/js/examples/NewArchitecture/ComponentWithState.js +++ /dev/null @@ -1,47 +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. - * - * @format - * @flow - */ - -'use strict'; - -import * as React from 'react'; -import {StyleSheet} from 'react-native'; -import NativeComponentWithState from '../../../NativeComponentWithState/js/NativeComponentWithState'; - -const styles = StyleSheet.create({ - component: { - marginLeft: 150, - width: 100, - height: 100, - marginTop: 20, - }, -}); - -exports.title = 'Component with State'; -exports.description = - 'Codegen discovery must be enabled for iOS. See Podfile for more details. Component with State'; -exports.examples = [ - { - title: 'Component with State', - description: - 'Change the image source in the Examples/NewArchitecture/ComponentWithState.js file', - render(): React.Element { - return ( - <> - - - ); - }, - }, -]; diff --git a/packages/rn-tester/js/utils/RNTesterList.android.js b/packages/rn-tester/js/utils/RNTesterList.android.js index f5f987788edcee..5156c746ceef50 100644 --- a/packages/rn-tester/js/utils/RNTesterList.android.js +++ b/packages/rn-tester/js/utils/RNTesterList.android.js @@ -126,11 +126,6 @@ const Components: Array = [ category: 'UI', module: require('../examples/NewArchitecture/NewArchitectureExample'), }, - { - key: 'ComponentWithState', - category: 'UI', - module: require('../examples/NewArchitecture/ComponentWithState'), - }, ]; const APIs: Array = [ diff --git a/packages/rn-tester/js/utils/RNTesterList.ios.js b/packages/rn-tester/js/utils/RNTesterList.ios.js index 79432b55382793..cb0e34893de90b 100644 --- a/packages/rn-tester/js/utils/RNTesterList.ios.js +++ b/packages/rn-tester/js/utils/RNTesterList.ios.js @@ -161,12 +161,6 @@ const Components: Array = [ module: require('../examples/NewArchitecture/NewArchitectureExample'), supportsTVOS: false, }, - { - key: 'ComponentWithState', - category: 'UI', - module: require('../examples/NewArchitecture/ComponentWithState'), - supportsTVOS: false, - }, ]; const APIs: Array = [