Skip to content

Commit

Permalink
ScrollableColumn fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cl3m committed Jan 22, 2021
1 parent f77fcf4 commit 5458ebc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class ComposeTableViewController() : UIViewController(nibName = null, bundle = n

override fun tableView(tableView: UITableView, cellForRowAtIndexPath: NSIndexPath): UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, cellForRowAtIndexPath)
cell.selectionStyle = UITableViewCellSelectionStyle.UITableViewCellSelectionStyleNone
cell.separatorInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, CGFloat.MAX_VALUE)
cell.contentView.configureLayoutWithBlock { layout ->
layout?.width = YGPointValue( cell.frame.useContents { size.width } )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class UIComposeNavigationController() : UINavigationController(nibName = null, b
}
layout(controller)
resetTableViews(controller.view)
resetScrollViews(controller.view)
pushViewController(controller, true)
dispatch_async(dispatch_get_main_queue()) {
//TODO: Avoid a full relayout
Expand Down Expand Up @@ -93,6 +94,17 @@ class UIComposeNavigationController() : UINavigationController(nibName = null, b
}
}

private fun resetScrollViews(view: UIView) {
for (view in view.subviews) {
if (view !is UITableView && view is UIScrollView) {
val y = view.adjustedContentInset.useContents { top }
view.setContentOffset(CGPointMake(0.0, -y), false)
} else if (view is UIView){
resetScrollViews(view)
}
}
}

override fun popViewControllerAnimated(animated: Boolean): UIViewController? {
val controller = viewControllers!!.last()
if (controller is UIComposeViewController) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ actual fun ScrollableColumn(
layout?.height = YGPercentValue(100.0)
layout?.overflow = YGOverflow.YGOverflowScroll
}
modifier.setup(scrollView)
addSubview(scrollView) { content.invoke(iosColumnScope()) }
}

Expand Down

0 comments on commit 5458ebc

Please sign in to comment.