YGOverflowScroll is not working with UIScrollView #940

Closed
opened 2019-10-22 20:05:28 -07:00 by peanut196 · 2 comments
peanut196 commented 2019-10-22 20:05:28 -07:00 (Migrated from github.com)

[self.view configureLayoutWithBlock:^(YGLayout * _Nonnull layout) {
layout.isEnabled = YES;
layout.flexDirection = YGFlexDirectionColumn;
}];
UIScrollView *scrollview = [[UIScrollView alloc] init];
[self.view addSubview:scrollview];
[scrollview configureLayoutWithBlock:^(YGLayout * _Nonnull layout) {
layout.isEnabled = YES;
layout.width = YGPercentValue(100);
layout.height = YGPercentValue(100);
layout.flexDirection = YGFlexDirectionColumn;
layout.overflow = YGOverflowScroll;
}];
UIView *view1 = [[UIView alloc] init];
[view1 setBackgroundColor:[UIColor redColor]];
[scrollview addSubview:view1];
[view1 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) {
layout.isEnabled = YES;
layout.width = YGPercentValue(100);
layout.height = YGPercentValue(50);
}];

UIView *view2 = [[UIView alloc] init];
[view2 setBackgroundColor:[UIColor yellowColor]];
[scrollview addSubview:view2];
[view2 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) {
    layout.isEnabled = YES;
    layout.width = YGPercentValue(100);
    layout.height = YGPercentValue(50);
}];


UIView *view3 = [[UIView alloc] init];
[view3 setBackgroundColor:[UIColor purpleColor]];
[scrollview addSubview:view3];
[view3 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) {
    layout.isEnabled = YES;
    layout.width = YGPercentValue(100);
    layout.height = YGPercentValue(50);
}];


UIView *view4 = [[UIView alloc] init];
[view4 setBackgroundColor:[UIColor cyanColor]];
[scrollview addSubview:view4];
[view4 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) {
    layout.isEnabled = YES;
    layout.width = YGPercentValue(100);
    layout.height = YGPercentValue(50);
}];

[self.view.yoga applyLayoutPreservingOrigin:NO];

After call ApplyLayout, scrollview contentSize not correct

[self.view configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { layout.isEnabled = YES; layout.flexDirection = YGFlexDirectionColumn; }]; UIScrollView *scrollview = [[UIScrollView alloc] init]; [self.view addSubview:scrollview]; [scrollview configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { layout.isEnabled = YES; layout.width = YGPercentValue(100); layout.height = YGPercentValue(100); layout.flexDirection = YGFlexDirectionColumn; layout.overflow = YGOverflowScroll; }]; UIView *view1 = [[UIView alloc] init]; [view1 setBackgroundColor:[UIColor redColor]]; [scrollview addSubview:view1]; [view1 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { layout.isEnabled = YES; layout.width = YGPercentValue(100); layout.height = YGPercentValue(50); }]; UIView *view2 = [[UIView alloc] init]; [view2 setBackgroundColor:[UIColor yellowColor]]; [scrollview addSubview:view2]; [view2 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { layout.isEnabled = YES; layout.width = YGPercentValue(100); layout.height = YGPercentValue(50); }]; UIView *view3 = [[UIView alloc] init]; [view3 setBackgroundColor:[UIColor purpleColor]]; [scrollview addSubview:view3]; [view3 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { layout.isEnabled = YES; layout.width = YGPercentValue(100); layout.height = YGPercentValue(50); }]; UIView *view4 = [[UIView alloc] init]; [view4 setBackgroundColor:[UIColor cyanColor]]; [scrollview addSubview:view4]; [view4 configureLayoutWithBlock:^(YGLayout * _Nonnull layout) { layout.isEnabled = YES; layout.width = YGPercentValue(100); layout.height = YGPercentValue(50); }]; [self.view.yoga applyLayoutPreservingOrigin:NO]; After call ApplyLayout, scrollview contentSize not correct
NSKevin commented 2023-05-15 00:45:57 -07:00 (Migrated from github.com)

Any Update ? I found that YGValueAuto is work out but YGPercentValue(100) does not .

Any Update ? I found that YGValueAuto is work out but YGPercentValue(100) does not .
NickGerleman commented 2023-06-13 08:07:34 -07:00 (Migrated from github.com)

We are deprecating YogaKit as part of the Yoga 2.0 release. We are still going to release a new revision based on the current state of the repo, but won't be accepting new contributions, since we are going to be removing it from the repo after.

We are deprecating YogaKit as part of the Yoga 2.0 release. We are still going to release a new revision based on the current state of the repo, but won't be accepting new contributions, since we are going to be removing it from the repo after.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DaddyFrosty/yoga#940
No description provided.