-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
keyboardDismissMode = "on-drag" on ScrollView not working with Android #23364
Comments
👋 there is this issue still present on RN 59? You posted a repro (thanks for that!) but it's on Snack, which is currently based on latest Expo which is using 0.57. |
I'm seeing the same issue RN |
@kelset Yes, still I'm seeing |
RN |
Ok thanks everyone - we just released the first 0.60 RC, could anyone try the repro with that version? |
@kelset Still happening on 0.60 RC, keyboard will dismiss only on tap but not on scroll. |
my workaround for now is to call Keyboard.dismiss() in my onScroll function. Its definitely annoying |
Any plan for fixing this bug ? |
Hi, Im experiencing the issue too , im using |
@yasir-netlinks
|
Repro on RN 0.60.5. |
What about 61? |
Yes, 0.61.1 too. Still need to monkey patch it. (with |
@kelset hello , I found why this issues happened, because of the fix in Fix for scrollview android #18785 @mistenkt added the code |
@kelset Hello, I have this problem too, it would like that this problem was solved, thanks. |
Hi, same problem here. It still presents on React Native 0.61.5 |
Same problem with 0.61.5, but can confirm the current workaround works. Will be nice if it's fixed |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Not fixed, stupid bot |
Not fixed. Need this to work. Any updates? |
hello folks - it seems that this bug has been around for quite some time but no one attempted a PR to fix it. If you have time I'd recommend you create a PR with a proper fix and link it here. |
still not fixed for 0.62 |
TLDR This functionality was never implemented for android and this is a feature request LONG VERIONS I think this functionality was never implemented on android Line 155 in 9263eb5
but somehow was included in the documents which should be updated.. The best way to have functionalities like this is using this workaround from @shyaniv7 const keyboardDismissProp = Platform.OS === "ios" ? { keyboardDismissMode: "on-drag" } : { onScrollEndDrag: Keyboard.dismiss }; as the workaround is easy to implement, while getting a pull request reviewed it is very hard... I would not consider writing a pr for this |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
No bot. And no, there's already PR which fixes it: #26422 I'm using by monkey patching with patch-package, and it works. So merging that would be nice. |
@fungilation it's working fine for both Android and IOS ? and if you can share the patch as sample it would be nice, as I am using the patch-package too |
my diff --git a/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js b/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js
index c344ac4..0f34d3c 100644
--- a/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js
+++ b/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js
@@ -969,6 +969,16 @@ class ScrollView extends React.Component<Props, State> {
}
}
+ _handleBeginScroll = (e: ScrollEvent) => {
+ if (
+ this.props.keyboardDismissMode === 'on-drag' &&
+ Platform.OS === 'android'
+ ) {
+ dismissKeyboard();
+ }
+ this._scrollResponder.scrollResponderHandleScrollBeginDrag(e);
+ };
+
_handleScroll = (e: ScrollEvent) => {
if (__DEV__) {
if (
@@ -985,14 +995,6 @@ class ScrollView extends React.Component<Props, State> {
);
}
}
- if (Platform.OS === 'android') {
- if (
- this.props.keyboardDismissMode === 'on-drag' &&
- this.state.isTouching
- ) {
- dismissKeyboard();
- }
- }
this._scrollResponder.scrollResponderHandleScroll(e);
};
@@ -1175,8 +1177,7 @@ class ScrollView extends React.Component<Props, State> {
.scrollResponderHandleResponderRelease,
onResponderTerminationRequest: this._scrollResponder
.scrollResponderHandleTerminationRequest,
- onScrollBeginDrag: this._scrollResponder
- .scrollResponderHandleScrollBeginDrag,
+ onScrollBeginDrag: this._handleBeginScroll,
onScrollEndDrag: this._scrollResponder.scrollResponderHandleScrollEndDrag,
onScrollShouldSetResponder: this._scrollResponder
.scrollResponderHandleScrollShouldSetResponder, |
This comment has been minimized.
This comment has been minimized.
Summary: This sync includes the following changes: - **[17806594c](facebook/react@17806594c )**: Move createRoot/hydrateRoot to react-dom/client ([#23385](facebook/react#23385)) //<Sebastian Markbåge>// - **[75662d6a7](facebook/react@75662d6a7 )**: Remove hacky stream.locked check, declare as byte stream instead ([#23387](facebook/react#23387)) //<Sebastian Markbåge>// - **[a82ef6d40](facebook/react@a82ef6d40 )**: Add back skipUnmountedBoundaries flag only for www ([#23383](facebook/react#23383)) //<Andrew Clark>// - **[f468816ef](facebook/react@f468816ef )**: Fix false positive hydration warnings ([#23364](facebook/react#23364)) //<Andrew Clark>// - **[5d08a24c2](facebook/react@5d08a24c2 )**: useId: Use 'H' to separate main id from hook index ([#23363](facebook/react#23363)) //<Andrew Clark>// - **[3a60844a0](facebook/react@3a60844a0 )**: Update error message for suspending at sync priority ([#23361](facebook/react#23361)) //<Andrew Clark>// - **[efe4121ee](facebook/react@efe4121ee )**: Add : to beginning and end of every useId ([#23360](facebook/react#23360)) //<Andrew Clark>// - **[42f15b324](facebook/react@42f15b324 )**: [DevTools][Transition Tracing] onTransitionComplete and onTransitionStart implmentation ([#23313](facebook/react#23313)) //<Luna Ruan>// - **[a5b22155c](facebook/react@a5b22155c )**: Warn if renderSubtreeIntoContainer is called ([#23355](facebook/react#23355)) //<Andrew Clark>// - **[52c393b5d](facebook/react@52c393b5d )**: Revert to client render on text mismatch ([#23354](facebook/react#23354)) //<Andrew Clark>// - **[1ad8d8129](facebook/react@1ad8d8129 )**: Remove object-assign polyfill ([#23351](facebook/react#23351)) //<Sebastian Markbåge>// - **[b3f3da205](facebook/react@b3f3da205 )**: Land warnOnSubscriptionInsideStartTransition flag ([#23353](facebook/react#23353)) //<Andrew Clark>// - **[990098f88](facebook/react@990098f88 )**: Re-arrange main ReactFeatureFlags module ([#23350](facebook/react#23350)) //<Andrew Clark>// - **[1f3f6db73](facebook/react@1f3f6db73 )**: Remove createMutableSource from stable exports ([#23352](facebook/react#23352)) //<Andrew Clark>// - **[587e75930](facebook/react@587e75930 )**: Remove Numeric Fallback of Symbols ([#23348](facebook/react#23348)) //<Sebastian Markbåge>// - **[40351575d](facebook/react@40351575d )**: Split writeChunk into void and return value ([#23343](facebook/react#23343)) //<Sebastian Markbåge>// - **[2c693b2de](facebook/react@2c693b2de )**: Re-add reentrancy avoidance ([#23342](facebook/react#23342)) //<Sebastian Markbåge>// - **[1760b27c0](facebook/react@1760b27c0 )**: Remove ./src/* export from public build ([#23262](facebook/react#23262)) //<Andrew Clark>// - **[552c067bb](facebook/react@552c067bb )**: Remove public export for unstable-shared-subset.js ([#23261](facebook/react#23261)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 4de99b3...1780659 jest_e2e[run_all_tests] Reviewed By: rickhanlonii Differential Revision: D34552175 fbshipit-source-id: f1c831a45f96d335a20c3b4113196e0a42cefc03
Summary: This sync includes the following changes: - **[17806594c](facebook/react@17806594c )**: Move createRoot/hydrateRoot to react-dom/client ([facebook#23385](facebook/react#23385)) //<Sebastian Markbåge>// - **[75662d6a7](facebook/react@75662d6a7 )**: Remove hacky stream.locked check, declare as byte stream instead ([facebook#23387](facebook/react#23387)) //<Sebastian Markbåge>// - **[a82ef6d40](facebook/react@a82ef6d40 )**: Add back skipUnmountedBoundaries flag only for www ([facebook#23383](facebook/react#23383)) //<Andrew Clark>// - **[f468816ef](facebook/react@f468816ef )**: Fix false positive hydration warnings ([facebook#23364](facebook/react#23364)) //<Andrew Clark>// - **[5d08a24c2](facebook/react@5d08a24c2 )**: useId: Use 'H' to separate main id from hook index ([facebook#23363](facebook/react#23363)) //<Andrew Clark>// - **[3a60844a0](facebook/react@3a60844a0 )**: Update error message for suspending at sync priority ([facebook#23361](facebook/react#23361)) //<Andrew Clark>// - **[efe4121ee](facebook/react@efe4121ee )**: Add : to beginning and end of every useId ([facebook#23360](facebook/react#23360)) //<Andrew Clark>// - **[42f15b324](facebook/react@42f15b324 )**: [DevTools][Transition Tracing] onTransitionComplete and onTransitionStart implmentation ([facebook#23313](facebook/react#23313)) //<Luna Ruan>// - **[a5b22155c](facebook/react@a5b22155c )**: Warn if renderSubtreeIntoContainer is called ([facebook#23355](facebook/react#23355)) //<Andrew Clark>// - **[52c393b5d](facebook/react@52c393b5d )**: Revert to client render on text mismatch ([facebook#23354](facebook/react#23354)) //<Andrew Clark>// - **[1ad8d8129](facebook/react@1ad8d8129 )**: Remove object-assign polyfill ([facebook#23351](facebook/react#23351)) //<Sebastian Markbåge>// - **[b3f3da205](facebook/react@b3f3da205 )**: Land warnOnSubscriptionInsideStartTransition flag ([facebook#23353](facebook/react#23353)) //<Andrew Clark>// - **[990098f88](facebook/react@990098f88 )**: Re-arrange main ReactFeatureFlags module ([facebook#23350](facebook/react#23350)) //<Andrew Clark>// - **[1f3f6db73](facebook/react@1f3f6db73 )**: Remove createMutableSource from stable exports ([facebook#23352](facebook/react#23352)) //<Andrew Clark>// - **[587e75930](facebook/react@587e75930 )**: Remove Numeric Fallback of Symbols ([facebook#23348](facebook/react#23348)) //<Sebastian Markbåge>// - **[40351575d](facebook/react@40351575d )**: Split writeChunk into void and return value ([facebook#23343](facebook/react#23343)) //<Sebastian Markbåge>// - **[2c693b2de](facebook/react@2c693b2de )**: Re-add reentrancy avoidance ([facebook#23342](facebook/react#23342)) //<Sebastian Markbåge>// - **[1760b27c0](facebook/react@1760b27c0 )**: Remove ./src/* export from public build ([facebook#23262](facebook/react#23262)) //<Andrew Clark>// - **[552c067bb](facebook/react@552c067bb )**: Remove public export for unstable-shared-subset.js ([facebook#23261](facebook/react#23261)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 4de99b3...1780659 jest_e2e[run_all_tests] Reviewed By: rickhanlonii Differential Revision: D34552175 fbshipit-source-id: f1c831a45f96d335a20c3b4113196e0a42cefc03
Summary: Fixes facebook#23364 The current logic using `_isTouching` does not work because `_handleTouchCancel` is always called before scroll events begin. This means `_isTouching` is always false. To fix it I moved the logic to `_handleScrollBeginDrag` which is only called once when scroll drag beings. This accomplishes the expected behavior and is better than keeping it in onScroll where it would be called for each scroll event. ## Changelog [Android] [Fixed] - Fix keyboardDismissMode="on-drag" on Android Pull Request resolved: facebook#31943 Test Plan: Tested in an app that on-drag does not work before and works after this patch. Reviewed By: sshic Differential Revision: D30674276 Pulled By: yungsters fbshipit-source-id: aa0bd605809fa01518f70fbf323c06e32c76ed1d
🐛 Bug Report
When scrolling in
ScrollView
when device keyboard active, on Android emulatorkeyboardDismissMode = "on-drag"
does not close the keyboardTo Reproduce
<ScrollView keyboardDismissMode = "on-drag"> {content} </ScrollView>
Expected Behavior
Keyboard should close when scrolling on Android device.
Code Example
Minimal Expo example
https://snack.expo.io/@hakkikonu/scrollview-bug
Environment
react-native info
output:React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 369.48 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.1 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 15, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28
Build Tools: 19.1.0, 20.0.0, 21.1.2, 22.0.1, 25.0.0, 26.0.2, 27.0.0, 28.0.3
System Images: android-15 | Intel x86 Atom, android-19 | ARM EABI v7a, android-19 | Intel x86 Atom, android-21 | Android TV ARM EABI v7a, android-21 | Android TV Intel x86 Atom, android-21 | Android Wear ARM EABI v7a, android-21 | Android Wear Intel x86 Atom, android-21 | ARM EABI v7a, android-21 | Intel x86 Atom, android-21 | Intel x86 Atom_64, android-21 | Google APIs ARM EABI v7a, android-21 | Google APIs Intel x86 Atom, android-21 | Google APIs Intel x86 Atom_64, android-22 | ARM EABI v7a, android-22 | Intel x86 Atom, android-22 | Intel x86 Atom_64, android-22 | Google APIs ARM EABI v7a, android-22 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-23 | Google APIs ARM EABI v7a, android-23 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom_64, android-25 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.58.4 => 0.58.4
npmGlobalPackages:
react-native-cli: 2.0.1
The text was updated successfully, but these errors were encountered: