Add RTL support for Fabric android rendering

Reviewed By: fkgozali

Differential Revision: D8035223

fbshipit-source-id: 22d702e487fd2c20cd03e5004d904ddfcfbdb55a
This commit is contained in:
David Vacca 2018-05-17 09:48:47 -07:00 committed by Facebook Github Bot
parent 8dad3e4132
commit 4e1453eb01
2 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
load("//ReactNative:DEFS.bzl", "rn_android_library", "react_native_dep", "react_native_target")
load("//ReactNative:DEFS.bzl", "rn_android_library", "react_native_dep", "YOGA_TARGET", "react_native_target")
rn_android_library(
name = "fabric",
@ -11,6 +11,7 @@ rn_android_library(
"PUBLIC",
],
deps = [
YOGA_TARGET,
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react:react"),

View File

@ -35,6 +35,7 @@ import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.uimanager.ViewManagerRegistry;
import com.facebook.react.uimanager.common.MeasureSpecProvider;
import com.facebook.react.uimanager.common.SizeMonitoringFrameLayout;
import com.facebook.yoga.YogaDirection;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
@ -411,7 +412,9 @@ public class FabricUIManager implements UIManager {
private ReactShadowNode createRootShadowNode(int rootTag, ThemedReactContext themedReactContext) {
ReactShadowNode rootNode = new ReactShadowNodeImpl();
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
// TODO: setLayoutDirection for the rootNode
if (sharedI18nUtilInstance.isRTL(themedReactContext)) {
rootNode.setLayoutDirection(YogaDirection.RTL);
}
rootNode.setViewClassName("Root");
rootNode.setReactTag(rootTag);
rootNode.setThemedContext(themedReactContext);