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

safe areas do not work properly on IOS ( iPhone11 ) #10

Open
CmarkoLukas opened this issue Jan 11, 2023 · 4 comments
Open

safe areas do not work properly on IOS ( iPhone11 ) #10

CmarkoLukas opened this issue Jan 11, 2023 · 4 comments

Comments

@CmarkoLukas
Copy link

I have an angular app purely using capacitor 4 without Ionic. I am using the plugin and it works like a charm on Android but unfortunately not so good on iOS. I also tried the css way without the plugin but the result was same:

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left) !important;
}

With both ways I am using:
viewport-fit=cover in viewport metatag
ios: {
contentInset: "always", in the capacitor.config.ts file
},

But the content of the app goes under the status bar / top safe area when scrolling. I also tried various combinations with these options but none of the results was good ( for example I got the safe areas properly but content goes under them and they are transparent I think it was with not using contentInset and viewport-fit with contain not cover ).
Is there any way to make this work properly with capacitor 4 on IOS ?

@BVeronezi
Copy link

I have the same problem here. Does anyone have a solution for this?

@AlwaysLoveme
Copy link
Owner

I have an angular app purely using capacitor 4 without Ionic. I am using the plugin and it works like a charm on Android but unfortunately not so good on iOS. I also tried the css way without the plugin but the result was same:


body {

  padding: env(safe-area-inset-top) env(safe-area-inset-right)

    env(safe-area-inset-bottom) env(safe-area-inset-left) !important;

}

With both ways I am using:

viewport-fit=cover in viewport metatag

ios: {

contentInset: "always",  in the capacitor.config.ts file

},

But the content of the app goes under the status bar / top safe area when scrolling. I also tried various combinations with these options but none of the results was good ( for example I got the safe areas properly but content goes under them and they are transparent I think it was with not using contentInset and viewport-fit with contain not cover ).

Is there any way to make this work properly with capacitor 4 on IOS ?

I can't reappear

@YishaqG
Copy link

YishaqG commented Jul 16, 2023

Not sure if I fully get what you're saying, but adding the following made it work for me on iOS

		<meta
			name="viewport"
			content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover"
		/>
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

@pcsantana
Copy link

I was facing the same problem!
I solved it and posted the solution here: https://stackoverflow.com/a/78385858/6031927
Give it a try.

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

No branches or pull requests

5 participants