Revert D43500868: Expose UnstableReactLegacyComponentDescriptor inside react/renderer/components/legacyviewmanagerinterop

Differential Revision:
D43500868 (071f6d2ca6)

Original commit changeset: acfcd89efc42

Original Phabricator Diff: D43500868 (071f6d2ca6)

fbshipit-source-id: bb354015b2dcc812491b0219c6dd4d9c6321dc0b
This commit is contained in:
Simeng Pang 2023-03-01 23:09:13 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 071f6d2ca6
Коммит 851c8c671a
10 изменённых файлов: 8 добавлений и 189 удалений

Просмотреть файл

@ -120,10 +120,6 @@ final def preparePrefab = tasks.register("preparePrefab", PreparePrefabHeadersTa
"rrc_view",
new Pair("../ReactCommon/react/renderer/components/view/", "react/renderer/components/view/")
),
new PrefabPreprocessingEntry(
"rrc_legacyviewmanagerinterop",
new Pair("../ReactCommon/react/renderer/components/legacyviewmanagerinterop/", "react/renderer/components/legacyviewmanagerinterop/")
),
new PrefabPreprocessingEntry(
"jsi",
new Pair("../ReactCommon/jsi/", "")
@ -489,7 +485,6 @@ android {
"rrc_image",
"rrc_root",
"rrc_view",
"rrc_legacyviewmanagerinterop",
"jsi",
"glog",
"fabricjni",
@ -591,9 +586,6 @@ android {
rrc_view {
headers(new File(prefabHeadersDir, "rrc_view").absolutePath)
}
rrc_legacyviewmanagerinterop {
headers(new File(prefabHeadersDir, "rrc_legacyviewmanagerinterop").absolutePath)
}
jsi {
headers(new File(prefabHeadersDir, "jsi").absolutePath)
}

Просмотреть файл

@ -69,7 +69,6 @@ add_library(folly_runtime ALIAS ReactAndroid::folly_runtime)
add_library(react_nativemodule_core ALIAS ReactAndroid::react_nativemodule_core)
add_library(react_render_imagemanager ALIAS ReactAndroid::react_render_imagemanager)
add_library(rrc_image ALIAS ReactAndroid::rrc_image)
add_library(rrc_legacyviewmanagerinterop ALIAS ReactAndroid::rrc_legacyviewmanagerinterop)
find_package(fbjni REQUIRED CONFIG)
add_library(fbjni ALIAS fbjni::fbjni)
@ -92,7 +91,6 @@ target_link_libraries(${CMAKE_PROJECT_NAME}
react_render_mapbuffer # prefab ready
rrc_image # prefab ready
rrc_view # prefab ready
rrc_legacyviewmanagerinterop # prefab ready
runtimeexecutor # prefab ready
turbomodulejsijni # prefab ready
yoga) # prefab ready

Просмотреть файл

@ -87,7 +87,6 @@ add_react_common_subdir(react/renderer/components/textinput)
add_react_common_subdir(react/renderer/components/progressbar)
add_react_common_subdir(react/renderer/components/root)
add_react_common_subdir(react/renderer/components/image)
add_react_common_subdir(react/renderer/components/legacyviewmanagerinterop)
add_react_common_subdir(react/renderer/componentregistry/native)
add_react_common_subdir(react/renderer/components/text)
add_react_common_subdir(react/renderer/components/unimplementedview)

Просмотреть файл

@ -1,31 +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.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(
-fexceptions
-frtti
-std=c++17
-Wall
-Wpedantic
-Wno-gnu-zero-variadic-macro-arguments
-DLOG_TAG=\"Fabric\")
file(GLOB rrc_legacyviewmanagerinterop_SRC CONFIGURE_DEPENDS *.cpp)
add_library(rrc_legacyviewmanagerinterop SHARED ${rrc_legacyviewmanagerinterop_SRC})
target_include_directories(rrc_legacyviewmanagerinterop PUBLIC ${REACT_COMMON_DIR})
target_link_libraries(rrc_legacyviewmanagerinterop
glog
glog_init
folly_runtime
jsi
react_render_core
rrc_view
yoga
)

Просмотреть файл

@ -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.
*/
#pragma once
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/components/view/ViewProps.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
namespace facebook {
namespace react {
/*
* Descriptor for <UnstableReactLegacyComponent> component.
*
* This component is part of the Fabric Interop Layer and is subject to future
* changes (hence the "Unstable" prefix).
*/
template <const char *concreteComponentName>
class UnstableLegacyViewManagerInteropComponentDescriptor
: public ConcreteComponentDescriptor<
ConcreteViewShadowNode<concreteComponentName, ViewProps>> {
public:
UnstableLegacyViewManagerInteropComponentDescriptor<concreteComponentName>(
ComponentDescriptorParameters const &parameters)
: ConcreteComponentDescriptor<
ConcreteViewShadowNode<concreteComponentName, ViewProps>>(
parameters) {}
private:
};
} // namespace react
} // namespace facebook

Просмотреть файл

@ -1,25 +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 type {HostComponent} from 'react-native';
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
import {requireNativeComponent} from 'react-native';
type NativeProps = $ReadOnly<{|
...ViewProps,
opacity?: number,
color?: string,
|}>;
export type MyLegacyViewType = HostComponent<NativeProps>;
export default (requireNativeComponent(
'RNTMyLegacyNativeView',
): HostComponent<NativeProps>);

Просмотреть файл

@ -10,11 +10,10 @@
import * as React from 'react';
import {useRef, useState} from 'react';
import {View, Button, Text} from 'react-native';
import {View, Button} from 'react-native';
import RNTMyNativeView, {
Commands as RNTMyNativeViewCommands,
} from './MyNativeViewNativeComponent';
import RNTMyLegacyNativeView from './MyLegacyViewNativeComponent';
import type {MyNativeViewType} from './MyNativeViewNativeComponent';
const colors = [
@ -30,27 +29,18 @@ const colors = [
export default function MyNativeView(props: {}): React.Node {
const ref = useRef<React.ElementRef<MyNativeViewType> | null>(null);
const [opacity, setOpacity] = useState(1.0);
const [color, setColor] = useState('#000000');
return (
<View style={{flex: 1}}>
<Text style={{color: 'red'}}>Fabric View</Text>
<RNTMyNativeView ref={ref} style={{flex: 1}} opacity={opacity} />
<Text style={{color: 'red'}}>Legacy View</Text>
<RNTMyLegacyNativeView
style={{flex: 1}}
opacity={opacity}
color={color}
/>
<Button
title="Change Background"
onPress={() => {
let newColor = colors[Math.floor(Math.random() * 5)];
setColor(newColor);
if (ref.current) {
RNTMyNativeViewCommands.callNativeMethodToChangeBackgroundColor(
// $FlowFixMe[incompatible-call]
ref.current,
newColor,
colors[Math.floor(Math.random() * 5)],
);
}
}}
/>
<Button

Просмотреть файл

@ -22,12 +22,10 @@ import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.react.module.model.ReactModuleInfo;
import com.facebook.react.module.model.ReactModuleInfoProvider;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.react.uiapp.component.MyLegacyViewManager;
import com.facebook.react.uiapp.component.MyNativeViewManager;
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 class RNTesterApplication extends Application implements ReactApplication
@Override
public List<ViewManager> createViewManagers(
@NonNull ReactApplicationContext reactContext) {
List<ViewManager> viewManagers = new ArrayList<>();
viewManagers.add(new MyNativeViewManager());
viewManagers.add(new MyLegacyViewManager(reactContext));
return viewManagers;
return Collections.singletonList(new MyNativeViewManager());
}
});
}

Просмотреть файл

@ -1,55 +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.graphics.Color;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.annotations.ReactProp;
/** Legacy View manager (non Fabric compatible) for {@link MyNativeView} components. */
@ReactModule(name = MyLegacyViewManager.REACT_CLASS)
public class MyLegacyViewManager extends SimpleViewManager<MyNativeView> {
public static final String REACT_CLASS = "RNTMyLegacyNativeView";
private final ReactApplicationContext mCallerContext;
public MyLegacyViewManager(ReactApplicationContext reactContext) {
mCallerContext = reactContext;
}
@NonNull
@Override
public String getName() {
return REACT_CLASS;
}
@NonNull
@Override
protected MyNativeView createViewInstance(@NonNull ThemedReactContext reactContext) {
MyNativeView view = new MyNativeView(reactContext);
view.setBackgroundColor(Color.RED);
return view;
}
@Override
@ReactProp(name = ViewProps.OPACITY, defaultFloat = 1.f)
public void setOpacity(@NonNull MyNativeView view, float opacity) {
super.setOpacity(view, opacity);
}
@ReactProp(name = ViewProps.COLOR)
public void setColor(@NonNull MyNativeView view, @Nullable String color) {
view.setBackgroundColor(Color.parseColor(color));
}
}

Просмотреть файл

@ -13,21 +13,15 @@
#include <fbjni/fbjni.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <react/renderer/components/AppSpecs/ComponentDescriptors.h>
#include <react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerInteropComponentDescriptor.h>
#include <rncore.h>
namespace facebook {
namespace react {
extern const char RNTMyNativeViewName[] = "RNTMyLegacyNativeView";
void registerComponents(
std::shared_ptr<ComponentDescriptorProviderRegistry const> registry) {
registry->add(concreteComponentDescriptorProvider<
RNTMyNativeViewComponentDescriptor>());
registry->add(concreteComponentDescriptorProvider<
UnstableLegacyViewManagerInteropComponentDescriptor<
RNTMyNativeViewName>>());
}
std::shared_ptr<TurboModule> cxxModuleProvider(