-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add applyScrollOptions to UIScrollView components (#75)
* Add applyScrollOptions to UIScrollView components * Add ScrollOptions to CollectionView, ListView, ScrollView * Rename scrollProps to scrollOptions * Change ScrollOptions init in Example * Refactor ScrollView * Remove storage ScrollOptions in ScrollView
- Loading branch information
Showing
9 changed files
with
209 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// | ||
// ScrollOptions.swift | ||
// Tokamak | ||
// | ||
// Created by Matvii Hodovaniuk on 3/27/19. | ||
// | ||
|
||
public struct ScrollOptions: Equatable, Default { | ||
public static var defaultValue: ScrollOptions { | ||
return ScrollOptions() | ||
} | ||
|
||
public struct EdgeInsets: Equatable { | ||
public let bottom: Float | ||
public let left: Float | ||
public let right: Float | ||
public let top: Float | ||
|
||
public init( | ||
top: Float = 0, | ||
left: Float = 0, | ||
bottom: Float = 0, | ||
right: Float = 0 | ||
) { | ||
self.top = top | ||
self.left = left | ||
self.bottom = bottom | ||
self.right = right | ||
} | ||
} | ||
|
||
public enum IndicatorStyle { | ||
case `default` | ||
case black | ||
case white | ||
} | ||
|
||
public let alwaysBounceHorizontal: Bool | ||
public let alwaysBounceVertical: Bool | ||
public let bounces: Bool | ||
public let bouncesZoom: Bool | ||
public let contentInset: EdgeInsets | ||
public let indicatorStyle: IndicatorStyle | ||
public let isDirectionalLockEnabled: Bool | ||
public let isPagingEnabled: Bool | ||
public let isScrollEnabled: Bool | ||
public let maximumZoomScale: Float | ||
public let minimumZoomScale: Float | ||
public let scrollIndicatorInsets: EdgeInsets | ||
public let scrollsToTop: Bool | ||
public let showsHorizontalScrollIndicator: Bool | ||
public let showsVerticalScrollIndicator: Bool | ||
public let zoomScale: Float | ||
|
||
public init( | ||
alwaysBounceHorizontal: Bool = false, | ||
alwaysBounceVertical: Bool = false, | ||
bounces: Bool = true, | ||
bouncesZoom: Bool = true, | ||
contentInset: EdgeInsets = EdgeInsets(), | ||
indicatorStyle: IndicatorStyle = .default, | ||
isDirectionalLockEnabled: Bool = false, | ||
isPagingEnabled: Bool = false, | ||
isScrollEnabled: Bool = true, | ||
maximumZoomScale: Float = 1.0, | ||
minimumZoomScale: Float = 1.0, | ||
scrollIndicatorInsets: EdgeInsets = EdgeInsets(), | ||
scrollsToTop: Bool = true, | ||
showsHorizontalScrollIndicator: Bool = true, | ||
showsVerticalScrollIndicator: Bool = true, | ||
zoomScale: Float = 1.0 | ||
) { | ||
self.alwaysBounceHorizontal = alwaysBounceHorizontal | ||
self.alwaysBounceVertical = alwaysBounceVertical | ||
self.bounces = bounces | ||
self.bouncesZoom = bouncesZoom | ||
self.contentInset = contentInset | ||
self.isDirectionalLockEnabled = isDirectionalLockEnabled | ||
self.isPagingEnabled = isPagingEnabled | ||
self.indicatorStyle = indicatorStyle | ||
self.isScrollEnabled = isScrollEnabled | ||
self.maximumZoomScale = maximumZoomScale | ||
self.minimumZoomScale = minimumZoomScale | ||
self.scrollIndicatorInsets = scrollIndicatorInsets | ||
self.scrollsToTop = scrollsToTop | ||
self.showsVerticalScrollIndicator = showsVerticalScrollIndicator | ||
self.showsHorizontalScrollIndicator = showsHorizontalScrollIndicator | ||
self.zoomScale = zoomScale | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.