-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[Drawer] High swipeEdgeWidth value causes keyboard to gets constantly closed #10927
Copy link
Copy link
Closed
Closed
Copy link
Description
Current behavior
When using Drawer with e.g. swipeEdgeWidth: 500 pressing inside a TextInput is closing the Keyboard (instead of keeping the focus inside the TextInput
Screen.Recording.2022-10-14.at.12.49.41.PM.mov
Expected behavior
- I expect the Keyboard not to close when pressing again inside the
TextInput - The problem is with
react-native-gesture-handlercallingonStartbefore the activation criteria is metreact-navigation/packages/drawer/src/views/modern/Drawer.tsx
Lines 183 to 188 in a2e5f45
onStart: (event, ctx) => { ctx.startX = translationX.value; gestureState.value = event.state; touchStartX.value = event.x; runOnJS(onGestureStart)(); - The issue on RNGH is (kind of) documented here: onStart called before activation criteria is met software-mansion/react-native-gesture-handler#1225
- The best solution imho for this is to migrate to the new
GestureDetector, which has aonBeginand aonStart, whereonStartis really only called when the activation criteria is met.- PR for this change: [Drawer] refactor: use GestrueDetector to fix onStart bug #10928
- Another solution might be to move the
onGestureStarttoonActive- PR, if you prefer this proposal over the other: fix: only call onGestureStart when criteria met in drawer #10929
Reproduction
https://github.com/hannojg/react-navigation-swipeEdgeWidth-reproduction
Platform
- Android
- iOS
- Web
- Windows
- MacOS
Packages
- @react-navigation/bottom-tabs
- @react-navigation/drawer
- @react-navigation/material-bottom-tabs
- @react-navigation/material-top-tabs
- @react-navigation/stack
- @react-navigation/native-stack
Environment
- I've removed the packages that I don't use
| package | version |
|---|---|
| @react-navigation/native | 6.0.13 |
| @react-navigation/drawer | 6.5.0 |
| @react-navigation/stack | 6.3.2 |
| @react-navigation/native-stack | 6.9.1 |
| react-native-safe-area-context | 4.4.1 |
| react-native-screens | 3.18.2 |
| react-native-gesture-handler | 2.7.1 |
| react-native-reanimated | 2.11.0 |
| react-native | 0.70.3 |
| node | 16.15.1 |
| npm or yarn | 1.22.19 |
Reactions are currently unavailable