Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the flex property on iOS not being respected. #1724

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import platform.UIKit.UIView
import platform.darwin.NSInteger

internal class UIViewFlexContainer(
private val direction: FlexDirection,
direction: FlexDirection,
) : FlexContainer<UIView>, ChangeListener {
private val yogaView: YogaUIView = YogaUIView(
applyModifier = { node, index ->
Expand All @@ -42,7 +42,7 @@ internal class UIViewFlexContainer(
)
override val value: UIView get() = yogaView
override val children = UIViewChildren(
value,
parent = value,
insert = { view, index ->
yogaView.rootNode.children.add(index, view.asNode())
value.insertSubview(view, index.convert<NSInteger>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import platform.CoreGraphics.CGRectZero
import platform.CoreGraphics.CGSize
import platform.CoreGraphics.CGSizeMake
import platform.UIKit.UIScrollView
import platform.UIKit.UIScrollViewContentInsetAdjustmentBehavior
import platform.UIKit.UIScrollViewContentInsetAdjustmentBehavior.UIScrollViewContentInsetAdjustmentNever
import platform.UIKit.UIView
import platform.UIKit.UIViewNoIntrinsicMetric

Expand All @@ -31,10 +31,11 @@ internal class YogaUIView(
var height = Constraint.Wrap

init {
// TODO: Support Scroll Indicators
// TODO: Support scroll indicators.
scrollEnabled = false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the one-line fix.

showsVerticalScrollIndicator = false
showsHorizontalScrollIndicator = false
contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.UIScrollViewContentInsetAdjustmentNever
contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever
}

override fun intrinsicContentSize(): CValue<CGSize> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1595,14 +1595,14 @@ internal object Yoga {
)
val isMainAxisRow = YGFlexDirectionIsRow(mainAxis)
val mainAxisSize = if (isMainAxisRow) width else height
val mainAxisownerSize = if (isMainAxisRow) ownerWidth else ownerHeight
val mainAxisOwnerSize = if (isMainAxisRow) ownerWidth else ownerHeight
var childWidth: Float
var childHeight: Float
var childWidthMeasureMode: YGMeasureMode
var childHeightMeasureMode: YGMeasureMode
val resolvedFlexBasis = YGResolveValue(
child.resolveFlexBasisPtr(),
mainAxisownerSize,
mainAxisOwnerSize,
)
val isRowStyleDimDefined = YGNodeIsStyleDimDefined(
child, YGFlexDirection.YGFlexDirectionRow,
Expand Down