0

i'm trying to send the message via using react native gifted chat prop but some how it is not showing the serialize by day im am able to use renderDay prop but it is not enough

this is my code

<GiftedChat
          messages={_.orderBy(messages, ['createdAt'], ['desc'])}
          onSend={(mes) => onSend(mes)}
          scrollToBottom={true}
          isTyping={typingStatus}
          renderFooter={() => (typingStatus == true ? <Typing /> : null)}
          renderSend={(props) => (
            <View
              style={{
                flexDirection: 'row',
                alignItems: 'center',
                height: 40,
              }}>
              <Icon
                raised
                name="attachment"
                color="#08CAF9"
                onPress={async () => await setAchieveSend(true)}
                reverse={AchieveSend == false ? false : true}
              />
              <Send {...props}>
                <View style={Styles.btnSend}>
                  <Icon raised name="send" size={24} color="#08CAF9" />
                </View>
              </Send>
            </View>
          )}
          user={{
            _id: ApiUserId,
            name: '',
            avatar: '',
          }}
        />

and this is the image

enter image description here

2 Answers2

1

Sorry for being late, the problem is GiftedChat append the messages in invert mode, what you can do is set the inverted={false}

<GiftedChat messages={messages} inverted={false} />

This might help you....

Anwer Solangi
  • 148
  • 3
  • 9
0

Please try to append this way.


GiftedChat.append(prevState, newMessage)

As GiftedChat does some internal append. With setting message as

 setMessages(prevState => GiftedChat.append(prevState, newMessage));