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

TransitioningContentControl (and other Transitions?) not working properly on iOS after web authentication #13110

Closed
LyleRolleman-plst opened this issue Oct 2, 2023 · 6 comments · Fixed by #13942

Comments

@LyleRolleman-plst
Copy link

Describe the bug

When changing a bound Content property of a TransitioningContentControl on iOS after returning from a Web Authentication view (using MAUI.Essentials WebAuthenticator), it fails to navigate until I tap on some other control (say a button)

It works fine if it's just a regular ContentControl so presumably there is something funky going on with transitions

It also works fine if I do not launch the authentication flow

I think this is also happening on ReactiveUI's routing

To Reproduce

Steps to reproduce the behavior:

  1. Create a basic "sign in" kind of screen and launch a WebAuthenticator
  2. upon returning, attempt to set the Content property bound to the control, navigating to a view with a button (presumably some sort of router/view locator is in place, but don't think it matters).
  3. Observe nothing happens
  4. Tap a button (probably the sign in button), note instantly switches to the intended view

Expected behavior

Transition should occur

Screenshots

If applicable, add screenshots to help explain your problem.

N/A

Environment

  • OS: iOS
  • Avalonia-Version: 11.0.4

Additional context

I don't know how specific using WebAuthenticator is to this, perhaps any deep link or any native modal style view will cause it? Not sure at this point

@timunie
Copy link
Contributor

timunie commented Oct 2, 2023

@LyleRolleman-plst please provide a minimum sample to reproduce. Probably it's an issue of call order simply

@LyleRolleman-plst
Copy link
Author

TransitionsTest.zip

I've attached a quick and dirty app demonstrating the problem.

Note, no actual sign in was setup, but you can trigger the bug by just tapping Cancel on the browser window

@timunie
Copy link
Contributor

timunie commented Oct 4, 2023

Better to use DataTemplates instead of placing a UserControl into the ViewModel. In the MVVM world, you try to strictly have Model - View - and VeiwModel separated.

So please don't do this:
image

Instead, please check out https://github.com/AvaloniaUI/Avalonia.Samples#%EF%B8%8F-datatemplate-samples and https://github.com/AvaloniaUI/Avalonia.Samples/tree/main/src/Avalonia.Samples/Routing/BasicViewLocatorSample how to use DataTemplates for navigation

@LyleRolleman-plst
Copy link
Author

@timunie Oh I know, this is just the absolutely simplest demonstration of the bug I could cook up in what time I had available. It certainly is not a demonstration of proper MVVM design...

The bug also affects ReactiveUI (which I don't use, I prefer Community Toolkit. So much less boilerplate). In the ReactiveUI case, it resolves the view fine, and shows up in the router's history, but no navigation until you tap something to "unstick" it

@timunie
Copy link
Contributor

timunie commented Oct 5, 2023

@LyleRolleman-plst thx for the clarification, I got it.

One idea I have which sometimes helps is to utilize Dispatcher.UiThread.Post in order to wait for the UI to "unfreeze".

However if that also doesn't help, we nned to wait for someone with an iOS as I own no such device on my own.

@LyleRolleman-plst
Copy link
Author

@timunie I tried that without success :(

On the off chance that it matters, this is on an iPhone SE (3rd gen) running iOS 16.6.1

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

Successfully merging a pull request may close this issue.

3 participants