Hello,
I am using version 18.2.0.45 to try and add a chat feature to my app. Everything is working as expected except on iOS the send button (with icon, not keyboard button) does not trigger the send message event. The send button on the keyboard works correctly. On Android, both the keyboard and the send button work. I am able to click it, just nothing triggers. I have tried both the Event Handler and Command approach. Here is what my code looks like:
XAML:
<ContentPage.Content>
<sfChat:SfChat AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All"
x:Name="chat"
Messages="{Binding Messages}"
CurrentUser="{Binding CurrentUser}"
ShowOutgoingMessageAvatar="False"
TypingIndicator="{Binding TypingIndicator}"
ShowTypingIndicator="{Binding ShowTypingIndicator}"
CanAutoScrollToBottom="True"
ShowIncomingMessageAvatar="True"
AllowMultilineInput="False"
MessageShape="RoundedRectangle"
BackgroundColor="{DynamicResource PageBackgroundColor}"/>
</ContentPage.Content>
CODEBEHIND:
public ChatPage(Team team)
{
InitializeComponent();
On<iOS>().SetUseSafeArea(true);
chatService = new ChatService();
this.BindingContext = viewModel = new ChatViewModel();
this.chat.SendMessage += this.Chat_SendMessage;
this.chat.Editor.TextChanged += Editor_TextChanged;
this.chat.Editor.Unfocused += Editor_Unfocused;
}
private async void Chat_SendMessage(object sender, SendMessageEventArgs e)
{
TextMessage chatMessage = (TextMessage)e.Message;
if (chatMessage.Author == viewModel.CurrentUser)
{
await chatService.SendMessage(viewModel.CurrentUser.Name, chatMessage.Text, true, viewModel.CurrentUser.Avatar.ToString(), team.ChatGroupId);
}
e.Handled = true;
}
Is there something I am missing, or a workaround for me to manually bind the command to the button on iOS?
Thank you.