Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions App/Composition/ShowSmilieKeyboardCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,29 @@ final class ShowSmilieKeyboardCommand: NSObject {

// Dismiss keyboard before showing smilie picker
textView.resignFirstResponder()

weak var weakTextView = textView
let pickerView = SmiliePickerView(dataStore: smilieKeyboard.dataStore) { [weak self] smilie in

let pickerView = SmiliePickerView(dataStore: smilieKeyboard.dataStore) { [weak self, weak textView] smilie in
self?.insertSmilie(smilie)
// Delay keyboard reactivation to ensure smooth animation after sheet dismissal
// Without this delay, the keyboard animation can conflict with sheet dismissal
DispatchQueue.main.async {
weakTextView?.becomeFirstResponder()
textView?.becomeFirstResponder()
}
}
.onDisappear {
.onDisappear { [weak textView] in
// Delay keyboard reactivation when view disappears (handles Done button case)
// This ensures the sheet dismissal animation completes before keyboard appears
DispatchQueue.main.async {
weakTextView?.becomeFirstResponder()
textView?.becomeFirstResponder()
}
}
.themed()

let hostingController = UIHostingController(rootView: pickerView)
hostingController.modalPresentationStyle = .pageSheet
hostingController.modalPresentationStyle = UIModalPresentationStyle.pageSheet

if let sheet = hostingController.sheetPresentationController {
sheet.detents = [.medium(), .large()]
sheet.detents = [UISheetPresentationController.Detent.medium(), UISheetPresentationController.Detent.large()]
sheet.prefersGrabberVisible = true
sheet.preferredCornerRadius = 20
sheet.delegate = self
Expand Down
Loading
Loading