Various fixes

This commit is contained in:
Ilya Laktyushin 2024-06-10 14:27:05 +04:00
parent 1cc27e2a20
commit 2761be7991
3 changed files with 7 additions and 1 deletions

View File

@ -63,6 +63,7 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
public let backgroundColor: BackgroundColor public let backgroundColor: BackgroundColor
public let followContentSizeChanges: Bool public let followContentSizeChanges: Bool
public let clipsContent: Bool public let clipsContent: Bool
public let isScrollEnabled: Bool
public let externalState: ExternalState? public let externalState: ExternalState?
public let animateOut: ActionSlot<Action<()>> public let animateOut: ActionSlot<Action<()>>
public let onPan: () -> Void public let onPan: () -> Void
@ -72,6 +73,7 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
backgroundColor: BackgroundColor, backgroundColor: BackgroundColor,
followContentSizeChanges: Bool = false, followContentSizeChanges: Bool = false,
clipsContent: Bool = false, clipsContent: Bool = false,
isScrollEnabled: Bool = true,
externalState: ExternalState? = nil, externalState: ExternalState? = nil,
animateOut: ActionSlot<Action<()>>, animateOut: ActionSlot<Action<()>>,
onPan: @escaping () -> Void = {} onPan: @escaping () -> Void = {}
@ -80,6 +82,7 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
self.backgroundColor = backgroundColor self.backgroundColor = backgroundColor
self.followContentSizeChanges = followContentSizeChanges self.followContentSizeChanges = followContentSizeChanges
self.clipsContent = clipsContent self.clipsContent = clipsContent
self.isScrollEnabled = isScrollEnabled
self.externalState = externalState self.externalState = externalState
self.animateOut = animateOut self.animateOut = animateOut
self.onPan = onPan self.onPan = onPan
@ -389,6 +392,8 @@ public final class SheetComponent<ChildEnvironmentType: Equatable>: Component {
updateContentSize() updateContentSize()
} }
self.scrollView.isScrollEnabled = component.isScrollEnabled
self.ignoreScrolling = false self.ignoreScrolling = false
if let currentAvailableSize = self.currentAvailableSize, currentAvailableSize.height != availableSize.height { if let currentAvailableSize = self.currentAvailableSize, currentAvailableSize.height != availableSize.height {
self.scrollView.contentOffset = CGPoint(x: 0.0, y: -(availableSize.height - contentSize.height)) self.scrollView.contentOffset = CGPoint(x: 0.0, y: -(availableSize.height - contentSize.height))

View File

@ -21,7 +21,7 @@ private func loadCountryCodes() -> [Country] {
} }
let delimiter = ";" let delimiter = ";"
let endOfLine = "\n" let endOfLine = "\r\n"
var result: [Country] = [] var result: [Country] = []
var countriesByPrefix: [String: (Country, Country.CountryCode)] = [:] var countriesByPrefix: [String: (Country, Country.CountryCode)] = [:]

View File

@ -267,6 +267,7 @@ private final class BirthdayPickerScreenComponent: Component {
} }
)), )),
backgroundColor: .color(environment.theme.list.plainBackgroundColor), backgroundColor: .color(environment.theme.list.plainBackgroundColor),
isScrollEnabled: false,
animateOut: self.sheetAnimateOut animateOut: self.sheetAnimateOut
)), )),
environment: { environment: {