Allow to reset measure and baseline functions
Summary: Once measure and baseline functions are set, C# layer never calls YGNodeSetMeasure/BaselineFunc with NULL. This diff will fix the issue. Closes https://github.com/facebook/yoga/pull/468 Reviewed By: emilsjolander Differential Revision: D4676753 Pulled By: splhack fbshipit-source-id: da34de2fc28adf320a18de2addffe9671cf1ecf9
This commit is contained in:
committed by
Facebook Github Bot
parent
406c8a2117
commit
a8e6123d47
@@ -64,8 +64,8 @@ namespace Facebook.Yoga
|
|||||||
private BaselineFunction _baselineFunction;
|
private BaselineFunction _baselineFunction;
|
||||||
private object _data;
|
private object _data;
|
||||||
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||||
private static YogaMeasureFunc _managedMeasure = MeasureInternalIOS;
|
private static YogaMeasureFunc _managedMeasure;
|
||||||
private static YogaBaselineFunc _managedBaseline = BaselineInternalIOS;
|
private static YogaBaselineFunc _managedBaseline;
|
||||||
#else
|
#else
|
||||||
private YogaMeasureFunc _managedMeasure;
|
private YogaMeasureFunc _managedMeasure;
|
||||||
private YogaBaselineFunc _managedBaseline;
|
private YogaBaselineFunc _managedBaseline;
|
||||||
@@ -617,11 +617,16 @@ namespace Facebook.Yoga
|
|||||||
if (measureFunction != null)
|
if (measureFunction != null)
|
||||||
{
|
{
|
||||||
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||||
|
_managedMeasure = MeasureInternalIOS;
|
||||||
_ygNode.SetContext(this);
|
_ygNode.SetContext(this);
|
||||||
#else
|
#else
|
||||||
_managedMeasure = MeasureInternal;
|
_managedMeasure = MeasureInternal;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_managedMeasure = null;
|
||||||
|
}
|
||||||
Native.YGNodeSetMeasureFunc(_ygNode, _managedMeasure);
|
Native.YGNodeSetMeasureFunc(_ygNode, _managedMeasure);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,11 +636,16 @@ namespace Facebook.Yoga
|
|||||||
if (baselineFunction != null)
|
if (baselineFunction != null)
|
||||||
{
|
{
|
||||||
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||||
|
_managedBaseline = BaselineInternalIOS;
|
||||||
_ygNode.SetContext(this);
|
_ygNode.SetContext(this);
|
||||||
#else
|
#else
|
||||||
_managedBaseline = BaselineInternal;
|
_managedBaseline = BaselineInternal;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_managedBaseline = null;
|
||||||
|
}
|
||||||
Native.YGNodeSetBaselineFunc(_ygNode, _managedBaseline);
|
Native.YGNodeSetBaselineFunc(_ygNode, _managedBaseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user