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.

Keyboard always dismiss when Send message on iOS

See original GitHub issue

Issue Description

Keyboard always dismiss when click Send on iOS when using Example Code

Steps to Reproduce / Code Snippets

import React from 'react'
import { GiftedChat } from 'react-native-gifted-chat'

class Example extends React.Component {
  state = {
    messages: [],
  }

  componentWillMount() {
    this.setState({
      messages: [
        {
          _id: 1,
          text: 'Hello developer',
          createdAt: new Date(),
          user: {
            _id: 2,
            name: 'React Native',
            avatar: 'https://placeimg.com/140/140/any',
          },
        },
      ],
    })
  }

  onSend(messages = []) {
    this.setState(previousState => ({
      messages: GiftedChat.append(previousState.messages, messages),
    }))
  }

  render() {
    return (
      <GiftedChat
        messages={this.state.messages}
        onSend={messages => this.onSend(messages)}
        user={{
          _id: 1,
        }}
      />
    )
  }
}

Expected Results

Keyboard shouldn’t dismiss.

Additional Information

  • Nodejs version: 10.4.1
  • React version: 16.8.3
  • React Native version: 0.59.9
  • react-native-gifted-chat version: 0.9.11
  • Platform(s) (iOS, Android, or both?): iOS
  • TypeScript version: none

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
mihikap2commented, Jul 15, 2019

I have the same issue

1reaction
evan-klemen-cleocommented, May 24, 2021

use prop isKeyboardInternallyHandled to false

Thanks for the suggestion. Seems when I set it to false my InputToolbar does not float above the keyboard and becomes obstructed. I tried wrapping in a <KeyboardAvoidingView>and it’s positioned above the keyboard but the keyboard still dismisses on send 😕

edit: I also tried adding blutOnSubmit like so, but no luck there either.

textInputProps={{
  blurOnSubmit: false,
}}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Keyboard automatically got dismissed when clicked the Send ...
On iOS, when clicking on the "Send" button, the keyboard automatically dismissed and one would have to click on the "Send" button again...
Read more >
How to dismiss iOS keyboard programatically (Swift 5)
This is the quickest way to implement keyboard dismissal. Just set a Tap gesture on the main View and hook that gesture with...
Read more >
Close iOS Keyboard by touching anywhere using Swift
in the keyboard section - select the dismiss mode you want. Share.
Read more >
How can I hide the onscreen keyboard in the iOS messaging ...
The one next to "return" will hide the keyboard. Then simply turn your phone back up and the keyboard stays hidden until you...
Read more >
SwiftUI Dismissing The Keyboard - Use Your Loaf
Control how scrollable content like lists and forms dismiss the keyboard.
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