bottom-sheet
bottom-sheet copied to clipboard
Keyboard overlaps bottomSheet
Thanks for creating this library
I am trying to use TextEditor
inside .bottomSheet
. UI works as expected
However, as soon as I tap inside TextEditor
, keyboard pops up and covers the bottom sheet
What can be done to readjust the bottom sheet?
One thing, kinda hacky that you can do is listen for NotificationCenter notifications that tells if the keyboard will show or hide and change the height passed to the sheet based on that.
I've implemented it that way In a project of my own, but you have to maybe place an spacer at the bottom of your view for the content to remain in the upper part.
Will try to assess this internally in bottom sheet so its automatic 🤔
@manasv do you happen to have a code snippet of this? Running into the same issue within a current project.
One thing, kinda hacky that you can do is listen for NotificationCenter notifications that tells if the keyboard will show or hide and change the height passed to the sheet based on that.
I've implemented it that way In a project of my own, but you have to maybe place an spacer at the bottom of your view for the content to remain in the upper part.
Will try to assess this internally in bottom sheet so its automatic 🤔
Sounds good, but it didn't work well on my end. Can you share any sample code for that?
I have the same issue but really would like to use your code.
Could you please help with a fix? @weitieda
I found a fix for this. Using the Binding Bool that determines if the modal is open, add this line to the bottom of the view: .padding(.bottom, {Your-Binding-Bool-Goes-Here} ? 0.1 : 0) . For some reason adding this padding causes the view to lift. If you dont check if the view is open though, then it will show a little bit even when it is not open.
I found a fix for this. Using the Binding Bool that determines if the modal is open, add this line to the bottom of the view: .padding(.bottom, {Your-Binding-Bool-Goes-Here} ? 0.1 : 0) . For some reason adding this padding causes the view to lift. If you dont check if the view is open though, then it will show a little bit even when it is not open.
Great! Mind creating a PR for this? Thanks