softchatjs-react-native
Version:
React native UI SDK for softchatjs-core. Create a free account at: https://www.softchatjs.com
40 lines (36 loc) • 1.56 kB
text/typescript
import React from 'react';
import { SetState } from '../types.mjs';
import { Audio, AVPlaybackStatus } from 'expo-av';
import { Emoticon, Message, Media, UserMeta, ConversationListItem } from 'softchatjs-core';
import 'react-native';
declare const initialMessageStateContext: MessageStateContext;
type MessageStateContext = {
globalTextMessage: string;
setGlobalTextMessage: SetState<string>;
stickers: Emoticon[];
setStickers: SetState<Emoticon[]>;
pendingMessages: Array<Partial<Message>>;
addNewPendingMessages: (message: Partial<Message>) => void;
removePendingMessage: (messageId: string) => void;
updatePendingMessage: (messageId: string, message: Message) => void;
playVoiceMessage: (media: Media) => void;
pauseVoiceMessage: () => void;
resumeVoiceMessage: () => void;
audioState: "playing" | "paused" | "loading" | null;
unload: () => void;
sound: Audio.Sound | null;
activeVoiceMessage: Media | null;
avPlayBackStatus: AVPlaybackStatus & {
positionMillis: number;
} | null;
userMeta: UserMeta;
setUserMeta: SetState<UserMeta>;
conversationList: Array<ConversationListItem>;
setConversationList: SetState<Array<ConversationListItem>>;
};
declare const MessageStateContext: React.Context<MessageStateContext>;
declare const useMessageState: () => MessageStateContext;
declare const MessageStateProvider: ({ children }: {
children: JSX.Element;
}) => React.JSX.Element;
export { MessageStateProvider, initialMessageStateContext as default, useMessageState };