badoo / badoo/Chatto

set ChatInputBar.inputText, the text is moved up

Open
#275 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4.6k
Forks
588
PR merge metrics
No merged PRs in 30d

Description

I want to use return key to send message, but the text is moved up when setting inputText to anything text
```swift
extension DemoChatViewController: ChatInputBarDelegate {
func inputBarShouldBeginTextEditing(inputBar: ChattoAdditions.ChatInputBar) -> Bool {
return true
}

func inputBarDidBeginEditing(inputBar: ChattoAdditions.ChatInputBar) {

}

func inputBarDidEndEditing(inputBar: ChattoAdditions.ChatInputBar) {

}

func inputBarDidChangeText(inputBar: ChattoAdditions.ChatInputBar) {
if inputBar.inputText.containsString("\n") {
inputBar.inputText = "aaaa"
}
}

func inputBarSendButtonPressed(inputBar: ChattoAdditions.ChatInputBar) {

}

func inputBar(inputBar: ChattoAdditions.ChatInputBar, shouldFocusOnItem item: ChatInputItemProtocol) -> Bool {
return true
}

func inputBar(inputBar: ChattoAdditions.ChatInputBar, didReceiveFocusOnItem item: ChatInputItemProtocol) {

}
}
```
**before**

![image](https://cloud.githubusercontent.com/assets/4025839/21427454/b553ddd8-c88f-11e6-8604-9d58dfae8748.png)

**after**

![image](https://cloud.githubusercontent.com/assets/4025839/21427432/956f9fac-c88f-11e6-9df8-c9bdff46b5d4.png)

Contributor guide

Open the contributing guide

Research direction

Start with the ChatInputBarDelegate inputBarDidChangeText example and reproduce the issue by assigning inputBar.inputText after a return key is entered. Trace how ChatInputBar updates its text layout and verify that assigning inputText no longer moves the text upward while preserving the shown return-key behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.