First of all, thank you for the great test projects - they were really helpful to reproduce the issues at our side.
Now straight to the point - I have played with your implementation and was able to overcome this issue,
There are a couple of reasons creating this "jumping" behavior and the most important of them is that in order for the LoadOnDemand to work in iOS you will need itemHeightЕ
set for your RadListView.
The second part of the issue is related to the usage of scrollToIndex
in your code which was overwriting the default scrolling behavior provided by LoadOnDemand by design. In the lines below I will cover both issues and show you how to overcome them so that the LoadOnDemand to work as expected in iOS.
The iOS-specific code for the itemHeight
While we are not obligated to set itemHeight
in Android for iOS this is a mandatory setting to enable LoadOnDemand. Here is how we have made it in our own SDK example
. Note that this line was explicitly enabled only for iOS using this custom directive for platform detection
(which on the other hand needed to be declared in your NgModule file like done here
). Using this directive allows us to use this code only for iOS instead for both Android and iOS.
Removing the additional jump behavior.
Now that we have introduced the itemHeight
for iOS the loadOnDemand works better with your example but there is still unwanted jumping when the items are loaded and the user starts to scroll. This is caused by these code lines
which are n conflict with the logic implemented by the LoadOnDemnad itself. Simply removing them will make your LoadOnDemand to work as expected with no side effects.
To resume all of the above in three simple steps:
- add this in your RadListView
- remove these lines
- rebuild your application and LoadOnDemand should work as expected.
Telerik by Progress