You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to replace the input view on the message list(chat)?
Customer request
Can they trigger a modal input to display over the chat? (such as on a click within the message)
They could render a message in line with a custom_type message, but in this case, they want to pop out a modal.
Guide & Snippet
The logic below is a custom snippet with a simple example.
Create CustomGroupChannelInputComponent
classCustomGroupChannelInputComponent:SBUGroupChannelModule.Input{public lazy varcustomInputView=UIView()overridefunc setupViews(){
super.setupViews()// [Example]// You can implement the two functions below inside your logic and use them as needed.// - Expose the custom input view first for test.self.showCustomInputView()// - Change to original inputView after 3 seconds for test.Timer.scheduledTimer(withTimeInterval: 3.0, repeats: false){ timer inself.resetInputView()}}overridefunc setupLayouts(){
super.setupLayouts()// Sets the `customInputView` layoutself.customInputView
.sbu_constraint(height:150)}overridefunc setupStyles(theme:SBUChannelTheme?=nil){
super.setupStyles(theme: theme)// Sets the `customInputView` styleself.customInputView.backgroundColor =.red
}func showCustomInputView(){// Remove the original input view and add the custom input view.
if let messageInputView =self.messageInputView {self.inputVStackView.removeArrangedSubview(messageInputView)}self.inputVStackView.addArrangedSubview(self.customInputView)}func resetInputView(){// Remove the custom input view and add the original input view.self.inputVStackView.arrangedSubviews.forEach{self.inputVStackView.removeArrangedSubview($0)}
if let messageInputView =self.messageInputView {self.inputVStackView.addArrangedSubview(messageInputView)}}}
Before using the two custom classes, please set them in SBUModuleSet and SBUViewControllerSet.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
Customer request
Guide & Snippet
The logic below is a custom snippet with a simple example.
Create CustomGroupChannelInputComponent
SBUModuleSet
andSBUViewControllerSet
.Result
Reference
Beta Was this translation helpful? Give feedback.
All reactions