I'm building a chat application which is working fine but now I want to implement blue tick
feature to check either message has been seen or not
. I'm using socket.io
and react-native-gifted-chat
in this app. I am struggling to find a way to know how to do this. I visit many links but did not get the clear picture. react-native-gifted-chat describes to use renderTicks
function for this but I'm unable to understand its implementation.
renderTicks
renderTicks = (message) => {
const {currentMessage, renderTicks, user} = this.props;
if (renderTicks && currentMessage) {
return renderTicks(currentMessage);
}
if (currentMessage && user && currentMessage.user._id !== user._id) {
return null;
}
if (
currentMessage &&
(currentMessage.sent || currentMessage.received || currentMessage.pending)
) {
return (
<View style={styles.content.tickView}>
{!!currentMessage.sent && (
<Text style={[styles.content.tick, this.props.tickStyle]}>✓</Text>
)}
{!!currentMessage.received && (
<Text style={[styles.content.tick, this.props.tickStyle]}>✓</Text>
)}
{!!currentMessage.pending && (
<Text style={[styles.content.tick, this.props.tickStyle]}></Text>
)}
</View>
);
}
return null;
};
GiftedChat
<GiftedChat
..........
renderTicks={(message) => this.renderTicks(message)}
/>
Here currentMessage and renderTicks both are coming undefined.
What I'm doing wrong here, kindly enlighten.
OR
Can anybody help me out with example code of renderTicks.
react-native version = 0.62.2
Thanks in advance.