how to refresh layout after change textsize? #956

Closed
opened 2019-12-11 00:42:01 -08:00 by icemanstudy · 3 comments
icemanstudy commented 2019-12-11 00:42:01 -08:00 (Migrated from github.com)

Report

Issues and Steps to Reproduce

I use YogaLayout to add a TextView as a child:

YogaLayout yogaLayout = new YogaLayout(this);
yogaLayout.getYogaNode().setFlexDirection(YogaFlexDirection.ROW);
rootLayout.addView(yogaLayout);
TextView textView = new TextView(this);
textView .setText("test");
yogaLayout.addView(textView1, -1, new YogaLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));

after 5s,I modify the textSize of the textview,the text became larger,but the layout of YogaLayout and TextView don't change~.

new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                textView.setTextSize(30);
            }
        }, 5000);

i try to use these codes after change textSize ,but not work:

yogaLayout.invalidate(textView);
yogaLayout.requestLayout();

so,how to change the layout after i change child's LayoutParams in YogaLayout?

# Report - [x] I have searched [existing issues](https://github.com/facebook/yoga/issues) and this is not a duplicate # Issues and Steps to Reproduce I use YogaLayout to add a TextView as a child: ``` YogaLayout yogaLayout = new YogaLayout(this); yogaLayout.getYogaNode().setFlexDirection(YogaFlexDirection.ROW); rootLayout.addView(yogaLayout); TextView textView = new TextView(this); textView .setText("test"); yogaLayout.addView(textView1, -1, new YogaLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); ``` after 5s,I modify the textSize of the textview,the text became larger,but the layout of YogaLayout and TextView don't change~. ``` new Handler().postDelayed(new Runnable() { @Override public void run() { textView.setTextSize(30); } }, 5000); ``` i try to use these codes after change textSize ,but not work: ``` yogaLayout.invalidate(textView); yogaLayout.requestLayout(); ``` so,how to change the layout after i change child's LayoutParams in YogaLayout?
uziasferreirazup commented 2020-09-23 08:19:49 -07:00 (Migrated from github.com)

hey, how do you solve this problem @icemanstudy ?

hey, how do you solve this problem @icemanstudy ?
jeromexiong commented 2021-09-18 02:53:00 -07:00 (Migrated from github.com)

The following code will relayout at pod 'YogaKit', '~> 1.18.1'

textView.yoga.markDirty()
textView.superview?.yoga.applyLayout(preservingOrigin: true)
The following code will relayout at `pod 'YogaKit', '~> 1.18.1'` ``` textView.yoga.markDirty() textView.superview?.yoga.applyLayout(preservingOrigin: true) ```
NickGerleman commented 2023-04-25 20:44:09 -07:00 (Migrated from github.com)

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.

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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DaddyFrosty/yoga#956
No description provided.