@@ -1536,6 +1536,7 @@ private struct BonsaiNativeNodeView: View {
15361536 @State private var compactSidebarDragOffset : CGFloat = 0
15371537 @State private var compactSidebarDragAxis : DragAxis ?
15381538 @State private var isCompactSidebarDragging = false
1539+ @State private var sidebarKeyboardBottomPadding : CGFloat = 0
15391540 @State private var toolbarExportFilename = " Export.txt "
15401541 @State private var toolbarExportContentType = " public.plain-text "
15411542 @State private var toolbarExportContent = " "
@@ -2194,6 +2195,16 @@ private struct BonsaiNativeNodeView: View {
21942195 . background ( bonsaiHomeBodyBackground. ignoresSafeArea ( . container, edges: . all) )
21952196 . opacity ( progress)
21962197 . scrollDisabled ( isCompactSidebarDragging)
2198+ . onReceive ( NotificationCenter . default. publisher ( for: UIResponder . keyboardWillChangeFrameNotification) ) { notification in
2199+ sidebarKeyboardBottomPadding = compactSidebarKeyboardBottomPadding (
2200+ notification: notification,
2201+ containerMaxY: proxy. frame ( in: . global) . maxY,
2202+ safeAreaBottom: proxy. safeAreaInsets. bottom
2203+ )
2204+ }
2205+ . onReceive ( NotificationCenter . default. publisher ( for: UIResponder . keyboardWillHideNotification) ) { _ in
2206+ sidebarKeyboardBottomPadding = 0
2207+ }
21972208
21982209 ZStack ( alignment: . top) {
21992210 if node. sidebarCompactTopBarVisible {
@@ -2278,10 +2289,23 @@ private struct BonsaiNativeNodeView: View {
22782289 sidebarBottomControls
22792290 . padding ( . horizontal, 12 )
22802291 . padding ( . top, 10 )
2292+ . padding ( . bottom, sidebarKeyboardBottomPadding)
2293+ . animation ( . easeOut( duration: 0.2 ) , value: sidebarKeyboardBottomPadding)
22812294 }
22822295 . frame ( maxHeight: . infinity, alignment: . topLeading)
22832296 }
22842297
2298+ private func compactSidebarKeyboardBottomPadding(
2299+ notification: Notification ,
2300+ containerMaxY: CGFloat ,
2301+ safeAreaBottom: CGFloat
2302+ ) -> CGFloat {
2303+ guard let keyboardFrame = notification. userInfo ? [ UIResponder . keyboardFrameEndUserInfoKey] as? CGRect
2304+ else { return 0 }
2305+ let overlap = max ( 0 , containerMaxY - keyboardFrame. minY)
2306+ return max ( 0 , overlap - safeAreaBottom)
2307+ }
2308+
22852309 private func compactSidebarVisibleWidth( revealWidth: CGFloat ) -> CGFloat {
22862310 max ( 0 , min ( revealWidth, ( isCompactSidebarOpen ? revealWidth : 0 ) + compactSidebarDragOffset) )
22872311 }
0 commit comments