Hi!
I'm having issues with data form causing the Xamarin Shell App to slow down significantly with dynamic visibility and required properties being set at run time.
Some background on how the logic flows in our app:
We are using Xamarin Shell for navigation inside our app.
We have about 35 properties that can have their editors dynamically be visible or not and be required or not.
That information is fetched from API and should present a dynamically built data form.
Initially I did this by just loading the data form with all properties as visible and then after api data comes in, hide the ones that aren't needed. That proved to be blocking the UI thread for few seconds on Android and be extremely choppy on scrolling with iOS.
I solved this issue by setting the Cancel property on each data form item to true on initial load and after the data from API came in, I called the RefreshLayout() on data form and through usage of flag setting I was able to turn those property editors to be visible. That is still relatively slow on Android and it seems to block the UI thread when those properties are turned back on. iOS doesn't have that much of an issue with that.
Mainly our issues are that scrolling is a bit choppy and much much less fluid than on something like Xamarin Forms CollectionView or some similar scrolling element.
Few things I noticed while dealing with this issues:
1.) After I scroll through the list of Data Form editors on iOS, the scrolling is then really smooth - no hiccups or any issues. But scrolling to bottom when the view is first loaded is relatively choppy.
2.) Android seems to maintain the same choppines even after it was scrolled to the bottom.
3.) Android seems to be really blocking the UI thread on creating/updating the Data Form editors, for example on an initial button press to load a new view with 30 editors in data form it blocks at button press animation for about 2-3 seconds and then loads the view - really noticeable.
4.) On Android when scrolling up and down I get the following message spammed a few times:
[View] requestLayout() improperly called by crc64be068f9952f30593.ScrollPanel{dbdb523 V.E...... ......I. 0,0-1025,6802} during layout: running second layout pass
5.) On Android (Xiaomi Redmi Note 9 Pro device) I get spammed (much more than previous point) with the following message when scrolling:
[ForceDarkHelper] updateByCheckExcludeList: pkg: com.<OUR APP NAME> activity: crc6477568f4ea618ef40.MainActivity@e540665
-- I understand that this might have something to do with MIUI (Xiaomi Android version), but it still isn't showing that much (only once when initially loaded) when scrolling on SfListView or Xamarin's CollectionView
6.) Validation is working without much issues - no problems there
How the SfDataForm looks defined in Xaml:
<dataForm:SfDataForm x:Name="dataForm"
LayoutOptions="TextInputLayout"
ValidationMode="LostFocus"
Grid.Row="1"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
Validating="dataForm_Validating"
AutoGeneratingDataFormItem="dataForm_AutoGeneratingDataFormItem">
</dataForm:SfDataForm>
I'm assigning the dataForm's DataObject when instantiating the ViewModel inside the View's shell route parameter set handling:
[QueryProperty(nameof(AuctionId), "auctionId")]
private string _auctionId;
public string AuctionId
{
get { return _auctionId; }
set
{
_auctionId = value;
AddNoUpcAuctionItemViewModel = new AddNoUpcAuctionItemViewModel(this);
dataForm.DataObject = AddNoUpcAuctionItemViewModel.NoUPCAuctionItem;
BindingContext = AddNoUpcAuctionItemViewModel;
}
}
Please not that I'm not using behaviours - not sure if that could be the issue?
Details about our project:
Syncfusion packages version: 19.2.0.51
Xamarin Forms: 5.0.0.2012
androidx.recyclerview (not sure if you are using this to implement SfDataForms): 1.2.1.1
Devices:
iPhone SE
iPhone 8
Xiaomi Redmi Note 9 Pro
Google Pixel 3A XL
Unfortunately the project is quite complex and isn't free to public so I can't give you the entire source code - but if I can do anything more, please let me know.
Thanks! And a quick question - is performance much different between debug and release configuration? Not sure if there are any additional performance improvements while on release configuration.
Thanks for your fast responses and repro projects.
I have tested your sample, and rapid scrolling is choppy and slow feeling on Android.
On iOS it is a bit choppy and slow feeling as well (I tested only with Hot Restart used for deploying to device).
However, in our application I think that iOS is working fine if the app is not deployed to iOS device via Xamarin's Hot Restart, but with a build with Mac device. We don't have performance issues anymore with iOS when built with Mac and distributed for test via TestFlight. I would like to get feedback from your side if you have any issues with performance if it was deployed to iOS device using the Windows machine and Hot Restart and if those went away with usage of Mac device for a build.
I'm attaching the usage of Profile HWUI (Developer option in Android devices) videos on how it looks inside our app, as well as your demo project - I'm not an expert on UI element rendering stuff, but this seems like a big performance issue somewhere.
https://we.tl/t-kEJNrKamnA
Please note, file is larger than 30MB so I'm using an external file transfer service
Once again, thanks for being responsive - I really like using the DataForm controls, hopefully we'll be able to get to the bottom of my performance issues
Hey!
Thanks for being proactive about this issue. I have seen that member of Xamarin team has responded about the need for RecycleView. Is this something that can be implemented by your end soon?
We really love using DataForm, but performance is a bit lacking when it comes to Android. iOS seems to not have any issues when it is built via real Mac device, and not via HotRestart functionality.
Hi!
Is there any progress being made on improving the performance on Android? This is currently blocking us with release of few new features, we would really appreciate some time info on this.
Thanks in advance!
Hey!
Are there any new information about this? Will this get resolved in the October 5th update?
Thank you in advance!
Any news on this? I have also been having weird layout issues on both platforms when using more than just dataform element.
Do you have some guides on best practices and consideration for that? https://help.syncfusion.com/xamarin/dataform/getting-started#loading-dataform-inside-stacklayout I followed this guide and added a button at the end, but when the dataform is quite long, the formatting is way off and not working the same on android and ios platforms