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

[ScrollView] Handle dissmissKeyboardMode="on-drag" for Android #26422

Closed
wants to merge 1 commit into from

Conversation

azanli
Copy link

@azanli azanli commented Sep 12, 2019

Summary

dismissKeyboardMode="on-drag" prop for Android's ScrollView does not work as expected according to the docs. This problem has been verified in #23364 and from personal tests.

Changelog

[Android] [Fixed] - Handle dissmissKeyboardMode="on-drag" for Android

Test Plan

with fix & without fix

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 12, 2019
@janicduplessis
Copy link
Contributor

janicduplessis commented Sep 13, 2019

The fix seems fine but the need for it seems to come from another issue. Do you know why this.state.isTouching is not true while scrolling? It is supposed to get set here https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollResponder.js#L389.

Looks like it gets called in onTouchStart here

onTouchStart: this._scrollResponder.scrollResponderHandleTouchStart,
, is it possible this never gets called on Android?

@azanli
Copy link
Author

azanli commented Sep 13, 2019

I was trying to figure out why this.state.isTouching is not true and I came to the conclusion that this.state isn't sharing the same context. If you look around, this.state.isTouching isn't set anywhere in ScrollView.js. I also tried checking against this._scrollResponder.state.isTouching and state wasn't reachable which makes sense because the ScrollView class only copies over the properties but isn't instantiated from ScrollResponder.

I'm not sure whether onTouchStart ever gets called on Android but my assessment was that onScrollBeginDrag is essentially the same. Either way, it makes sense to move any operations out of onScroll if possible. Also, the property value on-drag synergizes with onScrollBeginDrag.

@vorasudh
Copy link

I am facing the same issue and looking forward to this merge.

Copy link
Contributor

@janicduplessis janicduplessis left a comment

Choose a reason for hiding this comment

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

The change makes sense on its own, even if it doesn't fix the underlying cause of the issue so I'm fine with it.

We should probably try to investigate why isTouching isn't working later as it might cause other bugs.

@elicwhite elicwhite requested a review from sahrens September 18, 2019 17:47
@fungilation
Copy link

Nice patch! Works and fixes #23364 indeed on Andoird. On RN 0.60.5

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@sahrens is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@sahrens
Copy link
Contributor

sahrens commented Sep 30, 2019

Thanks for the fix, and thanks for the review @janicduplessis - if you're ok with it, I'm ok with it :)

@fungilation
Copy link

Can we get this merged please? I reproduced issue on android in my app, which this PR fixes. I've been monkey patching (patch-package) RN for months now to get this fix.

@rtman
Copy link

rtman commented Oct 26, 2020

This is still an issue, can we get this merged?

@janicduplessis
Copy link
Contributor

updated the fix in #31943

@github-actions
Copy link

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 20, 2023
@github-actions
Copy link

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Keyboard Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Component: ScrollView Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants