Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
[iOS SDK] Tap to close keyboard (#27104)
Browse files Browse the repository at this point in the history
- Fixes:
https://nabla-tech.slack.com/archives/C04ENMXR93J/p1685402302117649

## Summary

Keep the interactive dismiss, but add tap to close.

### Changelog

- Messaging UI: Users can tap any where on the conversation screen to
close the keyboard.

## Test plan



https://github.com/nabla/health/assets/2571118/fa824d4d-4da0-42e5-a250-40ab661545c3
  • Loading branch information
tgyhlsb authored May 30, 2023
1 parent 1b8af06 commit f03c6cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Messaging UI: Users can tap any where on the conversation screen to close the keyboard.

### Fixed


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ final class ConversationViewController: UIViewController, ConversationViewContra
// TODO: @tgy - Don't retain modules
private lazy var imagePickerModule = ImagePickerModule(delegate: self)

private lazy var tapGesture: UIGestureRecognizer = {
let recognizer = UITapGestureRecognizer(target: self, action: #selector(tapGestureHandler))
recognizer.cancelsTouchesInView = false
return recognizer
}()

@objc private func tapGestureHandler() {
view.endEditing(true)
}

private func initialize() {
hidesBottomBarWhenPushed = true

Expand All @@ -191,6 +201,8 @@ final class ConversationViewController: UIViewController, ConversationViewContra
?? UINavigationBarAppearance()
scrollEdgeAppearance.configureWithDefaultBackground()
navigationItem.scrollEdgeAppearance = scrollEdgeAppearance

collectionView.addGestureRecognizer(tapGesture)
}

private func setUp() {
Expand Down

0 comments on commit f03c6cc

Please sign in to comment.