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

[iOS] Popup content shifted up in 1.1.0-pre2 #142

Closed
MichaelRumpler opened this issue Jun 23, 2017 · 17 comments
Closed

[iOS] Popup content shifted up in 1.1.0-pre2 #142

MichaelRumpler opened this issue Jun 23, 2017 · 17 comments

Comments

@MichaelRumpler
Copy link
Contributor

When I updated from 1.1.0-pre1 to 1.1.0-pre2, the content of my popup was shifted up.

This is how it looked in pre1:
1 1 0-pre1

And in pre2 it is too far up:
1 1 0-pre2

I'm trying this on an iPad Pro with iOS 10.3.2. The popup does not use any animation.
The Label gets the focus on appearing. If I close the keyboard, then the contents are shown at the correct position, but when I set the focus to the Label to show the keyboard again, the content will be shifted up once more.

I tried setting SystemPadding, but that had no effect. Setting HasSystemPadding="false" did not shift the popup up when the keyboard was opened.

@rotorgames
Copy link
Owner

@MichaelRumpler Give me your xaml code which you use in PopupPage please.

MichaelRumpler added a commit to MichaelRumpler/Rg.Plugins.Popup that referenced this issue Jun 23, 2017
@MichaelRumpler
Copy link
Contributor Author

I added a repro page to https://github.com/MichaelRumpler/Rg.Plugins.Popup/tree/Repro_142
The xaml for this specific page is in https://github.com/MichaelRumpler/Rg.Plugins.Popup/blob/Repro_142/src/Demo/Demo/Pages/ReproPage.xaml

It's the complete page just to be sure.

@rotorgames
Copy link
Owner

@MichaelRumpler Thank you for examples. I will look it soon.

@shineon9
Copy link

shineon9 commented Nov 8, 2017

Any update about this? Thanks

@rotorgames
Copy link
Owner

@shineon84 I will work on it soon.

rraallvv pushed a commit to rraallvv/Rg.Plugins.Popup that referenced this issue Aug 16, 2018
MichaelRumpler added a commit to MichaelRumpler/Rg.Plugins.Popup that referenced this issue Nov 22, 2018
@MichaelRumpler
Copy link
Contributor Author

MichaelRumpler commented Nov 22, 2018

I updated my branch https://github.com/MichaelRumpler/Rg.Plugins.Popup/tree/Repro_142 to the current master. This represents Rg.Plugins.Popup 1.1.4 and uses Xamarin.Forms 3.0. It still has the same problem.
The content is shifted up when I hold the iPad in landscape and tap the Label to show the keyboard.

@rotorgames
Copy link
Owner

rotorgames commented Nov 22, 2018

@MichaelRumpler I have reviewed this issue and I can say that it is not popup's problem. Xamrin.Forms contains special class KeyboardInsetTracker which changes ContentOffsetof UIScrollView or UITableView when a keyboard appears. I can avoid this behavior only if I use Reflection but I don't want to do it. Now I'm creating special properties for PopupPage which will allow avoiding resizing a popup when the keyboard appears. They will be available for use in the next version. It will not fix this issue but it will allow avoiding auto-resizing of PopupPage

@MichaelRumpler
Copy link
Contributor Author

I'm ok with a workaround.
I do understand that you don't want to use Reflection in your library. Could you tell me what I need to do to work around it on my end?

Until now I just sticked with version 1.1.0-pre1, but I switched my PCL to .NET Standard now and that complains when I want to install that old version.

@rotorgames
Copy link
Owner

rotorgames commented Nov 25, 2018

@MichaelRumpler try to use v1.1.5.180 and to set HasKeyboardOffset of PopupPage to false. It will be the default xamarin.forms behavior.

@MichaelRumpler
Copy link
Contributor Author

Unfortunately this makes it even worse. The popup doesn't move up now and part of the popup is also overlayed by the keyboard.
img_0137

The popup itself should move up, but it's contents shouldn't move out of it. See the title bar in the very first screenshot.

@rotorgames
Copy link
Owner

@MichaelRumpler You need to keep all elements inside ScrollView, and set VerticalOptions=Fill for ScrollView and Center for Content of ScrollView

@MichaelRumpler
Copy link
Contributor Author

This makes the popup full height even without keyboard.
img_0138
It should only be as high as its content from the Title to the Cancel/OK buttons.

I updated the repro in https://github.com/MichaelRumpler/Rg.Plugins.Popup/blob/Repro_142/src/Demo/Demo/Pages/ReproPage.xaml#L81

@rotorgames
Copy link
Owner

rotorgames commented Dec 4, 2018

@MichaelRumpler You set BackgroundColor="White" for ScrollView, move it to StackLayout and the page will look good.

P.S. if you remove ScrollView from the page and set HasKeyboardOffset="True" then it will look better.

@MichaelRumpler
Copy link
Contributor Author

This is funny! Any reason why this caused problems?

Many thanks, now everything works as it should. Let me know if you come to Vienna/Austria. I owe you something.

@rotorgames
Copy link
Owner

rotorgames commented Dec 4, 2018

@MichaelRumpler You are welcome. It happens because of KeyboardInsetTracker, it is an internal class in Xamarin.Forms, you can see how it works here. This class detects a keyboard appearing and add bottom offset for ScrollView and ListView. I can't avoid this behavior because it is the internal Xamarin.Forms behavior. We only be able to ask the team of Xamarin.Forms to create special platform-specific methods which will allow disabling this behavior.

@MichaelRumpler
Copy link
Contributor Author

Yes, but why does it change when I move the BackgroundColor property to a different element?

@rotorgames
Copy link
Owner

@MichaelRumpler Because ScrollView had Fill vertical size and you saw white BackgroundColor of ScrollView but when I moved BackgroundColor to StackLayout it was ok because StackLayout had Center vertical size and didn't fill all vertical space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants