React-native-gifted-chat: Not working the onSend() function in custom InputToolBar

Created on 8 Feb 2018  路  4Comments  路  Source: FaridSafi/react-native-gifted-chat

I've made the custom InputToolbar.
My code is:

onSend = (messages = []) => {
messages.forEach(m => this.props.dispatch(sendMessage(this.chatId, m.text)))
this.setState({text: ''})
}

text={this.state.text}
messages={data}
onSend={this.onSend}
renderInputToolbar={() => (
value={this.state.text}
ref={component => this.messageInput = component}
multiline={true}
onChangeText={this.onInputTextChanged.bind(this)}
placeholder="Type a message here..."
/>







)}
user={{
_id: this.props.currentUserUid,
}}
/>

But I can't send the message.
Could you please help me?

Most helpful comment

If you just want to customise the Send button you can use the renderSend prop instead of renderInputToolbar, for example like this:

import Ionicons from 'react-native-vector-icons/Ionicons';

  renderSend(props) {
    return (
      <Send {...props}>
        <View style={{ marginBottom: 5, marginRight: 10 }}>
          <Ionicons
            name="md-send"
            size={29}
          />
        </View>
      </Send>
    );
  }

{/* ... */}

<GiftedChat
  renderSend={this.renderSend}
...
/>

All 4 comments

If you just want to customise the Send button you can use the renderSend prop instead of renderInputToolbar, for example like this:

import Ionicons from 'react-native-vector-icons/Ionicons';

  renderSend(props) {
    return (
      <Send {...props}>
        <View style={{ marginBottom: 5, marginRight: 10 }}>
          <Ionicons
            name="md-send"
            size={29}
          />
        </View>
      </Send>
    );
  }

{/* ... */}

<GiftedChat
  renderSend={this.renderSend}
...
/>

OK, Thank you.

i want to achieve same thing as above and i actually want to change the design of text input too

@gianpaj is there a list of props somewhere like

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xcxooxl picture xcxooxl  路  3Comments

inceptivetech picture inceptivetech  路  3Comments

tafelito picture tafelito  路  3Comments

arayaryoma picture arayaryoma  路  3Comments

emilkarl picture emilkarl  路  3Comments