JSC bindings for FabricUIManager - Android

Reviewed By: fkgozali

Differential Revision: D7054214

fbshipit-source-id: 6275a8a3e2a87dfd851a09392f09658538083483
This commit is contained in:
Sebastian Markbage 2018-02-23 16:01:53 -08:00 committed by Facebook Github Bot
parent b9be28915c
commit 25b0c374b3
1 changed files with 6 additions and 7 deletions

View File

@ -3,7 +3,7 @@
package com.facebook.react.fabric; package com.facebook.react.fabric;
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.ReadableNativeMap;
import com.facebook.react.modules.i18nmanager.I18nUtil; import com.facebook.react.modules.i18nmanager.I18nUtil;
import com.facebook.react.uimanager.MeasureSpecProvider; import com.facebook.react.uimanager.MeasureSpecProvider;
import com.facebook.react.uimanager.ReactRootViewTagGenerator; import com.facebook.react.uimanager.ReactRootViewTagGenerator;
@ -18,7 +18,6 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
/** /**
* This class is responsible to create, clone and update {@link ReactShadowNode} using the * This class is responsible to create, clone and update {@link ReactShadowNode} using the
* Fabric API. * Fabric API.
@ -43,7 +42,7 @@ public class FabricUIManagerModule implements UIModule {
public ReactShadowNode createNode(int reactTag, public ReactShadowNode createNode(int reactTag,
String viewName, String viewName,
int rootTag, int rootTag,
ReadableMap props) { ReadableNativeMap props) {
ViewManager viewManager = mViewManagerRegistry.get(viewName); ViewManager viewManager = mViewManagerRegistry.get(viewName);
ReactShadowNode node = viewManager.createShadowNodeInstance(mReactApplicationContext); ReactShadowNode node = viewManager.createShadowNodeInstance(mReactApplicationContext);
@ -58,7 +57,7 @@ public class FabricUIManagerModule implements UIModule {
return mRootShadowNodeRegistry.getNode(rootTag); return mRootShadowNodeRegistry.getNode(rootTag);
} }
private ReactStylesDiffMap updateProps(ReadableMap props, ReactShadowNode node) { private ReactStylesDiffMap updateProps(ReadableNativeMap props, ReactShadowNode node) {
ReactStylesDiffMap styles = null; ReactStylesDiffMap styles = null;
if (props != null) { if (props != null) {
styles = new ReactStylesDiffMap(props); styles = new ReactStylesDiffMap(props);
@ -95,7 +94,7 @@ public class FabricUIManagerModule implements UIModule {
* props will be overridden with the {@link ReadableMap} received by parameter. * props will be overridden with the {@link ReadableMap} received by parameter.
*/ */
@Nullable @Nullable
public ReactShadowNode cloneNodeWithNewProps(ReactShadowNode node, ReadableMap newProps) { public ReactShadowNode cloneNodeWithNewProps(ReactShadowNode node, ReadableNativeMap newProps) {
ReactShadowNode clone = cloneNode(node); ReactShadowNode clone = cloneNode(node);
updateProps(newProps, clone); updateProps(newProps, clone);
return clone; return clone;
@ -110,7 +109,7 @@ public class FabricUIManagerModule implements UIModule {
@Nullable @Nullable
public ReactShadowNode cloneNodeWithNewChildrenAndProps( public ReactShadowNode cloneNodeWithNewChildrenAndProps(
ReactShadowNode node, ReactShadowNode node,
ReadableMap newProps) { ReadableNativeMap newProps) {
ReactShadowNode clone = cloneNodeWithNewChildren(node); ReactShadowNode clone = cloneNodeWithNewChildren(node);
updateProps(newProps, clone); updateProps(newProps, clone);
return clone; return clone;
@ -129,7 +128,7 @@ public class FabricUIManagerModule implements UIModule {
* @return an empty {@link List<ReactShadowNode>} that will be used to append the * @return an empty {@link List<ReactShadowNode>} that will be used to append the
* {@link ReactShadowNode} elements of the root. Typically this List will contain one element. * {@link ReactShadowNode} elements of the root. Typically this List will contain one element.
*/ */
public List<ReactShadowNode> createChildSet() { public List<ReactShadowNode> createChildSet(int rootTag) {
return new ArrayList<>(1); return new ArrayList<>(1);
} }