You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to have positions of the sheet depend on the size of the content of the sheet.
There were some tweaks necessary, but it works for me now.
One problem I had to fix is this: UBottomSheetCoordinator sets its private variables minSheetPosition and maxSheetPosition very early in the process, when it is impossible that the sheet had any chance to do a layout. So the height of the content of the sheet is 0 at this point of time.
my workaround is this:
self.sheetCoordinator.addSheet(transitPlanViewController, to: self, didContainerCreate: { container in
let f = self.view.frame
let rect = CGRect(x: f.minX, y: f.minY, width: f.width, height: f.height)
container.roundCorners(corners: [.topLeft, .topRight], radius: 10, rect: rect)
self.sheetCoordinator.dataSource = dataSource // side effect: calculates private vars minSheetPosition + maxShetPosition from size of sheet after layout
})
You might decide to do something similar in the library.
Maybe even a public method to recalculate minSheetPosition and maxSheetPosition after rotating the device.
The text was updated successfully, but these errors were encountered:
GerdC
changed the title
Use case: make positions depnd on size of content of sheet
Use case: make positions depend on size of content of sheet
Aug 9, 2020
I'd like to have positions of the sheet depend on the size of the content of the sheet.
There were some tweaks necessary, but it works for me now.
One problem I had to fix is this:
UBottomSheetCoordinator
sets its private variablesminSheetPosition
andmaxSheetPosition
very early in the process, when it is impossible that the sheet had any chance to do a layout. So the height of the content of the sheet is 0 at this point of time.my workaround is this:
You might decide to do something similar in the library.
Maybe even a public method to recalculate
minSheetPosition
andmaxSheetPosition
after rotating the device.The text was updated successfully, but these errors were encountered: