Messagekit: Add button inside InputTextView?

Created on 4 Sep 2020  路  7Comments  路  Source: MessageKit/MessageKit

Let's say I want to achive this input layout:

image

I can add 2 buttons in left InputStackView. But what about that "emoji" button next to InputTextView? The problem is middleContentView must have rounded corner and gray background, so emoji and send button cannot be both in right stackView.

question stale waiting for response

All 7 comments

Hey @kientux did you try to add the emoji button into the input textview as a subview? And you could use UITextView.textContainerInset to add some space for the button

Thanks @martinpucik, I tried to add it into input textview but there're some issues:

  • I update frame of emoji button inside delegate call inputBar(_:didChangeIntrinsicContentTo:), but it seems that it has some delay until the frame of inputTextView is updated.
  • Also if I add emoji button into textView, when text content is long enough, the textView will be scrollable and emoji button get scrolled too (it supposed to be in a fixed position).

I think about using messageInputBar.setMiddleContentView(_:animated:) to set my own instance of InputTextView, but maybe it will heavily affect the messageInputBar behavior, and I have to implement many custom logic myself.

@kientux you could add the button to the inputTextView.superView which is the private middleContentWrapperView

This issue has been marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This issue has been auto-closed because there hasn't been any activity for at least 21 days. However, we really appreciate your contribution, so thank you for that! 馃檹 Also, feel free to open a new issue if you still experience this problem 馃憤.

work as expected thanks

Checkout the Facebook input bar example I had made. This can be achieved without using the private wrapper view.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yspreen picture yspreen  路  3Comments

robertoferraz picture robertoferraz  路  3Comments

asn111 picture asn111  路  3Comments

JulienLevallois picture JulienLevallois  路  4Comments

pawankmrai picture pawankmrai  路  3Comments