diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java index 3741583b9..e68c51214 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java @@ -16,7 +16,11 @@ public class YogaConfig { public static int SPACING_TYPE = 1; static { - SoLoader.loadLibrary("yoga"); + if (YogaConstants.shouldUseFastMath) { + SoLoader.loadLibrary("yogafastmath"); + } else { + SoLoader.loadLibrary("yoga"); + } } long mNativePointer; diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java index e11c1044d..cb9bc8ca5 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java @@ -11,6 +11,8 @@ public class YogaConstants { public static final float UNDEFINED = Float.NaN; + public static boolean shouldUseFastMath = false; + public static boolean isUndefined(float value) { return Float.compare(value, UNDEFINED) == 0; } diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java index 1ba81249c..c1c659335 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java @@ -17,7 +17,11 @@ import javax.annotation.Nullable; public class YogaNode implements Cloneable { static { - SoLoader.loadLibrary("yoga"); + if (YogaConstants.shouldUseFastMath) { + SoLoader.loadLibrary("yogafastmath"); + } else { + SoLoader.loadLibrary("yoga"); + } } /**