stream-chat-react-native-core
Version:
The official React Native and Expo components for Stream Chat, a service for building chat applications
16 lines (11 loc) • 503 B
text/typescript
import type { AttachmentManagerState } from 'stream-chat';
import { useMessageComposer } from './useMessageComposer';
import { useStateStore } from '../../../hooks/useStateStore';
const stateSelector = (state: AttachmentManagerState) => ({
hasAttachments: state.attachments.length > 0,
});
export const useHasAttachments = () => {
const { attachmentManager } = useMessageComposer();
const { hasAttachments } = useStateStore(attachmentManager.state, stateSelector);
return hasAttachments;
};