Skip to main content

PSMessageNotification

PSMessageNotification là component dùng để hiển thị thông báo khi có tin nhắn mới đến nếu bạn đang sử dụng Chat Communi.

Cách sử dụng

import { PSChatProvider, PSMessageNotification } from "@communi/chat-react";

export const App = () => {
const fetchCommuniToken = async () => {
return "YOUR_TOKEN";
};

const handleNotificationClick = (messageData) => {
// Do something when click on notification
};

return (
<PSChatProvider appId="YOUR_APP_ID" fetchToken={fetchCommuniToken}>
<PSMessageNotification onNotificationClick={handleNotificationClick} />
</PSChatProvider>
);
};

Props

Thuộc tínhMô tảKiểu dữ liệuBắt buộcGiá trị mặc định
onNotificationClickHàm gọi lại khi người dùng click vào thông báo(data: MessageData) => voidKhông() => {}
positionVị trí hiển thị của thông báobottom-left | bottom-center | bottom-rigt | top-left | top-center | top-rightKhôngbottom-left
disableRenderUINgăn chặn việc hiển thị thông báo mặc định nếu giá trị là truebooleanKhôngfalse
onNotifyHàm gọi lại khi nhận được một thông báo(data: MessageData) => voidKhông-