Android YogaLayout invalidate(View view) problem #669
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Report
Android YogaLayout invalidate(View view) will cause App frozen problem in some scenario.
Issues and Steps to Reproduce
I just got a App frozen scenario when I refreshed some content when I clicked an menu. The error I got in the logcat is:
“Only leaf nodes with custom measure functions should manually mark themselves as dirty”
This is because the current implementation in YogaLayout class invalidate(View view) method did not check if yogaNode has Measure defined.
Expected Behavior
The app should not be frozen.
Actual Behavior
The app is frozen and I got app no response message.
Link to Code
The source cause of this problem is in the public void invalidate(View view) method:
I just add 1 lines code to check if yogaNode has custom measure defined before marking its dirty and problem solved.
if (mYogaNodes.containsKey(view)) {
YogaNode yogaNode = mYogaNodes.get(view);
if (yogaNode.isMeasureDefined()) {
mYogaNodes.get(view).dirty();
}
return;
}
We're deprecating the
com.facebook.yoga.android.YogaLayout
ViewGroup in the next major release of Yoga. We intend to still push out a new version aligned to the core Yoga 2.0. I have bulk closed ViewGroup issues to reflect that we are not planning to invest time into functional changes of the ViewGroup. and eventually intend to remove it from the repo.