-
Notifications
You must be signed in to change notification settings - Fork 11
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
The specified child already has a parent. You must call removeView() on the child's parent first. #6
Comments
Let me have a look. |
…w() on the child's parent first. #6
… must call removeView() on the child's parent first. #6
Fixed in latest version 1.0.6 https://www.nuget.org/packages/RGPopup.Maui/1.0.6 Thanks for reporting! |
There are still errors, please review and help! Microsoft.Maui.Controls.Element: Warning: Microsoft.Maui.Controls.Border is already a child of ClubSync.Views.Popup.BasePopup. Remove Microsoft.Maui.Controls.Border from ClubSync.Views.Popup.BasePopup before adding to Microsoft.Maui.Controls.ContentView. |
Can you provide the BasePopup's code and xaml? I had added some test demo code to reproduce this issue and fixed it. Maybe there is some more issues which are not been fixed. Here is the test demo case I added: 516d3f0 |
Please review and help! |
I still can not find the root cause, but I found a walk-around.
In UIHelper class, use a static BasePopup instance to popup content view. You can try it. I will take a deeper look for the root casue later. |
Thank you, I couldn't find the UpdateContent function. |
UpdateContent function is just like BasePopup's constructor. Looks like:
|
I have solved the problem thank you. |
… a parent. You must call removeView() on the child's parent first. #6
Finally fixed in latest version: https://www.nuget.org/packages/RGPopup.Maui/1.0.7 The root cause is the dynamic-added popup content view. If you add sub elements dynamiclly to a initialized PopupPage, then you should handle the Native view cleanup by yourself. (https://learn.microsoft.com/en-us/dotnet/maui/user-interface/handlers/create?view=net-maui-8.0#native-view-cleanup) There 3 ways to fix this problem:
2. The second one is to use a static BasePopupPage to hold the popup content view. Just like:
Use staticMode = true will always popup the _popup instance. 3. The last one is to handle the disconnections by RGPopup.Maui lib. It will auto disconnect all sub elements' handlers when popup page unloads.
@ntbao17 You can upgrade the RGPopup.Maui to 1.0.7 to verify the last solution when you are free. |
BTW there is a awesome lib I'd like to suggest to use in MAUI development which calls MemoryToolkit.Maui (https://github.com/AdamEssenmacher/MemoryToolkit.Maui) |
I'm using the RGPopup Maui package for the PopUp page in my MAUI project.
I got error
Exception: Java.Lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
But when I always create a new instance there is no error
The text was updated successfully, but these errors were encountered: