bottom-sheet icon indicating copy to clipboard operation
bottom-sheet copied to clipboard

Keyboard overlaps bottomSheet

Open prabh-62 opened this issue 3 years ago • 6 comments

Thanks for creating this library

I am trying to use TextEditor inside .bottomSheet. UI works as expected bottomSheet

However, as soon as I tap inside TextEditor, keyboard pops up and covers the bottom sheet bottomSheet_keyboard

What can be done to readjust the bottom sheet?

prabh-62 avatar Feb 28 '21 18:02 prabh-62

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 avatar Mar 09 '21 20:03 manasv

@manasv do you happen to have a code snippet of this? Running into the same issue within a current project.

haIIux avatar Jun 14 '21 21:06 haIIux

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?

fluffy919 avatar Jun 27 '21 04:06 fluffy919

I have the same issue but really would like to use your code.

Could you please help with a fix? @weitieda

leafarenuk avatar Jun 30 '21 15:06 leafarenuk

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.

jimdog1001 avatar Dec 16 '22 14:12 jimdog1001

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

weitieda avatar Dec 16 '22 19:12 weitieda