diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java index 94f6ccab6..03c53ca8b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java @@ -42,7 +42,7 @@ import com.facebook.react.bridge.ReadableMapKeySeyIterator; * - Create a view with only layout props: a description of that view is created as a * {@link ReactShadowNode} in UIManagerModule, but this class will not output any commands to * create the view in the native view hierarchy. - * - Update a layout-only view to have non-layout props: before issuing the updateProperties call + * - Update a layout-only view to have non-layout props: before issuing the updateShadowNode call * to the native view hierarchy, issue commands to create the view we optimized away move it into * the view hierarchy * - Manage the children of a view: multiple manageChildren calls for various parent views may be diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.java index 434013ea9..ae7f8fa4a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.java @@ -23,10 +23,15 @@ public abstract class SimpleViewManager extends BaseViewManager { @Override - public ReactShadowNode createCSSNodeInstance() { + public ReactShadowNode createShadowNodeInstance() { return new ReactShadowNode(); } + @Override + public Class getShadowNodeClass() { + return ReactShadowNode.class; + } + @Override public void updateExtraData(T root, Object extraData) { } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java index 3df9ce7fb..dd9b937e1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java @@ -241,7 +241,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements @ReactMethod public void createView(int tag, String className, int rootViewTag, ReadableMap props) { ViewManager viewManager = mViewManagers.get(className); - ReactShadowNode cssNode = viewManager.createCSSNodeInstance(); + ReactShadowNode cssNode = viewManager.createShadowNodeInstance(); ReactShadowNode rootNode = mShadowNodeRegistry.getNode(rootViewTag); cssNode.setReactTag(tag); cssNode.setViewClassName(className); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java index 7847aa59c..429ae0a63 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java @@ -19,10 +19,15 @@ public abstract class ViewGroupManager extends BaseViewManager { @Override - public ReactShadowNode createCSSNodeInstance() { + public ReactShadowNode createShadowNodeInstance() { return new ReactShadowNode(); } + @Override + public Class getShadowNodeClass() { + return ReactShadowNode.class; + } + @Override public void updateExtraData(T root, Object extraData) { } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java index bb5ba4838..012771882 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java @@ -17,7 +17,6 @@ import java.util.Map; import android.view.View; -import com.facebook.csslayout.CSSNode; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.ReadableMapKeySeyIterator; @@ -76,11 +75,23 @@ public abstract class ViewManager { public abstract String getName(); /** - * This method should return a subclass of {@link CSSNode} which will be then used for measuring - * position and size of the view. In mose of the cases this should just return an instance of - * {@link CSSNode} + * This method should return a subclass of {@link ReactShadowNode} which will be then used for + * measuring position and size of the view. In mose of the cases this should just return an + * instance of {@link ReactShadowNode} */ - public abstract C createCSSNodeInstance(); + public abstract C createShadowNodeInstance(); + + /** + * This method should return {@link Class} instance that represent type of shadow node that this + * manager will return from {@link #createShadowNodeInstance}. + * + * This method will be used in the bridge initialization phase to collect properties exposed using + * {@link ReactProp} (or {@link ReactPropGroup}) annotation from the {@link ReactShadowNode} + * subclass specific for native view this manager provides. + * + * @return {@link Class} object that represents type of shadow node used by this view manager. + */ + public abstract Class getShadowNodeClass(); /** * Subclasses should return a new View instance of the proper type. @@ -108,7 +119,7 @@ public abstract class ViewManager { * when a certain property is present in {@param props} map but the value is null, this property * should be reset to the default value * - * TODO(krzysztof) This method should be replaced by updateProperties and removed completely after + * TODO(krzysztof) This method should be replaced by updateShadowNode and removed completely after * all view managers adapt @ReactProp */ @Deprecated @@ -219,7 +230,8 @@ public abstract class ViewManager { // TODO(krzysztof): This method will just delegate to ViewManagersPropertyRegistry once // refactoring is finished Class cls = getClass(); - Map nativeProps = ViewManagersPropertyCache.getNativePropsForView(cls); + Map nativeProps = + ViewManagersPropertyCache.getNativePropsForView(cls); while (cls.getSuperclass() != null) { Map props = getNativePropsForClass(cls); for (Map.Entry entry : props.entrySet()) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java index acc3eb1e5..051bc165b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java @@ -57,10 +57,15 @@ public class ReactProgressBarViewManager extends } @Override - public ProgressBarShadowNode createCSSNodeInstance() { + public ProgressBarShadowNode createShadowNodeInstance() { return new ProgressBarShadowNode(); } + @Override + public Class getShadowNodeClass() { + return ProgressBarShadowNode.class; + } + @Override public void updateExtraData(FrameLayout root, Object extraData) { // do nothing diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java index 11ff69c78..81bdde5bb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java @@ -21,8 +21,8 @@ import com.facebook.react.bridge.ReactContext; import com.facebook.react.uimanager.ReactProp; import com.facebook.react.uimanager.ReactShadowNode; import com.facebook.react.uimanager.SimpleViewManager; -import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.ThemedReactContext; +import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.ViewProps; /** @@ -82,10 +82,15 @@ public class ReactSwitchManager extends SimpleViewManager { } @Override - public ReactShadowNode createCSSNodeInstance() { + public ReactShadowNode createShadowNodeInstance() { return new ReactSwitchShadowNode(); } + @Override + public Class getShadowNodeClass() { + return ReactSwitchShadowNode.class; + } + @Override protected ReactSwitch createViewInstance(ThemedReactContext context) { ReactSwitch view = new ReactSwitch(context); diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.java index 1dec2e726..ebb387897 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.java @@ -42,7 +42,12 @@ public class ReactRawTextManager extends ReactTextViewManager { } @Override - public ReactTextShadowNode createCSSNodeInstance() { + public ReactTextShadowNode createShadowNodeInstance() { return new ReactTextShadowNode(true); } + + @Override + public Class getShadowNodeClass() { + return ReactTextShadowNode.class; + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java index 43ea797d8..5021f522a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java @@ -88,7 +88,12 @@ public class ReactTextViewManager extends BaseViewManager getShadowNodeClass() { + return ReactTextShadowNode.class; + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 713209423..4e8449d99 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -80,10 +80,15 @@ public class ReactTextInputManager extends } @Override - public ReactTextInputShadowNode createCSSNodeInstance() { + public ReactTextInputShadowNode createShadowNodeInstance() { return new ReactTextInputShadowNode(); } + @Override + public Class getShadowNodeClass() { + return ReactTextInputShadowNode.class; + } + @Nullable @Override public Map getExportedCustomBubblingEventTypeConstants() {