Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double tap and triple tap gesture handling in textfields on iOS #831

Merged
merged 18 commits into from
Sep 26, 2023

Conversation

mazunin-v-jb
Copy link

@mazunin-v-jb mazunin-v-jb commented Sep 19, 2023

Proposed Changes

Added UIKitTapGesturesDetector.kt - repeating tap gestures detector.
Moved and separated the logic for handling taps in the textfields.
Added handling of double and triple taps in the textfields on iOS.

This PR also includes review fixes from my previous, closed one

Testing

Test: Open any screen with textfield with mutable text, then try to double or triple tap on text (or if its empty, write something in it). Try to test with focused textfield and unfocused.
Double tap selects the word, triple tap selects the paragraph.

Issues Fixed

JetBrains/compose-multiplatform#2682
https://youtrack.jetbrains.com/issue/COMPOSE-333/iOS-TextField-Incorrect-behavior-of-text-selection-by-double-tap (YT double version of the previous issue)
https://youtrack.jetbrains.com/issue/COMPOSE-409/iOS-TextField-support-triple-tap-handle

Google CLA

You need to sign the Google Contributor’s License Agreement at https://cla.developers.google.com/.
This is needed since we synchronise most of the code with Google’s AOSP repository. Signing this agreement allows us to synchronise code from your Pull Requests as well.

@google-cla
Copy link

google-cla bot commented Sep 19, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@igordmn igordmn left a comment

Choose a reason for hiding this comment

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

Thanks!

There some suggestions to reduce duplication, and small correction fixes

dima-avdeev-jb and others added 16 commits September 26, 2023 04:42
…ompose/foundation/text/TextFieldPointerModifier.common.kt

Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
…mpose/foundation/text/TextFieldPointerModifier.uikit.kt

Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
…mpose/foundation/text/TextFieldPointerModifier.uikit.kt

Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
…mpose/foundation/text/TextFieldPointerModifier.uikit.kt

Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
… added handling of tap, double tap and triple tap on textfield
move tap detection logic to skiko
remove redunant code
remove duplicate
Copy link
Collaborator

@igordmn igordmn left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@mazunin-v-jb mazunin-v-jb merged commit 3adcf23 into jb-main Sep 26, 2023
2 of 3 checks passed
@mazunin-v-jb mazunin-v-jb deleted the v.mazunin/new-uikit-tap-detector-for-textfield branch September 26, 2023 12:10
igordmn added a commit that referenced this pull request Nov 15, 2023
…textfields on iOS (#831)

## Proposed Changes

Added UIKitTapGesturesDetector.kt - repeating tap gestures detector.
Moved and separated the logic for handling taps in the textfields.
Added handling of double and triple taps in the textfields on iOS.

This PR also includes review fixes from [my previous, closed
one](#798)

## Testing

Test: Open any screen with textfield with mutable text, then try to
double or triple tap on text (or if its empty, write something in it).
Try to test with focused textfield and unfocused.
Double tap selects the word, triple tap selects the paragraph.

## Issues Fixed

JetBrains/compose-multiplatform#2682

https://youtrack.jetbrains.com/issue/COMPOSE-333/iOS-TextField-Incorrect-behavior-of-text-selection-by-double-tap
(YT double version of the previous issue)

https://youtrack.jetbrains.com/issue/COMPOSE-409/iOS-TextField-support-triple-tap-handle

## Google CLA
You need to sign the Google Contributor’s License Agreement at
https://cla.developers.google.com/.
This is needed since we synchronise most of the code with Google’s AOSP
repository. Signing this agreement allows us to synchronise code from
your Pull Requests as well.

---------

Co-authored-by: dima.avdeev <dima.avdeev@jetbrains.com>
Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
igordmn added a commit that referenced this pull request Nov 16, 2023
…tap gesture handling in textfields on iOS (#831)

## Proposed Changes

Added UIKitTapGesturesDetector.kt - repeating tap gestures detector.
Moved and separated the logic for handling taps in the textfields.
Added handling of double and triple taps in the textfields on iOS.

This PR also includes review fixes from [my previous, closed
one](#798)

## Testing

Test: Open any screen with textfield with mutable text, then try to
double or triple tap on text (or if its empty, write something in it).
Try to test with focused textfield and unfocused.
Double tap selects the word, triple tap selects the paragraph.

## Issues Fixed

JetBrains/compose-multiplatform#2682

https://youtrack.jetbrains.com/issue/COMPOSE-333/iOS-TextField-Incorrect-behavior-of-text-selection-by-double-tap
(YT double version of the previous issue)

https://youtrack.jetbrains.com/issue/COMPOSE-409/iOS-TextField-support-triple-tap-handle

## Google CLA
You need to sign the Google Contributor’s License Agreement at
https://cla.developers.google.com/.
This is needed since we synchronise most of the code with Google’s AOSP
repository. Signing this agreement allows us to synchronise code from
your Pull Requests as well.

---------

Co-authored-by: dima.avdeev <dima.avdeev@jetbrains.com>
Co-authored-by: Igor Demin <igordmn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants