Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jpnurmi
Copy link
Member

@jpnurmi jpnurmi commented Jun 15, 2021

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

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.
  • The reviewer has submitted any presubmit flakes in this PR using the engine presubmit flakes form before re-triggering the failure.

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
@flutter-dashboard
Copy link

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.

@jpnurmi
Copy link
Member Author

jpnurmi commented Jun 15, 2021

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

Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a 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];
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Contributor

@LongCatIsLooong LongCatIsLooong Jun 25, 2021

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.

Copy link
Member Author

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... 🙂

Copy link
Member Author

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!

@jpnurmi jpnurmi force-pushed the ios-text-input-type branch from d48c396 to 95cb5db Compare June 16, 2021 12:13
@jpnurmi jpnurmi closed this Jun 25, 2021
LongCatIsLooong added a commit to LongCatIsLooong/engine that referenced this pull request Jun 26, 2021
@jpnurmi jpnurmi deleted the ios-text-input-type branch June 29, 2021 17:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants