Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/ExpoMessaging/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import { ChannelList } from 'stream-chat-expo';
import { useContext, useMemo } from 'react';
import { Stack, useRouter } from 'expo-router';
import { ChannelSort } from 'stream-chat';
import { StreamChatGenerics } from '../types';
import { AppContext } from '../context/AppContext';
import { user } from '../constants';

const filters = {
members: { $in: [user.id] },
type: 'messaging',
};
const sort: ChannelSort<StreamChatGenerics> = { last_updated: -1 };
const sort: ChannelSort = { last_updated: -1 };
const options = {
state: true,
watch: true,
Expand Down
5 changes: 2 additions & 3 deletions examples/ExpoMessaging/components/ChatWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropsWithChildren } from 'react';
import React, { PropsWithChildren, useRef } from 'react';
import {
Chat,
OverlayProvider,
Expand All @@ -7,7 +7,6 @@ import {
useCreateChatClient,
} from 'stream-chat-expo';
import { AuthProgressLoader } from './AuthProgressLoader';
import { StreamChatGenerics } from '../types';
import { STREAM_API_KEY, user, userToken } from '../constants';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useStreamChatTheme } from '../useStreamChatTheme';
Expand All @@ -34,7 +33,7 @@ export const ChatWrapper = ({ children }: PropsWithChildren<{}>) => {
}

return (
<OverlayProvider<StreamChatGenerics>
<OverlayProvider
bottomInset={bottom}
i18nInstance={streami18n}
value={{ style: theme }}
Expand Down
15 changes: 7 additions & 8 deletions examples/ExpoMessaging/context/AppContext.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { PropsWithChildren, createContext, useContext, useState } from 'react';
import { StreamChatGenerics } from '../types';
import { PropsWithChildren, createContext, useState } from 'react';
import { Channel as ChannelType } from 'stream-chat';
import { ThreadContextValue } from 'stream-chat-expo';

export type AppContextType = {
channel: ChannelType<StreamChatGenerics> | undefined;
setChannel: React.Dispatch<React.SetStateAction<ChannelType<StreamChatGenerics> | undefined>>;
channel: ChannelType | undefined;
setChannel: React.Dispatch<React.SetStateAction<ChannelType | undefined>>;
setThread: React.Dispatch<
React.SetStateAction<ThreadContextValue<StreamChatGenerics>['thread'] | undefined>
React.SetStateAction<ThreadContextValue['thread'] | undefined>
>;
thread: ThreadContextValue<StreamChatGenerics>['thread'] | undefined;
thread: ThreadContextValue['thread'] | undefined;
};

export const AppContext = createContext<AppContextType>({
Expand All @@ -20,9 +19,9 @@ export const AppContext = createContext<AppContextType>({
});

export const AppProvider = ({ children }: PropsWithChildren) => {
const [channel, setChannel] = useState<ChannelType<StreamChatGenerics> | undefined>(undefined);
const [channel, setChannel] = useState<ChannelType | undefined>(undefined);
const [thread, setThread] = useState<
ThreadContextValue<StreamChatGenerics>['thread'] | undefined
ThreadContextValue['thread'] | undefined
>(undefined);

return (
Expand Down
41 changes: 41 additions & 0 deletions examples/ExpoMessaging/custom-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {
DefaultAttachmentType,
DefaultMessageType,
DefaultChannelType,
DefaultCommandType,
DefaultEventType,
DefaultMemberType,
DefaultPollOptionType,
DefaultPollType,
DefaultReactionType,
DefaultThreadType,
DefaultUserType,
} from 'stream-chat-expo';

declare module 'stream-chat' {
/* eslint-disable @typescript-eslint/no-empty-object-type */

interface CustomAttachmentData extends DefaultAttachmentType {}

interface CustomChannelData extends DefaultChannelType {}

interface CustomCommandData extends DefaultCommandType {}

interface CustomEventData extends DefaultEventType {}

interface CustomMemberData extends DefaultMemberType {}

interface CustomUserData extends DefaultUserType {}

interface CustomMessageData extends DefaultMessageType {}

interface CustomPollOptionData extends DefaultPollOptionType {}

interface CustomPollData extends DefaultPollType {}

interface CustomReactionData extends DefaultReactionType {}

interface CustomThreadData extends DefaultThreadType {}

/* eslint-enable @typescript-eslint/no-empty-object-type */
}
3 changes: 3 additions & 0 deletions examples/ExpoMessaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@
"@rnx-kit/metro-config": "^2.0.1",
"@rnx-kit/metro-resolver-symlinks": "^0.2.1"
},
"resolutions": {
"@types/react": "^19.0.0"
},
"private": true
}
23 changes: 0 additions & 23 deletions examples/ExpoMessaging/types.ts

This file was deleted.

Loading