File tree Expand file tree Collapse file tree 5 files changed +18
-2
lines changed
WooCommerce/Classes/ViewRelated Expand file tree Collapse file tree 5 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 4423.6
55-----
66- [*] Handle sites configured with `http` siteAddress.
7+ - [*] Fix: Unable to dismiss keyboard when editing Product Title. [https://github.com/woocommerce/woocommerce-ios/pull/16288]
78
8923.5
910-----
Original file line number Diff line number Diff line change @@ -208,6 +208,7 @@ private extension ProductFormTableViewDataSource {
208208 productStatus: productStatus,
209209 placeholder: placeholder,
210210 textViewMinimumHeight: 10.0 ,
211+ shouldDismissOnReturn: true ,
211212 isScrollEnabled: false ,
212213 onNameChange: { [ weak self] ( newName) in self ? . onNameChange ? ( newName) } ,
213214 style: . headline)
Original file line number Diff line number Diff line change @@ -645,6 +645,7 @@ private extension ProductFormViewController {
645645 tableView. delegate = self
646646 tableView. accessibilityIdentifier = " product-form "
647647 tableView. cellLayoutMarginsFollowReadableWidth = true
648+ tableView. keyboardDismissMode = . onDrag
648649
649650 tableView. backgroundColor = . listForeground( modal: false )
650651 tableView. removeLastCellSeparator ( )
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ final class EnhancedTextView: UITextView {
66
77 var onTextChange : ( ( String ) -> Void ) ?
88 var onTextDidBeginEditing : ( ( ) -> Void ) ?
9+ var shouldDismissOnReturn : Bool = false
910
1011 var placeholder : String ? {
1112 didSet {
@@ -84,6 +85,18 @@ private extension EnhancedTextView {
8485//
8586extension EnhancedTextView : UITextViewDelegate {
8687
88+ func textView( _ textView: UITextView ,
89+ shouldChangeTextIn range: NSRange ,
90+ replacementText text: String ) -> Bool {
91+
92+ if shouldDismissOnReturn && text == " \n " {
93+ textView. resignFirstResponder ( )
94+ return false
95+ }
96+
97+ return true
98+ }
99+
87100 func textViewDidBeginEditing( _ textView: UITextView ) {
88101 hidePlaceholder ( )
89102 onTextDidBeginEditing ? ( )
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ final class LabeledTextViewTableViewCell: UITableViewCell {
88 var productStatus : ProductStatus
99 var placeholder : String ? = nil
1010 var textViewMinimumHeight : CGFloat ? = nil
11+ var shouldDismissOnReturn : Bool = false
1112 var isScrollEnabled : Bool = true
12- var keyboardType : UIKeyboardType = . default
1313 var onNameChange : ( ( _ text: String ) -> Void ) ? = nil
1414 var onTextDidBeginEditing : ( ( ) -> Void ) ? = nil
1515 var style : Style = . headline
@@ -33,7 +33,7 @@ final class LabeledTextViewTableViewCell: UITableViewCell {
3333 productTextField. isScrollEnabled = viewModel. isScrollEnabled
3434 productTextField. onTextChange = viewModel. onNameChange
3535 productTextField. onTextDidBeginEditing = viewModel. onTextDidBeginEditing
36- productTextField. keyboardType = viewModel. keyboardType
36+ productTextField. shouldDismissOnReturn = viewModel. shouldDismissOnReturn
3737 configureProductStatusLabel ( productStatus: viewModel. productStatus)
3838 applyStyle ( style: viewModel. style)
3939 }
You can’t perform that action at this time.
0 commit comments