alex
alex

Reputation: 127

Compose: tapping TextField inside a HorizontalPager makes the screen scroll horizontally

I working on an app with a tab bar, as I come for IOS I tried to implement there kind of navigation, creating a HorizontalPager with 4 tabs and each one have a NavHost ( not sure if it is relevant but the UI structure may be the problem ). in one of the screens down the navigation I have a LazyColumn displaying a list of cells and and some of them have 2 TextField lined up horizontally in a Row.

the problem is that when I click it, the keyboard comes up, and the screen scrolls vertically ( if needed ) so the keyboard wont hide the TextField, but at the same time the HorizontalPager also scrolls and shows the next tab a little bit and get stuck like that even when I stop editing.

Its confuses me because the HorizontalPager works in a way that only one screen is in focus ( unless I dont lift my finger in the middle of the scroll ) so is this a bug ?

I tried setting userScrollEnabled = false, for the HorizontalPager, didnt help.

Can something be done or should I reconsider restructuring my base design ( i chosen this design because if I click on another tab I need the previous one to hold it stack )

Thank you in advance !

Upvotes: 0

Views: 278

Answers (1)

alex
alex

Reputation: 127

Found a solution ! ( not sure if lucky or Im just not understanding why )

setting : pageSpacing = 0.dp,to the HorizontalPager seams to fix the problem

Upvotes: 0

Related Questions