Skip to content

Commit

Permalink
update yoga to v3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtGokhan committed Apr 8, 2024
1 parent a41bbde commit 4711db4
Show file tree
Hide file tree
Showing 19 changed files with 105 additions and 106 deletions.
Binary file modified Plugins/yoga/android/yoga.aar
Binary file not shown.
8 changes: 8 additions & 0 deletions Plugins/yoga/iOS.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Plugins/yoga/iOS/libyoga.a
Binary file not shown.
2 changes: 2 additions & 0 deletions Plugins/yoga/iOS/libyoga.a.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Plugins/yoga/linux/libyoga.so
Binary file not shown.
Binary file modified Plugins/yoga/osx/libyoga.dylib
Binary file not shown.
8 changes: 8 additions & 0 deletions Plugins/yoga/webgl.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Plugins/yoga/webgl/libyoga.a
Binary file not shown.
69 changes: 69 additions & 0 deletions Plugins/yoga/webgl/libyoga.a.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Plugins/yoga/win-x64/yoga.dll
Binary file not shown.
Binary file modified Plugins/yoga/win-x86/yoga.dll
Binary file not shown.
10 changes: 0 additions & 10 deletions Runtime/Helpers/YogaHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#if !UNITY_EDITOR && (UNITY_WEBGL || UNITY_IOS)
#define YOGA_LEGACY
#endif

using Facebook.Yoga;
using ReactUnity.Types;
using UnityEngine;
Expand All @@ -10,12 +6,6 @@ namespace ReactUnity.Helpers
{
public static class YogaHelpers
{
#if YOGA_LEGACY
public static bool IsLegacyYoga => true;
#else
public static bool IsLegacyYoga => false;
#endif

public static bool HasValue(this YogaValue val)
{
return (val.Unit == YogaUnit.Point || val.Unit == YogaUnit.Percent) && !float.IsNaN(val.Value);
Expand Down
3 changes: 0 additions & 3 deletions Runtime/Styling/Rules/MediaProvider.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using ReactUnity.Helpers;
using UnityEngine;

#if REACT_INPUT_SYSTEM
Expand Down Expand Up @@ -444,8 +443,6 @@ public void InitConstants()
values["language"] = Application.systemLanguage.ToString().ToLowerInvariant();
values["install-mode"] = Application.installMode.ToString().ToLowerInvariant();

values["yoga"] = YogaHelpers.IsLegacyYoga ? "legacy" : "newest";

if (Application.isConsolePlatform) types.Add("console");
if (Application.isMobilePlatform) types.Add("console");
if (Application.isBatchMode) types.Add("batch");
Expand Down
35 changes: 1 addition & 34 deletions Runtime/Yoga/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/

#if !UNITY_EDITOR && (UNITY_WEBGL || UNITY_IOS)
#define YOGA_LEGACY
#endif

using System;
using System.Runtime.InteropServices;

namespace Facebook.Yoga
{
internal static class Native
{
#if ((UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || __IOS__
#if !UNITY_EDITOR && (UNITY_IOS || UNITY_WEBGL)
private const string DllName = "__Internal";
#else
private const string DllName = "yoga";
Expand All @@ -43,9 +39,6 @@ internal static class Native
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGConfigFree(IntPtr node);

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern int YGConfigGetInstanceCount();

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGConfigSetExperimentalFeatureEnabled(
YGConfigHandle config,
Expand All @@ -65,19 +58,6 @@ internal static class Native
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern bool YGConfigGetUseWebDefaults(YGConfigHandle config);

#if YOGA_LEGACY
public static void YGConfigSetUseLegacyStretchBehaviour(YGConfigHandle config, bool useLegacyStretchBehavior) { }
public static bool YGConfigGetUseLegacyStretchBehaviour(YGConfigHandle config) { return false; }
#else
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGConfigSetUseLegacyStretchBehaviour(
YGConfigHandle config,
bool useLegacyStretchBehavior);

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern bool YGConfigGetUseLegacyStretchBehaviour(YGConfigHandle config);
#endif

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGConfigSetPointScaleFactor(
YGConfigHandle config,
Expand All @@ -92,18 +72,13 @@ internal static class Native
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeRemoveChild(YGNodeHandle node, YGNodeHandle child);

#if YOGA_LEGACY
public static void YGNodeSetIsReferenceBaseline(YGNodeHandle node, bool isReferenceBaseline) { }
public static bool YGNodeIsReferenceBaseline(YGNodeHandle node) { return false; }
#else
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeSetIsReferenceBaseline(
YGNodeHandle node,
bool isReferenceBaseline);

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern bool YGNodeIsReferenceBaseline(YGNodeHandle node);
#endif

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeCalculateLayout(
Expand All @@ -119,9 +94,6 @@ internal static class Native
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool YGNodeIsDirty(YGNodeHandle node);

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options);

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeCopyStyle(YGNodeHandle dstNode, YGNodeHandle srcNode);

Expand Down Expand Up @@ -303,16 +275,11 @@ internal static class Native
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern float YGNodeStyleGetAspectRatio(YGNodeHandle node);

#if YOGA_LEGACY
public static void YGNodeStyleSetGap(YGNodeHandle node, YogaGutter gap, float position) { }
public static float YGNodeStyleGetGap(YGNodeHandle node, YogaGutter gap) { return 0f; }
#else
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodeStyleSetGap(YGNodeHandle node, YogaGutter gutter, float gapLength);

[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern float YGNodeStyleGetGap(YGNodeHandle node, YogaGutter gutter);
#endif

#endregion

Expand Down
19 changes: 10 additions & 9 deletions Runtime/Yoga/YogaAlign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
namespace Facebook.Yoga
{
public enum YogaAlign
{
Auto,
FlexStart,
Center,
FlexEnd,
Stretch,
Baseline,
SpaceBetween,
SpaceAround,
{
Auto = 0,
FlexStart = 1,
Center = 2,
FlexEnd = 3,
Stretch = 4,
Baseline = 5,
SpaceBetween = 6,
SpaceAround = 7,
SpaceEvenly = 8,
}
}
19 changes: 0 additions & 19 deletions Runtime/Yoga/YogaConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

using System;
using System.Runtime.InteropServices;

#if __IOS__
using ObjCRuntime;
Expand Down Expand Up @@ -119,19 +118,6 @@ public bool UseWebDefaults
}
}

public bool UseLegacyStretchBehaviour
{
get
{
return Native.YGConfigGetUseLegacyStretchBehaviour(_ygConfig);
}

set
{
Native.YGConfigSetUseLegacyStretchBehaviour(_ygConfig, value);
}
}

public float PointScaleFactor
{
set
Expand All @@ -140,11 +126,6 @@ public float PointScaleFactor
}
}

public static int GetInstanceCount()
{
return Native.YGConfigGetInstanceCount();
}

public static void SetDefaultLogger(Logger logger)
{
Default.Logger = logger;
Expand Down
14 changes: 7 additions & 7 deletions Runtime/Yoga/YogaJustify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
namespace Facebook.Yoga
{
public enum YogaJustify
{
FlexStart,
Center,
FlexEnd,
SpaceBetween,
SpaceAround,
SpaceEvenly,
{
FlexStart = 0,
Center = 1,
FlexEnd = 2,
SpaceBetween = 3,
SpaceAround = 4,
SpaceEvenly = 5,
}
}
13 changes: 0 additions & 13 deletions Runtime/Yoga/YogaNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

#if __IOS__
using ObjCRuntime;
Expand Down Expand Up @@ -708,17 +706,6 @@ public void SetBaselineFunction(BaselineFunction baselineFunction)
return node._baselineFunction(node, width, height);
}

public string Print(YogaPrintOptions options =
YogaPrintOptions.Layout | YogaPrintOptions.Style | YogaPrintOptions.Children)
{
StringBuilder sb = new StringBuilder();
Logger orig = _config.Logger;
_config.Logger = (config, node, level, message) => { sb.Append(message); };
Native.YGNodePrint(_ygNode, options);
_config.Logger = orig;
return sb.ToString();
}

public IEnumerator<YogaNode> GetEnumerator()
{
return _children != null ? ((IEnumerable<YogaNode>) _children).GetEnumerator() :
Expand Down
11 changes: 0 additions & 11 deletions Runtime/Yoga/YogaPositionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,13 @@

// @generated by enums.py

#if !UNITY_EDITOR && (UNITY_WEBGL || UNITY_IOS)
#define YOGA_LEGACY
#endif

namespace Facebook.Yoga
{
public enum YogaPositionType
{
#if YOGA_LEGACY
Default = 0,
Static = 0,
Relative = 0,
Absolute = 1,
#else
Default = 1,
Static = 0,
Relative = 1,
Absolute = 2,
#endif
}
}

0 comments on commit 4711db4

Please sign in to comment.