|
| 1 | +# Nodes |
| 2 | + |
| 3 | +Nodes is an experimental, alternate version of |
| 4 | +[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`: |
| 5 | + |
| 6 | +1. Support for `overflow:visible` on Android. |
| 7 | +2. More efficient generation of view hierarchies. |
| 8 | + |
| 9 | +The intention is to ultimately replace the existing `UIImplementation` on |
| 10 | +Android with Nodes (after all the issues are ironed out). |
| 11 | + |
| 12 | +## How to test |
| 13 | + |
| 14 | +In a subclass of `ReactNativeHost`, add this: |
| 15 | + |
| 16 | +```java |
| 17 | +@Override |
| 18 | +protected UIImplementationProvider getUIImplementationProvider() { |
| 19 | + return new FlatUIImplementationProvider(); |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +## How it Works |
| 24 | + |
| 25 | +The existing |
| 26 | +[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 |
| 27 | +to Views, with the exception of some optimizations for layout only tags that |
| 28 | +don't draw content). Nodes, on the other hand, maps react tags to a set of |
| 29 | +`DrawCommand`s. In other words, an `<image>` tag will often be mapped to a |
| 30 | +`Drawable` instead of an `ImageView` and a `<text>` tag will be mapped to a |
| 31 | +`Layout` instead of a `TextView`. This helps flatten the resulting `View` |
| 32 | +hierarchy. |
| 33 | + |
| 34 | +There are situations where `DrawCommand`s are promoted to `View`s: |
| 35 | + |
| 36 | +1. Existing Android components that are wrapped by React Native (for example, |
| 37 | +`ViewPager`, `ScrollView`, etc). |
| 38 | +2. When using a `View` is more optimal (for example, `opacity`, to avoid |
| 39 | +unnecessary invalidations). |
| 40 | +3. To facilitate the implementation of certain features (accessibility, |
| 41 | +transforms, etc). |
| 42 | + |
| 43 | +This means that existing custom `ViewManager`s should continue to work as they |
| 44 | +did with the existing `UIImplementation`. |
| 45 | + |
| 46 | +## Limitations and Known Issues |
| 47 | + |
| 48 | +- `LayoutAnimation`s are not yet supported |
| 49 | +- `zIndex` is not yet supported |
0 commit comments