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

[v4] When Text Inputs become focused, the highest snap point is ALWAYS expanded to #1648

Open
calebpanza opened this issue Nov 30, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request v5

Comments

@calebpanza
Copy link

calebpanza commented Nov 30, 2023

Bug

When building out a sheet with a Text Input, the sheet will always expand to the highest snap point when the Text Input is focused.

Environment info

Library Version
@gorhom/bottom-sheet ^4
react-native 0.72.6
react-native-reanimated ~3.3.0
react-native-gesture-handler ~2.12.0

Steps To Reproduce

For example, I might have a sheet with the following snap points:
[100, 'CONTENT_HEIGHT']

When I focus the Text Input, the Bottom Sheet expands to the CONTENT_HEIGHT.

screen-20231130-120825.2.mp4

I want to be able to offer the user a chance to further expand the text input, so I update the snap points:
[100, 'CONTENT_HEIGHT', '90%']

Now, though, when I focus the Text Input, the Bottom Sheet will always expand to the 90%.

screen-20231130-120633.2.mp4

Describe what you expected to happen:
I'm expecting to be able to have the Text Input focus to the minimum required height for the size of my content unless the user specifies otherwise. The effect that I'm trying to achieve is similar to Slack's interface for text input. Some screenshots and examples are provided below.

screen-20231130-122651.2.mp4

What we're trying to achieve (this is a Figma prototype)

2023 11 30 02

Reproducible sample code

I put together this repo that includes an Expo app that you can see the code examples from the recordings above. Running the app is as simple as yarn && yarn start and works with Expo Go.

@calebpanza calebpanza added the bug Something isn't working label Nov 30, 2023
@gorhom
Copy link
Owner

gorhom commented Nov 30, 2023

Thanks for the detailed issue @calebpanza 🙌

this seemed to be a good feature request, i have drafted a new keyboard behaviour avoid and it would look like :

Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2023-11-30.at.18.57.23.mp4

i will need to iron it out and submit a CR by this weekend.

@gorhom gorhom self-assigned this Nov 30, 2023
@gorhom gorhom added v4 Written in Reanimated v2 v5 labels Nov 30, 2023
@calebpanza
Copy link
Author

Wow this is great! Thanks so much for looking into it so quickly. Are you thinking of making this a prop that could be configured on the Bottom Sheet?

If I were to have an accessory (like a button, maybe) trailing the text input on the bottom, would that element get cut off given the avoid behavior?? You could see this kind of thing play out in the gif that I posted where you have the "Public" button below the text input.

@calebpanza
Copy link
Author

Hey @gorhom just wanted to throw this out there. I was also having an issue where every time I focused on the Text Input on Androids, the entire Bottom Sheet would dismiss. Did some digging and found this solution as an open PR. When I implemented it, it also resolved the problem that we're discussing in this issue.

@calebpanza
Copy link
Author

Any progress here? More than happy to jump in and help if there's a branch/PR up!

@alikhan866
Copy link

I'm facing the exact same problem..

@calebpanza thank you so much for posting this bug.. just to confirm this is happening on IOS aswell right ?

@gorhom Can we expect this to be picked up soon ? would really appreciate it :)

@gorhom
Copy link
Owner

gorhom commented Jan 1, 2024

@calebpanza could you test #1675, it should address the issue

@gorhom gorhom added enhancement New feature or request and removed v4 Written in Reanimated v2 bug Something isn't working labels Jan 1, 2024
@alikhan866
Copy link

alikhan866 commented Jan 4, 2024

@gorhom I have tested by installing "@gorhom/bottom-sheet": "^5.0.0-alpha.6",

It still doesn't work.. still when text input is focused it snaps to highest snap point

also now I have to explicitly pass enableDynamicSizing={false} it seems to be defaulting to true when it should default to false as per the docs.

Appreciate you looking into this so quickly :) thanks alot

cc @calebpanza

@calebpanza
Copy link
Author

So sorry to have missed this. Was out for the holidays. I'd be happy to pull the 5.0 alpha and test this out!

@spthomas5
Copy link

Hi, I was wondering if there was a solution to this? I'm currently on "^4.6.1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v5
Projects
None yet
Development

No branches or pull requests

4 participants