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

Screen flicker on ios 17 #424

Open
nigeshvenu opened this issue Feb 14, 2024 · 6 comments
Open

Screen flicker on ios 17 #424

nigeshvenu opened this issue Feb 14, 2024 · 6 comments

Comments

@nigeshvenu
Copy link

Screen flickering after banner dismiss when there is keyboard in the viewcontroller

@josetaykus
Copy link

josetaykus commented Feb 16, 2024

Same happens to me :(

But only if you show the banner on top and not always, if you show at bottom nothing happens :|

@josetaykus
Copy link

Flicks is related to this lines;

appWindow?.windowLevel = UIWindow.Level.normal

I have commented everything related to this window level and now is all good, but i dont know if this will have side effects.

@nigeshvenu
Copy link
Author

It seems that adjusting the window level by setting it to UIWindow.Level.statusBar + 1 while showing the banner and then resetting it to UIWindow.Level.normal upon dismissal is causing the issue. I have commented out these lines for now to maintain the default window level. Hope an update will available in the near future.

@scottgriv
Copy link

Flicks is related to this lines;

appWindow?.windowLevel = UIWindow.Level.normal

I have commented everything related to this window level and now is all good, but i dont know if this will have side effects.

I commented it out in all three places in the BaseNotificationBanner.swift class and everything seems to be working well now, thanks @nigeshvenu.

I didn't put in a PR because I'm not sure if this affects anything for other use cases other than how I'm using it on the top level.

For others experiencing this issue:

Lines 401, 406:

        if let parentViewController = parentViewController, parentViewController.view != nil {
            parentViewController.view.addSubview(self)
            if statusBarShouldBeShown() {
                //appWindow?.windowLevel = UIWindow.Level.normal
            }
        } else {
            appWindow?.addSubview(self)
            if statusBarShouldBeShown() && !(parentViewController == nil && bannerPosition == .top) {
                //appWindow?.windowLevel = UIWindow.Level.normal
            } else {
                appWindow?.windowLevel = UIWindow.Level.statusBar + 1
            }
        }

Line 610:

        self.bannerQueue.showNext(callback: { (isEmpty) in
            if isEmpty || self.statusBarShouldBeShown() {
                //self.appWindow?.windowLevel = UIWindow.Level.normal
            }
        })

@mixtly87
Copy link

On my app, even after commenting those lines, flickering is still visible (on first show)

@scottgriv
Copy link

scottgriv commented Nov 23, 2024

On my app, even after commenting those lines, flickering is still visible (on first show)

Strange, I'm on the latest beta and I'm not experiencing that issue after commenting out the lines mentioned above.

I'm also calling the banners from a central function:

func showBanner(title: String, subtitle: String, style: BannerStyle) {
    let banner = NotificationBanner(title: title, subtitle: subtitle, style: style)
    
    banner.bannerQueue.removeAll()
    banner.show(queuePosition: .front)
}

Try that? It shouldn't make a difference though, but maybe removing all banners or placing it at the top of the queue has something to do with it.

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

4 participants