SfChat does not scroll to most recent message when it loads

If the SfChat control's Messages property is bound to an observable collection that contains a large number of messages, it does not scroll to the most recent (last) message when it is first displayed.

It does not scroll to the bottom if the CanAutoScrollToBottom property is set to True, or if it is set to False.

This scenario can be reproduced by creating a view model that creates a collection of twenty messages:

public class ChatViewModel
{
public ChatViewModel()
{
        for (var i = 0; i < 20; ++i)
        {
            Messages.Add(new TextMessage {
DateTime = new DateTime.Now.AddMonths(-1).AddDays(i),
Text = $"Message {i}" });
        }
   }

   public ObservableCollection<object> Messages {get;} = new();
}


And a content page with an SfChat control, that uses the view model:

<ContentPage.BindingContext>
<local:ChatViewModel/>
</ContentPage.BindingContext>


<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand">
         <Label>SyncFusion Xamarin chat message loading</Label>
         <sfChat:SfChat CanAutoScrollToBottom="True" Messages="{Binding Messages}"/>
 </StackLayout>

</ContentPage.Content>


The SfChat control displays the first, and oldest message, and remains scrolled to the top.


If newer messages are added to the observable collection later, the control will scroll to the newest message, as expected.

The demo was built using SyncFusion.Xamarin.SfChat 20.1.0.58, Xamarin.Forms 5.0.0.2291, and run in the iOS Simulator on an iPhone 8 Plus on iOS 15.4.

This may be the same issue as was reported in this post, however that post was specifically referring to image and video messages.  I believe this is occurring for all message types, as demonstrated by the code included in this post.


12 Replies

SV Suja Venkatesan Syncfusion Team June 5, 2022 06:55 PM UTC

Hi Anthony,


We are able to replicate the reported issue on our end. Currently, we are validating the reported issue, we will update you with further details on or before June 7, 2022. We appreciate your patience until then.


Regards,

Suja



AN Anthony June 7, 2022 01:42 PM UTC

Hello Suja.  I'm pleased to hear that you have been able to replicate the issue.  Thanks for the update, and I look forward to another on June 7th.



SV Suja Venkatesan Syncfusion Team June 7, 2022 04:45 PM UTC

Hi Anthony,


We have logged a bug report for the reported issue “SfChat does not scroll to recent message while loading”. We will fix the issue and include the fix in our weekly nuget which is scheduled on July 5,2022. We will let you know once it is released with the fix. We appreciate your patience until then.

You can also track the status of the report from the below link.  

Feedback Linkhttps://www.syncfusion.com/feedback/35475/sfchat-does-not-scroll-to-recent-message-while-loading


Regards,

Suja



AN Anthony June 8, 2022 01:18 AM UTC

Thank you very much Suja.  I will keep an eye on the report status, and look forward to the fix.  Thanks again.



SV Suja Venkatesan Syncfusion Team June 8, 2022 04:48 PM UTC

Hi Anthony,


As we promised ,We will fix the issue and include the fix in our weekly nuget which is scheduled on July 5,2022. We will let you know once it is released with the fix. Please let us now if you need any further assistance.


Regards,

Suja



SV Suja Venkatesan Syncfusion Team July 5, 2022 01:45 PM UTC

Hi Anthony,


We regret to inform you that we could not include the fix in our 2022 Volume 2 main release as promised. We faced the issues with different iOS devices, so we had difficulties finding a generic fix for the reported issue. We are working on this issue with high priority. Also, the fix will be available in our upcoming weekly nuget release, which is planned to roll out on July 12, 2022. We will let you know once the release is rolled out and appreciate your patience until then.


Regards,

Suja




AN Anthony July 12, 2022 09:05 AM UTC

Hello Suja, thank you for the update.  I'm looking forward to testing with the next weekly NuGet release, when it is available.



SV Suja Venkatesan Syncfusion Team July 12, 2022 01:51 PM UTC

Hi Anthony,


We'd like to let you know that we've included the fix in our weekly nuget 20.2.0.38,  which was delayed due to a technical issue. We will notify you once the necessary fix has been released in the nuget package.


Regards,

Suja



SV Suja Venkatesan Syncfusion Team July 13, 2022 03:06 PM UTC

Hi Anthony,


We have fixed the reported issue “SfChat does not scroll to recent message while loading” and included the issue fix in our latest Weekly NuGet release update version 20.2.0.38 which is available for download (https://www.nuget.org/).   

We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you require any further assistance.


Regards,

Suja




GC Gustavo Cantero July 14, 2022 03:29 PM UTC

Hello Suja.

I'm still have the problem, even with the version 20.2.0.38.



AN Anthony July 15, 2022 05:20 AM UTC

Thank you for letting me know about the fix, Suja.  I am very pleased to advise that when I tested with the SyncFusion.Xamarin.SfChat Nuget package version 20.2.0.38, the issue is resolved.  My thanks to you and the development team.

I'm not sure why it isn't working for you Gustavo, but I am using Xamarin.Forms 5.0.0.2478, in case that helps.

I also see that the SyncFusion Xamarin Forms release notes for version 20.2.0.38 currently read "No Changes for this product in this version.", which is interesting seeing as the fix was apparently included.  Perhaps it would be worth you trying removing the reference to the Nuget package, and adding it again, in case the package now includes a change which it didn't before.  Just a guess though.




SV Suja Venkatesan Syncfusion Team July 15, 2022 07:21 AM UTC

Hi Gustavo,


We have checked the scenario "SfChat does not scroll to recent message while loading" with the most recent weekly nuget version 20.2.0.38 and found that it works fine in our environment. Please ensure that you clear all bin and obj files in your projects after updating the nuget version to 20.2.0.38.  We have attached a sample which we used to check the reported scenario for you reference. Please have a look at this sample and let us know if missed any customization you have done in your application or revert us with SfChat related code snippets and illustration video or image. It will be more helpful for us to provide timely solutions.


Reference Output with nuget version 20.2.0.38:

A screenshot of a phone

Description automatically generated with medium confidence


@Anthony - We are glad to know that the reported problem has been resolved at your end. We have updated the release notes when publishing our NuGet package. But sometimes it takes time to update and get refreshed in live.


Regards,

Suja


Attachment: GettingStarted_4_1c9a1f69.zip

Loader.
Up arrow icon