@talkjs/react-native
Version:
Official TalkJS SDK for React Native
47 lines • 1.81 kB
TypeScript
import type Talk from 'talkjs';
import { type User } from './User';
import React, { type RefObject } from 'react';
import type { WebView as RNWebView } from 'react-native-webview';
import { CustomHandlers, TalkHandlers } from './Handlers';
interface _Session {
appId: string;
me: User;
token?: string;
tokenFetcher?: () => Promise<string>;
/** @deprecated since version 0.10.0 */
signature?: string;
}
interface _SessionProp extends _Session {
enablePushNotifications?: boolean;
onMessage?: (message: Talk.Message) => void;
onUnreadsChange?: (unreadConversations: Talk.UnreadConversation[]) => void;
}
interface Context {
session: _Session;
talkHandlers: TalkHandlers;
customHandlers: CustomHandlers;
injectJavaScript: InjectJavaScript;
setDisableZoom: React.Dispatch<React.SetStateAction<boolean>>;
setKeyboardVerticalOffset: React.Dispatch<React.SetStateAction<number>>;
setHideKeyboardAccessoryView: React.Dispatch<React.SetStateAction<boolean>>;
}
export type InjectJavaScript = (javascript: string) => void;
export type WebViewRef = RefObject<RNWebView>;
export interface SessionRef {
hasValidCredentials: () => Promise<boolean>;
clearPushRegistrations: () => void;
setPushRegistration: (token: {
provider: 'fcm' | 'apns';
pushRegistrationId: string;
}) => void;
unsetPushRegistration: (token: {
provider: 'fcm' | 'apns';
pushRegistrationId: string;
}) => void;
}
declare const SessionContext: React.Context<Context | null>;
declare const forwardedSession: React.ForwardRefExoticComponent<_SessionProp & {
children?: React.ReactNode | undefined;
} & React.RefAttributes<SessionRef>>;
export { forwardedSession as Session, SessionContext };
//# sourceMappingURL=Session.d.ts.map