-
-
Notifications
You must be signed in to change notification settings - Fork 5
[Bug] iOS AutoDisconnectHandler appears to be breaking layout on re-appearing modal #31
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
Comments
You're absolutely right with all your assumptions. AutoDisconnectHandler="False" does not call the DisconnectHandler method in SegmentedControlHandlers (which sooner but rather later leads to memory leaks). |
I'm not familiar with shell apps. Would it be possible to get a very minimal shell app which causes this problem? |
I think the SegmentedControl is not properly checking the modal page stack, likely in HandlerCleanUpHelper.cs: I'll try to make a simple app to reproduce. |
It is surely a problem is the CheckIfPageIsUsed method. The thing is, this method is growing with more scenarios :) I wish MAUI would solve this DisconnectHandler problem for us... but at least for .net 8 they don't. |
Usage:
|
Maybe just needs line 79 in HandlerCleanUpHelper.cs changed from: return pageExists; to: if(pageExists) return true; Then the code will fall through and check further? |
Hello @brendonupson , is this PR expected to fix the layout issue with the segmented control on modal pages? #32 cc: @thomasgalliker Thanks in advance |
Important question: How are you registering pages in the DI container? Singleton or transient? |
Ok, ignore my question regarding DI registrations. I just had a look at your sample app (very valuable; always in such situations!). There is something wrong in the automatic disconnect logic. SegmentedControlHandler on Modal1Page is (mistakenly) disconnected when Modal2Page is displayed. |
There is a fix available for this problem. A new nuget pre-release will be available soon. |
Thanks @thomasgalliker for the support, really appreciate it 🙂 |
@vhugogarcia and @brendonupson can you test Plugin.SegmentedControl.Maui 1.4.25-pre and let me know if it solves the problem? 👍🏻 |
Looks like it's fixed for me on iOS, yet to test Android |
I out of the town today and this weekend, I can help to test on iOS and Android next Monday, I am sorry |
Hello @thomasgalliker , I tried the version you provided, however, the issue is still present. Please see the video below. Also, find below the console log: I have the project locally cloned, if there is something you want me to try, let me know and I can update the code. I will also give it a try myself to see if I can find out the root cause. Screen.Recording.2025-04-22.at.7.45.50.a.m.mov |
@vhugogarcia I saw your video but it's hard to tell if this is a related problem. I need a sample reproduction app to debug the code, just as @brendonupson has provided one above. In case of @brendonupson, the problem with the HandlerCleanUpHelper could be solved in PR #33. Can you also provide a sample sample app which only demonstrates the problem? |
Description
I have a shell app (bottom tabs) which launches modal pages. When a modal page contains a SegmentedControl and a subsequent modal page is displayed then dismissed, the segmented control appears in the wrong place on the original page.
Issue only seems to affect iOS.
If I add AutoDisconnectHandler="False", the problem does NOT occur. However, if I apply this "fix" I'm unsure if there are memory leak issues.
Steps to Reproduce
Expected Behavior
Actual Behavior
Basic Information
Screenshots, Attachments, Links
The text was updated successfully, but these errors were encountered: