UNPKG

@livelike/react-native

Version:

LiveLike React Native package

38 lines (37 loc) 837 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useChatRoom = useChatRoom; var _javascript = require("@livelike/javascript"); var _react = require("react"); var _useAnalytics = require("./useAnalytics"); function useChatRoom(_ref) { let { roomId } = _ref; const [chatRoom, setChatRoom] = (0, _react.useState)(null); const { trackEvent } = (0, _useAnalytics.useAnalytics)(); (0, _react.useEffect)(() => { (0, _javascript.getChatRoom)({ roomId }).then(_chatroom => { setChatRoom(_chatroom); trackEvent('Chat Room Entered', { roomId, room: _chatroom }); }); return () => { trackEvent('Chat Room Exited', { roomId }); }; }, []); return { chatRoom }; } //# sourceMappingURL=useChatRoom.js.map