wekas
December 9, 2020, 2:53am
1
I originally wrote this code a over a year ago. Now it causes a fullscreen white flashing of the background when the screen is touched anywhere (textbox or background) if used with iPhone X or later, I tried it on an iPhone 8 and it actually does the same thing but with black so it is nowhere near as bad.
Any suggestions from the Ionic hive mind?
Code:
<ion-content forceOverscroll="false">
<div class="content">
ion-content{
width: 100%;
height: 100%;
padding: 0;
position: relative;
--background: url("./../../../assets/img/login-bg.jpg") no-repeat fixed center / cover;
}
.content {
background: linear-gradient(to bottom, rgb(0 0 0 / 0.5) 0%, rgba(125, 232, 130, 0) 40%);
}
EDIT:
May be related to:
opened 01:34AM - 14 Feb 19 UTC
closed 01:11PM - 15 May 19 UTC
package: core
type: bug
# Bug Report
**Ionic version:**
4.0.0
**Current behavior:**
If a page ha… s background image set to `ion-content`, then while navigating to that page is flickering.
**Expected behavior:**
Flickering should not happen.
**Steps to reproduce:**
Create a page with ion-content set with background-image like below -
`
ion-content {
--background: url('./../../../assets/images/ica-slidebox-img-1.png') no-repeat 50% 10%;
}
`
**Ionic info:**
```
Ionic:
ionic (Ionic CLI) : 4.9.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0
@angular-devkit/build-angular : 0.12.1
@angular-devkit/schematics : 7.2.1
@angular/cli : 7.2.3
@ionic/angular-toolkit : 1.2.1
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 8 other plugins)
System:
ios-deploy : 1.9.4
ios-sim : 7.0.0
NodeJS : v10.15.0 (/usr/local/bin/node)
npm : 6.5.0
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61
```
NOTE: We have tried with 4.0.1 release as well and it's the same!
https://bugs.webkit.org/show_bug.cgi?id=195628
wekas
December 9, 2020, 4:04am
2
This seems to be the fix:
Both Github issues have been locked so it’s not possible to add this comment there, but anyways…
Just in case if this could help some other devs, another option is to use CSS Shadow Parts since the content exposes the background in that way.
ion-content {
// Workaround for issue related to css varialbes
// being recalculated with DOM changes
// https://github.com/ionic-team/ionic-framework/issues/17494
// https://github.com/ionic-team/ionic-framework/issues/16678
&::part(background) …
ion-content {
// Workaround for issue related to css varialbes
// being recalculated with DOM changes
// https://github.com/ionic-team/ionic-framework/issues/17494
// https://github.com/ionic-team/ionic-framework/issues/16678
&::part(background) {
background: url('...') no-repeat center center / cover;
}
...
...
}
1 Like