UNPKG

stream-chat-react-native-core

Version:

The official React Native and Expo components for Stream Chat, a service for building chat applications

14 lines (10 loc) 507 B
import { CooldownTimerState } from 'stream-chat'; import { useChannelContext } from '../../../contexts/channelContext/ChannelContext'; import { useStateStore } from '../../../hooks/useStateStore'; const cooldownTimerStateSelector = (state: CooldownTimerState) => ({ isCooldownActive: !!state.cooldownRemaining, }); export const useIsCooldownActive = () => { const { channel } = useChannelContext(); return useStateStore(channel.cooldownTimer.state, cooldownTimerStateSelector).isCooldownActive; };