Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
fix: useParentScroll related bug (#51)
Browse files Browse the repository at this point in the history
* fix: useParentScroll related bug

Signed-off-by: Daniel Tes Carrasque <daniel@zup.com.br>

* testCodableListView changes

Signed-off-by: Daniel Tes Carrasque <daniel@zup.com.br>

Signed-off-by: Daniel Tes Carrasque <daniel@zup.com.br>
  • Loading branch information
dantes-git authored Dec 16, 2022
1 parent 9753f65 commit e3a36ca
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
}
}
}
]
],
"useParentScroll" : true
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ extension GridView {
onScrollEnd: onScrollEnd,
scrollEndThreshold: CGFloat(scrollEndThreshold ?? 100),
isScrollIndicatorVisible: isScrollIndicatorVisible ?? false,
dataSourceExpression: dataSource
dataSourceExpression: dataSource,
useParentScroll: useParentScroll
),
renderer: renderer
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public struct GridView: Widget, HasContext, InitiableComponent {

/// This attribute enables or disables the scroll indicator.
public var isScrollIndicatorVisible: Bool?

public var useParentScroll: Bool?

public var id: String?
public var style: Style?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ extension ListView {
onScrollEnd: onScrollEnd,
scrollEndThreshold: CGFloat(scrollEndThreshold ?? 100),
isScrollIndicatorVisible: isScrollIndicatorVisible ?? false,
dataSourceExpression: dataSource
dataSourceExpression: dataSource,
useParentScroll: useParentScroll
),
renderer: renderer
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public struct ListView: Widget, HasContext, InitiableComponent {

/// This attribute enables or disables the scroll indicator.
public var isScrollIndicatorVisible: Bool?

public var useParentScroll: Bool?

public var id: String?
public var style: Style?
Expand Down Expand Up @@ -88,6 +90,7 @@ extension ListView {
case id
case style
case accessibility
case useParentScroll
}

public init(from decoder: Decoder) throws {
Expand All @@ -106,6 +109,7 @@ extension ListView {
id = try container.decodeIfPresent(String.self, forKey: .id)
style = try container.decodeIfPresent(Style.self, forKey: .style) ?? Style()
accessibility = try container.decodeIfPresent(Accessibility.self, forKey: .accessibility)
useParentScroll = try container.decodeIfPresent(Bool.self, forKey: .useParentScroll)

self.templates = try container.decodeIfPresent([Template].self, forKey: .templates) ?? []
self.dataSource = try container.decode(Expression<[DynamicObject]>.self, forKey: .dataSource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ final class ListViewUIComponent: UIView {
collection.delegate = self
collection.showsHorizontalScrollIndicator = model.isScrollIndicatorVisible
collection.showsVerticalScrollIndicator = model.isScrollIndicatorVisible

if model.useParentScroll == true {
collection.isScrollEnabled = false
}

let parentController = listController.renderer.controller
parentController?.addChild(listController)
Expand Down Expand Up @@ -244,6 +248,7 @@ extension ListViewUIComponent {
var scrollEndThreshold: CGFloat
var isScrollIndicatorVisible: Bool
var dataSourceExpression: Expression<[DynamicObject]>
var useParentScroll: Bool?
}
}

Expand Down

0 comments on commit e3a36ca

Please sign in to comment.