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

navigation transition is delayed by 0.5s #689

Open
kluku opened this issue Dec 9, 2020 · 5 comments
Open

navigation transition is delayed by 0.5s #689

kluku opened this issue Dec 9, 2020 · 5 comments

Comments

@kluku
Copy link

kluku commented Dec 9, 2020

What did you do?

I'm pushing a new view controller with Hero, nothing special. Going from the Home module to Search by tapping on the search field; the search field should move to the top.

navigationController.hero.isEnabled = true
navigationController.heroNavigationAnimationType = .fade
navigationController.pushViewController(searchModuleVC, animated: true)

In my Home module, I have the following configuration:

searchTextField.hero.id = UIConstants.HeroIDs.searchTextFieldId
searchTextField.hero.modifiers = [.translate()]

And in the search module just this:

searchTextField.hero.id = UIConstants.HeroIDs.searchTextFieldId

What did you expect to happen?

Well, the transition should happen.

What happened instead?

... and it does, but with a noticeable delay of 0.5s. I logged everything on the console and this is how it looks like:

2020-12-09 12:01:47.261124+0100 delegate called (textFieldShouldBeginEditing)
2020-12-09 12:01:47.261862+0100 showSearch will call push
2020-12-09 12:01:47.262464+0100 showSearch did call push
2020-12-09 12:01:47.796420+0100 [API] dead reply from commit sync

Note the delay of 0.53s and the last line. Before the console shows this line, nothing happens. It seems that the transition animation starts precisely when this line is printed on the console. Unfortunately, a quick google search for this log message doesn't show anything. When I disable Hero transition, there is no delay and no dead reply from commit sync line in the logs (just an ordinary "push" animation).

General Information

  • Hero Version: 1.5.0

  • iOS Version(s): 14.0, 14.2

  • Swift Version: 5

  • Devices/Simulators: iPhone 8 Plus (simulator), iPhone Xr iOS 14.0 (device)

  • Reproducible in Examples? (Yes/No): Yes, every time.

Demo Project

Unfortunately not allowed, maybe I'll create one from scratch later.

@hisham93
Copy link

Try to use the following: searchTextField.hero.modifiers = [.useLayerRenderSnapshot]
It solve the problem for me

@zdurlan
Copy link

zdurlan commented Aug 31, 2021

Hey! I am experiencing the same issue, [.useLayerRenderSnapshot] did not work.

@disczteam
Copy link

I'm also experiencing this but searchTextField.hero.modifiers = [.useLayerRenderSnapshot] didn't seem to work for me

@sghiassy
Copy link

sghiassy commented Sep 4, 2021

I'm experiencing the same thing. Here's a gif and a sample project in case it helps

fe65fd14-d8a3-4a52-a633-db6205fde48e

Sample App

HeroTestApp.zip

Code

The Sample App is basically a new stock Xcode project with just 1 ViewController with a ctr

import UIKit
import Hero

class ViewController: UIViewController {

    static var ctr = 1

    override func viewDidLoad() {
        super.viewDidLoad()
        self.isHeroEnabled = true
        self.view.backgroundColor = .white
        addButton()
    }

    func addButton() {
        let button = UIButton(frame: self.view.frame)
        button.hero.id = "daButton"
        self.view.addSubview(button)
        button.setTitleColor(.blue, for: .normal)
        button.setTitle("Button \(ViewController.ctr)", for: .normal)
        ViewController.ctr += 1
        button.addTarget(self, action: #selector(didTap), for: .touchUpInside)
    }

    @objc func didTap() {
        let nextVC = ViewController()
        nextVC.hero.modalAnimationType = .fade
        nextVC.isHeroEnabled = true
        self.present(nextVC, animated: true)
    }

}

@jstoppenbach
Copy link

jstoppenbach commented Dec 20, 2021

I can add to this discussion that for me the delay is only noticeable when the new ViewController is presented modally. There is no delay when the new ViewController is added to the navigation stack via self.navigationController?.push.
And I see the delay only on devices with iOS >= 15.

After some more evaluation I could narrow down the delay to the circumstance that the statusbar is being hidden in the modal view (triggered from its viewWillAppear)

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