Is it possible to replace the default messages
component and view from the navigation drawer?
This is pretty straightforward. What you need to do is explicitly specify a messages
item in the <general-section>
of the navigation drawer and specify the type
attribute as 'messages'.
Please note you will also have to specify the indicator
attribute.
Docs here, example below,
NAV XML
<?xml version="1.0"?>
<navigation >
<section>
<item label="Main" icon="fa-home" view="main" icon-color="primary"/>
</section>
<general-section>
<item type="messages" label="Custom Messages" on-press="$:navigate.link('custom_messages')" indicator="$:customIndicator()" icon="fa-envelope" />
</general-section>
</navigation>
NAV JS
function customIndicator() {
var unreadCount = DB.message.where("read != ? and recipient = ?", true, user).count();
return {value: unreadCount , color:"#ff8c00"};
}
1 Like