-
Notifications
You must be signed in to change notification settings - Fork 6k
iOS: add support for TextInputType.none #26773
Conversation
TextInputType.none makes it possible to disable the virtual keyboard for certain TextFields, and lays the foundations for custom in-app virtual keyboards (flutter/flutter#76072). Ref: flutter/flutter#83567
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Minimal example: https://github.com/jpnurmi/text_input_type_none_example (requires flutter/flutter#83974 for the enum value) Simulator.Screen.Recording.-.iPhone.12.-.2021-06-15.at.23.30.27.mp4 |
LongCatIsLooong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Could you add tests to verify isKeyboardEnabled works correctly?
|
|
||
| - (void)showTextInput { | ||
| if (!_activeView.keyboardEnabled) { | ||
| [self hideTextInput]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at the hideTextInput's implementation it removes the active view from the view hierarchy and disables accessibility. Will this break voiceover? @chunhtai
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it will, we may need to find a better way to prevent softkeyboard from showing up. whichever the method we found here, we need to make sure the key stroke feedback in voice over still works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to use an empty UIView for inputView according to the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And there's an inputViewController property as well: https://developer.apple.com/documentation/uikit/uiresponder/1621117-inputviewcontroller?language=objc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would either of you have a chance to give it a shot, or is there anyone else that might have time to help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently dealing with something else. I'll give that a try later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inputView didn't work as advertised for me, but inputViewController did. I overrode inputViewController like so :
let inputVC = UIInputViewController()
override var inputViewController: UIInputViewController? {
shouldShowKeyboard ? nil : inputVC
}You get the system keyboard when returning nil for inputViewController, and a UIIpnutViewController gives a zero-width keyboard view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Mind pushing the patch? I'll close this because I'm no iOS dev... 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for trying it out!
d48c396 to
95cb5db
Compare
TextInputType.nonemakes it possible to disable the virtual keyboard for certain TextFields, and lays the foundations for custom in-app virtual keyboards (flutter/flutter#76072).Ref: flutter/flutter#83567
Pre-launch Checklist
writing and running engine tests.
///).