Skip to content

Commit

Permalink
Backout: Components with custom state
Browse files Browse the repository at this point in the history
Summary:
This is the first diffs that backs out the Custom Native State from the Codegen. The reason why we are backing it out are:

1. It forces users to create new types in JS that are not ctually used there. For example, the NativeState you define, and eventually exports, in JS is not used anywhere in your JS code.
2. You need to put in the JS native state some types that does not exists in JS, only to have them generated by the Codegen. ImageRequest, for example, does not exists in JS, but you need it in your (iOS) state to load images
3. There are a lot of edge cases due to how C++ handles variables. Some variables needs to be created as pointers. Some others as `const &`. It does not scale to hard code all of them and there is the risk to have the same type that needs to be a pointer in some case and something else in others.
4. It is better to instruct the users on how to properly create a component with Custom State, Shadow Node and Descriptor.

## Changelog
[General][Removed] - Back out components with native state in RNTester

Reviewed By: cortinico

Differential Revision: D40419254

fbshipit-source-id: 1895c7050f01f76a8901a97e9700f74cae707b79
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Oct 18, 2022
1 parent f6cfcc3 commit aace662
Show file tree
Hide file tree
Showing 19 changed files with 3 additions and 632 deletions.
41 changes: 0 additions & 41 deletions packages/rn-tester/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ rn_library(
"js",
"NativeModuleExample",
"NativeComponentExample",
"NativeComponentWithState",
"RCTTest",
],
excludes = [
Expand Down Expand Up @@ -85,7 +84,6 @@ fb_native.filegroup(
],
exclude = [
"NativeComponentExample/**/*",
"NativeComponentWithState/**/*",
],
),
visibility = ["PUBLIC"],
Expand Down Expand Up @@ -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",
],
)

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit aace662

Please sign in to comment.