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ính | Mô tả | Kiểu dữ liệu | Bắt buộc | Giá trị mặc định |
---|---|---|---|---|
onNotificationClick | Hàm gọi lại khi người dùng click vào thông báo | (data: MessageData) => void | Không | () => {} |
position | Vị trí hiển thị của thông báo | bottom-left | bottom-center | bottom-rigt | top-left | top-center | top-right | Không | bottom-left |
disableRenderUI | Ngăn chặn việc hiển thị thông báo mặc định nếu giá trị là true | boolean | Không | false |
onNotify | Hàm gọi lại khi nhận được một thông báo | (data: MessageData) => void | Không | - |