Android EditText height not grow automatically when used inside YogaLayout #1210
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 EditText height not grow automatically when used inside YogaLayout, but height grow automatically when used inside a constraintLayout or LinearLayout
Issues and Steps to Reproduce
Replaces this with steps to repro your issue.
<?xml version="1.0" encoding="utf-8"?>create xml like below
`
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fl_scroll_root"
>
<com.facebook.yoga.android.YogaLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
yoga:yg_flexDirection="column"
yoga:yg_width="100%"
android:id="@+id/fl_sv_scroll"
app:layout_constraintTop_toBottomOf="@+id/set_input1"
app:layout_constraintStart_toStartOf="@+id/fl_scroll_root"
app:layout_constraintEnd_toEndOf="@+id/fl_scroll_root"
>
</com.facebook.yoga.android.YogaLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
`
Expected Behavior
Describe what you expected would happen.
the second edittext grow automatically as the first edittext
Actual Behavior
Describe what actually happened.

the second edittext act like single line
Link to Code
If you have some code that maintainers can clone/test for themselves, bugs can be resolved much faster. Please paste a link here.
When applicable, use this fiddle to post a web repro.
Afaict (not a lot of specific familiarity with YogaLayout), invalidation of native views does not propagate to dirtying Yoga nodes. So if a leaf-node view changes, you need to do something like:
From https://github.com/facebook/yoga/issues/956, I'm not 100% sure that will work as expected though.
There may very well be a reason for this, but it does seem strange YogaLayout doesn't participate in native layout invalidation. My understanding from quick googling is that on invalidation, EditText would call
requestLayout()
on its parent. So if the YogaLayout is the parent of a view with self measure function, it should be able to do the Yoga node dirtying itself.yogaLayout.invalidate(editText);
this works