-
-
Notifications
You must be signed in to change notification settings - Fork 768
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
[v5] [v4] Android keyboard issue in combination with Reanimated 3 #1356
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Not stale. |
I was experiencing this as well. |
Using I unfortunately cannot snap my bottom sheet to a 100%. |
@larsmunkholm @callaars Is there a code example that I can see to solve this issue |
@varshith5c This is a simplification, but essentially what I did:
|
Yes I put the reproducible code in the top issue description. https://github.com/callaars/bottom-sheet-android-keyboard-issue |
I can confirm this, when TextInput focused, onClose function on BottomSheet props will called bottom.sheet.bug.mp4 |
Hello, did anyone find a more stable solution to this issue? I started looking into it today and found a couple of interesting things. The most important part is: I was able to get a definite value for how high the snap point must be before the whole sheet is closed. Turns out it is exactly the height of the expanded keyboard. If the bottom sheet is even one pixel shorter than the keyboard, this condition momentarily evaluates to true and also this block of code is executed. Unfortunately I am testing on a pretty complex project so there are a ton of moving parts, I plan on trying on a brand new project to hopefully find a suitable patch either for this library or reanimated itself. With that said, I'd be curious to know if a more "official" solution is in the works. |
I am using
Here is the whole component:
It's a general component where the modal open states are managed through a context. |
any update about this issue? I'm having this problem in production. |
For me the way to resolve this was to go to |
Having exactly the same issue |
Having the same issue as well! @TarikHuber workaround works as a temporary fix! 😄 |
Using Reanimated 3, this resize animation with duration 0 causes the bottom sheet modal to disappear. Refs: gorhom#1356
I managed to reproduce this issue and sort of understand why this happens. Using a brand new React Native 0.71 project, which supports both Reanimated v2 and v3, I was able to determine that the issue only exists in v3, probably in I have opened a PR that adds a 1ms delay to the resize animation, which solves the issue both on my test project and real project. If anyone knows more about how However, for now, the PR can be used as workaround. |
Can confirm got the same problem with reanimated 3 and v5. |
I swapped out android:windowSoftInputMode="adjustResize" to android:windowSoftInputMode="adjustPan" in the AndroidManifest.xml and now it seems to be working. |
I've been spending a couple of days on this issue now, both trying to understand as much of the animation flow, and what triggers the different changes to all the internal values. The execution flow I have observed is as follows: With Reanimated v2:
With Reanimated v3:
I have not been able to understand why the flows are in different order with Reanimated v2 and v3. I have how ever understood why #1497 by @emilioschepis works as a workaround. |
After some further investigation, I've come across this change in Reanimated, that is part of v3 and not v2. I also came across a different issue (#1416) which actually seems to be the same as the one we are experiencing here, just triggered by other actions than keyboard appearance, eg. window resizing on web and device rotation on mobile (not only on Android, but on iOS as well). |
@gorhom could you take a look at this please? |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Not stale. |
@callaars could you test this pr. thanks @sondreluc for diving into the code base and detail the root cause. |
@gorhom I see that the above fix was merged and pushed out to v5, but is there a plan to push it out to v4 as well? |
@gorhom I'm still experiencing this on For now as a hopefully temporary workaround I'm gonna leave it at 100% but I'm really hoping to figure out a fix. Any ideas why it doesn't work for me after the fix? |
Hello, we have the same issue and like @ybentz, the fix pushed in v5 doesn't seems to work for us ; We are also using Expo 50 Android.keyboard.issue.mov |
I find that if you add 100% to your snapPoints and then set keyboardBehavior to either extend or fillParent, it fixes it. But thenyou get the stupid extra padding that blocks/shrinks the content inside the modal. The only workaround is setting my smallest snapPoints to 51%. |
Bug
On Android, when using Reanimated 3 (any 3.x version) the
BottomSheetModal
immediately closes itself when it is of a relatively small height (<200) and focuses aBottomSheetTextInput
. This does not happen when using a regularBottomSheet
.Incorrect:
Correct (when using a larger height):
Logs:
Incorrect:
Correct:
Environment info
Steps To Reproduce
BottomSheetModal
with a relative small height (<200) and aBottomSheetTextInput
.BottomSheetTextInput
Describe what you expected to happen:
When focussing the TextInput on a
BottomSheetModal
of any size I expect it not to close the bottom sheet.Reproducible sample code
https://github.com/callaars/bottom-sheet-android-keyboard-issue
The text was updated successfully, but these errors were encountered: