From 3998650468750aa9fb9af59d7c2a27818f4e3b22 Mon Sep 17 00:00:00 2001 From: Ahmed El-Helw Date: Mon, 19 Dec 2016 16:55:17 -0800 Subject: [PATCH] Add a README file for Nodes Summary: Add a README file explaining the purpose of Nodes and how to enable it within an app. Reviewed By: JoelMarcey, lacker Differential Revision: D4349517 fbshipit-source-id: ec26ebb37039e7c23ecd2cf4b482fa21ca8beeda --- .../java/com/facebook/react/flat/README.md | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 ReactAndroid/src/main/java/com/facebook/react/flat/README.md diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/README.md b/ReactAndroid/src/main/java/com/facebook/react/flat/README.md new file mode 100644 index 00000000000..f9fc580c021 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/README.md @@ -0,0 +1,49 @@ +# Nodes + +Nodes is an experimental, alternate version of +[UIImplementation](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java) for ReactNative on Android. It has two main advantages over the existing `UIImplementation`: + +1. Support for `overflow:visible` on Android. +2. More efficient generation of view hierarchies. + +The intention is to ultimately replace the existing `UIImplementation` on +Android with Nodes (after all the issues are ironed out). + +## How to test + +In a subclass of `ReactNativeHost`, add this: + +```java +@Override +protected UIImplementationProvider getUIImplementationProvider() { + return new FlatUIImplementationProvider(); +} +``` + +## How it Works + +The existing +[UIImplementation](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java) maps all non-layout tags to `View`s (resulting in an almost 1:1 mapping of tags +to Views, with the exception of some optimizations for layout only tags that +don't draw content). Nodes, on the other hand, maps react tags to a set of +`DrawCommand`s. In other words, an `` tag will often be mapped to a +`Drawable` instead of an `ImageView` and a `` tag will be mapped to a +`Layout` instead of a `TextView`. This helps flatten the resulting `View` +hierarchy. + +There are situations where `DrawCommand`s are promoted to `View`s: + +1. Existing Android components that are wrapped by React Native (for example, +`ViewPager`, `ScrollView`, etc). +2. When using a `View` is more optimal (for example, `opacity`, to avoid +unnecessary invalidations). +3. To facilitate the implementation of certain features (accessibility, +transforms, etc). + +This means that existing custom `ViewManager`s should continue to work as they +did with the existing `UIImplementation`. + +## Limitations and Known Issues + +- `LayoutAnimation`s are not yet supported +- `zIndex` is not yet supported