Handling (or disabling) Memoji in InputBarAccessoryView TextField

604 views Asked by At

I'm building a chat app using MessageKit, Firebase and InputBarAccessoryView pods.

I've found out that when I input a Memoji (so, a sticker) in the textfield of the InputBar and press the "send" button, in the database the Memoji will be saved as "\n", which of course will be rendered as a blank bubble in the receiving user screen. The issue is exclusive to Memoji, regular emojis works fine.

Before sending a message, I check if the user is trying to send an empty string, and if so then the message is not sent at all to the database, but I don't know how to check if a Memoji is being input.

Plus, in the textbar the Memoji is rendered awfully, see pic here, so the best solution would be cutting the problem at its roots and removing the option to input Memoji in the textfield or directly removing them from the keyboard.

I'm searching for a way to to remove Memoji from users keyboard, or to handle at best these issues, but I've found nothing by searching on Google.

1

There are 1 answers

0
oneshot On BEST ANSWER

Memojis work this way: when selected from the keyboard, they are pasted into the TextView. So i just found a decent solution directly from the InputBar API:

messageInputBar.inputTextView.isImagePasteEnabled = false

This removes the possibility to paste images in the TextView, and alongside Memojis are removed from the keyboard.