Skip to content

Commit ee9e690

Browse files
committed
chore: migrate the Expo sample app away from SCG
1 parent 5b569c1 commit ee9e690

File tree

7 files changed

+63
-65
lines changed

7 files changed

+63
-65
lines changed

examples/ExpoMessaging/app/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ import { ChannelList } from 'stream-chat-expo';
33
import { useContext, useMemo } from 'react';
44
import { Stack, useRouter } from 'expo-router';
55
import { ChannelSort } from 'stream-chat';
6-
import { StreamChatGenerics } from '../types';
76
import { AppContext } from '../context/AppContext';
87
import { user } from '../constants';
98

109
const filters = {
1110
members: { $in: [user.id] },
1211
type: 'messaging',
1312
};
14-
const sort: ChannelSort<StreamChatGenerics> = { last_updated: -1 };
13+
const sort: ChannelSort = { last_updated: -1 };
1514
const options = {
1615
state: true,
1716
watch: true,

examples/ExpoMessaging/components/ChatWrapper.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { PropsWithChildren } from 'react';
1+
import React, { PropsWithChildren, useRef } from 'react';
22
import {
33
Chat,
44
OverlayProvider,
@@ -7,7 +7,6 @@ import {
77
useCreateChatClient,
88
} from 'stream-chat-expo';
99
import { AuthProgressLoader } from './AuthProgressLoader';
10-
import { StreamChatGenerics } from '../types';
1110
import { STREAM_API_KEY, user, userToken } from '../constants';
1211
import { useSafeAreaInsets } from 'react-native-safe-area-context';
1312
import { useStreamChatTheme } from '../useStreamChatTheme';
@@ -34,7 +33,7 @@ export const ChatWrapper = ({ children }: PropsWithChildren<{}>) => {
3433
}
3534

3635
return (
37-
<OverlayProvider<StreamChatGenerics>
36+
<OverlayProvider
3837
bottomInset={bottom}
3938
i18nInstance={streami18n}
4039
value={{ style: theme }}

examples/ExpoMessaging/context/AppContext.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { PropsWithChildren, createContext, useContext, useState } from 'react';
2-
import { StreamChatGenerics } from '../types';
1+
import { PropsWithChildren, createContext, useState } from 'react';
32
import { Channel as ChannelType } from 'stream-chat';
43
import { ThreadContextValue } from 'stream-chat-expo';
54

65
export type AppContextType = {
7-
channel: ChannelType<StreamChatGenerics> | undefined;
8-
setChannel: React.Dispatch<React.SetStateAction<ChannelType<StreamChatGenerics> | undefined>>;
6+
channel: ChannelType | undefined;
7+
setChannel: React.Dispatch<React.SetStateAction<ChannelType | undefined>>;
98
setThread: React.Dispatch<
10-
React.SetStateAction<ThreadContextValue<StreamChatGenerics>['thread'] | undefined>
9+
React.SetStateAction<ThreadContextValue['thread'] | undefined>
1110
>;
12-
thread: ThreadContextValue<StreamChatGenerics>['thread'] | undefined;
11+
thread: ThreadContextValue['thread'] | undefined;
1312
};
1413

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

2221
export const AppProvider = ({ children }: PropsWithChildren) => {
23-
const [channel, setChannel] = useState<ChannelType<StreamChatGenerics> | undefined>(undefined);
22+
const [channel, setChannel] = useState<ChannelType | undefined>(undefined);
2423
const [thread, setThread] = useState<
25-
ThreadContextValue<StreamChatGenerics>['thread'] | undefined
24+
ThreadContextValue['thread'] | undefined
2625
>(undefined);
2726

2827
return (
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import {
2+
DefaultAttachmentType,
3+
DefaultMessageType,
4+
DefaultChannelType,
5+
DefaultCommandType,
6+
DefaultEventType,
7+
DefaultMemberType,
8+
DefaultPollOptionType,
9+
DefaultPollType,
10+
DefaultReactionType,
11+
DefaultThreadType,
12+
DefaultUserType,
13+
} from 'stream-chat-expo';
14+
15+
declare module 'stream-chat' {
16+
/* eslint-disable @typescript-eslint/no-empty-object-type */
17+
18+
interface CustomAttachmentData extends DefaultAttachmentType {}
19+
20+
interface CustomChannelData extends DefaultChannelType {}
21+
22+
interface CustomCommandData extends DefaultCommandType {}
23+
24+
interface CustomEventData extends DefaultEventType {}
25+
26+
interface CustomMemberData extends DefaultMemberType {}
27+
28+
interface CustomUserData extends DefaultUserType {}
29+
30+
interface CustomMessageData extends DefaultMessageType {}
31+
32+
interface CustomPollOptionData extends DefaultPollOptionType {}
33+
34+
interface CustomPollData extends DefaultPollType {}
35+
36+
interface CustomReactionData extends DefaultReactionType {}
37+
38+
interface CustomThreadData extends DefaultThreadType {}
39+
40+
/* eslint-enable @typescript-eslint/no-empty-object-type */
41+
}

examples/ExpoMessaging/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
"react-native-screens": "~4.8.0",
3838
"react-native-svg": "15.11.1",
3939
"react-native-web": "~0.19.13",
40-
"stream-chat-expo": "link:../../package/expo-package",
41-
"stream-chat-react-native-core": "link:../../package",
40+
"stream-chat-expo": "6.6.7-beta.1",
4241
"typescript": "~5.7.3"
4342
},
4443
"devDependencies": {

examples/ExpoMessaging/types.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

examples/ExpoMessaging/yarn.lock

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7354,14 +7354,17 @@ [email protected], stream-buffers@~2.2.0:
73547354
resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4"
73557355
integrity sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg==
73567356

7357-
"stream-chat-expo@link:../../package/expo-package":
7358-
version "0.0.0"
7359-
uid ""
7357+
7358+
version "6.6.7-beta.1"
7359+
resolved "https://registry.yarnpkg.com/stream-chat-expo/-/stream-chat-expo-6.6.7-beta.1.tgz#8e7544ed5a6fc3ed7ff807bc4e9ee2eb8b5132e2"
7360+
integrity sha512-FML930XZYJbmgVn3o7Qm9xwpKy8bqDzIpgM+K7+qDOJ+RWEuAqZBzQNCqt1Jfuil6UItX8exZSTaQk3rtBwGRg==
7361+
dependencies:
7362+
stream-chat-react-native-core "6.6.7-beta.1"
73607363

7361-
7362-
version "6.6.6"
7363-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.6.6.tgz#d701beb9652f0a5851286f752d8c4fdadb3e0603"
7364-
integrity sha512-sfBtWz4K4OzhFDMRaPF2xMj7aP9FQU4dMN1XCsmRT07hyYn6iEviECxNttYvoRLB1zNdeja5cL63IDY3UZSpAQ==
7364+
7365+
version "6.6.7-beta.1"
7366+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.6.7-beta.1.tgz#3068bbe0a31b1d686dba9d93f3c3d00b940df645"
7367+
integrity sha512-1+iVc7vwqqiwOzKnO60rM3fjHb7JEY9ckwB2RIyCGTegEvkXEoxmLR+MtX2rC+8O2p0AGi5Q0pne8nMQoh4LaA==
73657368
dependencies:
73667369
"@gorhom/bottom-sheet" "^5.1.1"
73677370
dayjs "1.10.5"
@@ -7374,28 +7377,9 @@ [email protected]:
73747377
path "0.12.7"
73757378
react-native-markdown-package "1.8.2"
73767379
react-native-url-polyfill "^1.3.0"
7377-
stream-chat "^8.57.5"
7380+
stream-chat "^8.57.6"
73787381
use-sync-external-store "^1.4.0"
73797382

7380-
"stream-chat-react-native-core@link:../../package":
7381-
version "0.0.0"
7382-
uid ""
7383-
7384-
stream-chat@^8.57.5:
7385-
version "8.57.5"
7386-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.57.5.tgz#1b49b7504371e19a539465e2ae5dc86aa3269637"
7387-
integrity sha512-ndcbH/zGzUIAhZLGn1owVV8MeNvVfWITIlhAhfmnsV7RLoo/eiGFEuP4aNoG1YRos/g9xJQ7TEmKpz8xYqo13w==
7388-
dependencies:
7389-
"@babel/runtime" "^7.16.3"
7390-
"@types/jsonwebtoken" "~9.0.0"
7391-
"@types/ws" "^7.4.0"
7392-
axios "^1.6.0"
7393-
base64-js "^1.5.1"
7394-
form-data "^4.0.0"
7395-
isomorphic-ws "^4.0.1"
7396-
jsonwebtoken "~9.0.0"
7397-
ws "^7.5.10"
7398-
73997383
stream-chat@^8.57.6:
74007384
version "8.57.6"
74017385
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.57.6.tgz#dd3a4a0a024ee44bfa6ae7ca15648e6c9f2e498f"

0 commit comments

Comments
 (0)