From 4e1453eb01ee4d20d6070ec292ae97f589b5087f Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 17 May 2018 09:48:47 -0700 Subject: [PATCH] Add RTL support for Fabric android rendering Reviewed By: fkgozali Differential Revision: D8035223 fbshipit-source-id: 22d702e487fd2c20cd03e5004d904ddfcfbdb55a --- ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK | 3 ++- .../main/java/com/facebook/react/fabric/FabricUIManager.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK index da59ddbf2..fc9da7d6b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK @@ -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"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index f9d1948ab..c7a539e3e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -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);