Add ability to invalidate views
Summary: When some drawing attributes of a view changes how it measures, we need to be able to relayout it correctly. This adds method `invalidate(View)` to `YogaLayout` which will flag the corresponding node as dirty and requiring layout again. Reviewed By: emilsjolander Differential Revision: D4634563 fbshipit-source-id: af7f47dce00a31414d0987a58307c5d44c1bcf20
This commit is contained in:
committed by
Facebook Github Bot
parent
ecabe757a2
commit
6336e641f4
@@ -30,3 +30,9 @@ The list of all attributes can be found in [attrs.xml](https://github.com/facebo
|
||||
## Auto margins
|
||||
|
||||
You can specify `margin_left="auto"` (or `margin_right` etc.) for auto values. This is in addition to the dimensions you can speicfy, such as `margin_left="20dp"`.
|
||||
|
||||
## Invalidation (_temporary_)
|
||||
|
||||
If you change any attribute of a view that will change its measure size, you must invalidate it. Do this by calling `YogaLayout#invalidate(View)` on any `YogaLayout` further up the tree. Obviously it is most efficient to call it on the view's parent (if it is a `YogaLayout`, but in case this is impractical, you can call it on the root of the tree.
|
||||
|
||||
This is a temporary solution. Ideally, the view should invalidate itself whenever an attribute (text, font etc.) that will alter its size changes. This will be automatic once we find a good way to hook into the Android invalidation system.
|
||||
|
Reference in New Issue
Block a user