How to display no messages found if messages object is empty.
See original GitHub issueI was trying to render a view to display ‘No messages found’ if the messages object is empty. for this which function i need to use. Currently I tried using renderMessage but got error. i just want to figure it out how this can be achieved
My code is
<GiftedChat
composerHeight={COMPOSER_HEIGHT}
minInputToolbarHeight={COMPOSER_HEIGHT}
messages={this.state.messages}
onSend={messages => this.onSend(messages)}
user={{ _id: this.state.senderUserName }}
loadEarlier={this.state.loadEarlier}
isLoadingEarlier={this.state.isLoadingEarlier}
onLoadEarlier={this.onLoadEarlier}
placeholder="Type your message"
renderSend={this.renderSend}
alwaysShowSend={true}
renderActions={this.imageSend.bind(this)}
renderInputToolbar={this.renderInputToolbar}
renderBubble={this.renderBubble.bind(this)}
renderMessage={this.renderMessage.bind(this)}
renderMessageImage={this.renderMessageImage}
renderAvatar={null}
inverted={true}
/>
In render message my code is :
renderMessage(props) {
if(this.state.messages.length !==0){
return <Message {...props} />;
} else {
return <View style={{flex:1, backgroundColor:'red'}}>
<Text>Hello no data found</Text>
</View>
}
return null
}
I know i’m doing wrong. But i can’t be able to find correct result. any suggestions?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
How to display a message if the array of objects is empty ...
i want to display a message if the object contains data or not. Currently i store the data in state named "data" and...
Read more >Video: Input and error messages - Microsoft Support
On the Input Message tab, check the box next to Show input message when cell is selected. Type a Title if you want....
Read more >Throw error and display message - MATLAB error - MathWorks
This MATLAB function throws an error and displays an error message.
Read more >Discord Developer Portal — Documentation — Channel
You can tell if a message is generated by a webhook by checking for the webhook_id on the message object. ** An app...
Read more >Validation - Laravel - The PHP Framework For Web Artisans
Validating Nested Array Input; Error Message Indexes & Positions ... If no old input exists for the given field, null will be returned:....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
for every question i was asking here you are mentioning to check in stackoverflow. But after checking in stackoverflow only i have posted here this. and yes i do have posted the same in stackoverflow as well https://stackoverflow.com/q/54529508/10966893 . please provide proper solution that will do needful for me
@xcarpentier
But it’s not display a InputText if they used message.length == 0