question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS] Text Input Out of Position

See original GitHub issue

Issue Description

On iOS when the keyboard is visible, the text input is shifted up. It goes up halfway where there are no messages and to the top when there are messages.

(Android works fine.)

On in initial render. Looks good.

chat_issue_0

Typing the first message. There’s a gap between the keyboard and the text input.

chat_issue_1

After send of first message. The gap remains until the keyboard is dismissed.

chat_issue_2

Typing second message. The gap is enlarged such that the text input is at the top.

chat_issue_3

Steps to Reproduce / Code Snippets

My code. As you can see, it’s dead simple.

class Discuss extends Component {
  state = {
    messages: [],
  };
  onSend(messages = []) {
    this.setState(state => ({
      messages: GiftedChat.append(state.messages, messages),
    }));
    setTimeout(() => {
      const response = getFakeResonse();
      this.setState(state => ({
        messages: GiftedChat.append(state.messages, response),
      }));
    }, 3000);
  }
  render() {
    return (
      <GiftedChat
        messages={this.state.messages}
        onSend={(messages) => this.onSend(messages)}
        user={{
          _id: 1,
        }}
      />
    );
  }
}

Expected Results

The text input should remain just above the keyboard.

Additional Information

  • React Native version: 0.48.4
  • react-native-gifted-chat version: 0.2.7
  • Platform(s) (iOS, Android, or both?): iOS only

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
leonel-lordfordcommented, Nov 1, 2017

I’m having similar issue but in my case TextInput remains behind keyboard, I’m testing using Expo and my environment is react-native 0.48.4 and react-native-gifted-chat 0.2.9… see attachments… chat01 chat02

0reactions
phil-flyclopscommented, Feb 6, 2019

Nice solution can be found on this ticket - https://github.com/FaridSafi/react-native-gifted-chat/issues/874

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cursor moves outside text field - … | Apple Developer Forums
Cursor moves outside text field - iOS Safari​​ The cursor doesn't stay in the text field when you scroll up and down if...
Read more >
Text in TextInput not in correct position on ios - Stack Overflow
I have a textInput in a View which is positioned at the center using flex . the problem is, when you start writing...
Read more >
[iOS] Text input begins at the end of the ... - Unity Issue Tracker
[iOS] Text input begins at the end of the text when the caret position is in the middle of the text · 1....
Read more >
KeyboardAvoidingView - React Native
KeyboardAvoidingView. This component will automatically adjust its height, position, or bottom padding based on the keyboard height to ...
Read more >
ion-input: Custom Input Value Type Styling and CSS Properties
ion-input is a wrapper to the HTML input element, with custom value type styling and functionality. It works on desktops and integrates with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found