diff --git a/README.md b/README.md
index e94bf2d0d8..67323d9a49 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
[](https://www.npmjs.com/package/stream-chat-react-native)
[](https://github.com/GetStream/stream-chat-react-native/actions)
[](https://getstream.io/chat/docs/sdk/reactnative)
-
+
diff --git a/examples/ExpoMessaging/app.json b/examples/ExpoMessaging/app.json
index 4e9029e1df..e8dafe9cd7 100644
--- a/examples/ExpoMessaging/app.json
+++ b/examples/ExpoMessaging/app.json
@@ -48,6 +48,13 @@
{
"microphonePermission": "$(PRODUCT_NAME) would like to use your microphone for voice recording."
}
+ ],
+ [
+ "expo-video",
+ {
+ "supportsBackgroundPlayback": true,
+ "supportsPictureInPicture": true
+ }
]
]
}
diff --git a/examples/ExpoMessaging/app/index.tsx b/examples/ExpoMessaging/app/index.tsx
index 66f64105f7..9487a9d1f8 100644
--- a/examples/ExpoMessaging/app/index.tsx
+++ b/examples/ExpoMessaging/app/index.tsx
@@ -3,7 +3,6 @@ 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';
@@ -11,7 +10,7 @@ const filters = {
members: { $in: [user.id] },
type: 'messaging',
};
-const sort: ChannelSort = { last_updated: -1 };
+const sort: ChannelSort = { last_updated: -1 };
const options = {
state: true,
watch: true,
diff --git a/examples/ExpoMessaging/components/ChatWrapper.tsx b/examples/ExpoMessaging/components/ChatWrapper.tsx
index e803bbc48f..736acafbfa 100644
--- a/examples/ExpoMessaging/components/ChatWrapper.tsx
+++ b/examples/ExpoMessaging/components/ChatWrapper.tsx
@@ -1,4 +1,4 @@
-import React, { PropsWithChildren } from 'react';
+import React, { PropsWithChildren, useRef } from 'react';
import {
Chat,
OverlayProvider,
@@ -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';
@@ -34,7 +33,7 @@ export const ChatWrapper = ({ children }: PropsWithChildren<{}>) => {
}
return (
-
+ | undefined;
- setChannel: React.Dispatch | undefined>>;
+ channel: ChannelType | undefined;
+ setChannel: React.Dispatch>;
setThread: React.Dispatch<
- React.SetStateAction['thread'] | undefined>
+ React.SetStateAction
>;
- thread: ThreadContextValue['thread'] | undefined;
+ thread: ThreadContextValue['thread'] | undefined;
};
export const AppContext = createContext({
@@ -20,9 +19,9 @@ export const AppContext = createContext({
});
export const AppProvider = ({ children }: PropsWithChildren) => {
- const [channel, setChannel] = useState | undefined>(undefined);
+ const [channel, setChannel] = useState(undefined);
const [thread, setThread] = useState<
- ThreadContextValue['thread'] | undefined
+ ThreadContextValue['thread'] | undefined
>(undefined);
return (
diff --git a/examples/ExpoMessaging/custom-types.d.ts b/examples/ExpoMessaging/custom-types.d.ts
new file mode 100644
index 0000000000..dcd62b8eb0
--- /dev/null
+++ b/examples/ExpoMessaging/custom-types.d.ts
@@ -0,0 +1,41 @@
+import {
+ DefaultAttachmentData,
+ DefaultChannelData,
+ DefaultCommandData,
+ DefaultEventData,
+ DefaultMemberData,
+ DefaultMessageData,
+ DefaultPollData,
+ DefaultPollOptionData,
+ DefaultReactionData,
+ DefaultThreadData,
+ DefaultUserData,
+} from 'stream-chat-expo';
+
+declare module 'stream-chat' {
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
+
+ interface CustomAttachmentData extends DefaultAttachmentData {}
+
+ interface CustomChannelData extends DefaultChannelData {}
+
+ interface CustomCommandData extends DefaultCommandData {}
+
+ interface CustomEventData extends DefaultEventData {}
+
+ interface CustomMemberData extends DefaultMemberData {}
+
+ interface CustomUserData extends DefaultUserData {}
+
+ interface CustomMessageData extends DefaultMessageData {}
+
+ interface CustomPollOptionData extends DefaultPollOptionData {}
+
+ interface CustomPollData extends DefaultPollData {}
+
+ interface CustomReactionData extends DefaultReactionData {}
+
+ interface CustomThreadData extends DefaultThreadData {}
+
+ /* eslint-enable @typescript-eslint/no-empty-object-type */
+}
diff --git a/examples/ExpoMessaging/package.json b/examples/ExpoMessaging/package.json
index d60f1de309..ed87be9264 100644
--- a/examples/ExpoMessaging/package.json
+++ b/examples/ExpoMessaging/package.json
@@ -23,11 +23,11 @@
"expo-image-manipulator": "~13.0.6",
"expo-image-picker": "~16.0.6",
"expo-linking": "~7.0.5",
- "expo-media-library": "~17.0.6",
"expo-router": "~4.0.17",
"expo-sharing": "~13.0.1",
"expo-splash-screen": "~0.29.22",
"expo-status-bar": "~2.0.1",
+ "expo-video": "^2.0.5",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.77.1",
@@ -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
}
diff --git a/examples/ExpoMessaging/types.ts b/examples/ExpoMessaging/types.ts
deleted file mode 100644
index 6607eb8e63..0000000000
--- a/examples/ExpoMessaging/types.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-export type LocalAttachmentType = Record;
-export type LocalChannelType = Record;
-export type LocalCommandType = string;
-export type LocalEventType = Record;
-export type LocalMessageType = Record;
-export type LocalReactionType = Record;
-export type LocalUserType = Record;
-export type LocalPollOptionType = Record;
-export type LocalPollType = Record;
-export type LocalMemberType = Record;
-
-export type StreamChatGenerics = {
- attachmentType: LocalAttachmentType;
- channelType: LocalChannelType;
- commandType: LocalCommandType;
- eventType: LocalEventType;
- memberType: LocalMemberType;
- messageType: LocalMessageType;
- pollOptionType: LocalPollOptionType;
- pollType: LocalPollType;
- reactionType: LocalReactionType;
- userType: LocalUserType;
-};
diff --git a/examples/ExpoMessaging/yarn.lock b/examples/ExpoMessaging/yarn.lock
index 18c12bc492..48d77730ca 100644
--- a/examples/ExpoMessaging/yarn.lock
+++ b/examples/ExpoMessaging/yarn.lock
@@ -1507,17 +1507,24 @@
dependencies:
regenerator-runtime "^0.13.11"
-"@babel/runtime@^7.16.3", "@babel/runtime@^7.18.6", "@babel/runtime@^7.20.0":
+"@babel/runtime@^7.17.2":
+ version "7.24.7"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.7.tgz#f4f0d5530e8dbdf59b3451b9b3e594b6ba082e12"
+ integrity sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw==
+ dependencies:
+ regenerator-runtime "^0.14.0"
+
+"@babel/runtime@^7.18.6", "@babel/runtime@^7.20.0":
version "7.22.3"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.3.tgz#0a7fce51d43adbf0f7b517a71f4c3aaca92ebcbb"
integrity sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==
dependencies:
regenerator-runtime "^0.13.11"
-"@babel/runtime@^7.17.2":
- version "7.24.7"
- resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.7.tgz#f4f0d5530e8dbdf59b3451b9b3e594b6ba082e12"
- integrity sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw==
+"@babel/runtime@^7.27.0":
+ version "7.27.0"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762"
+ integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==
dependencies:
regenerator-runtime "^0.14.0"
@@ -2881,13 +2888,19 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
-"@types/jsonwebtoken@~9.0.0":
- version "9.0.2"
- resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#9eeb56c76dd555039be2a3972218de5bd3b8d83e"
- integrity sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==
+"@types/jsonwebtoken@^9.0.8", "@types/jsonwebtoken@~9.0.0":
+ version "9.0.9"
+ resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz#a4c3a446c0ebaaf467a58398382616f416345fb3"
+ integrity sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==
dependencies:
+ "@types/ms" "*"
"@types/node" "*"
+"@types/ms@*":
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-2.1.0.tgz#052aa67a48eccc4309d7f0191b7e41434b90bb78"
+ integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==
+
"@types/node-forge@^1.3.0":
version "1.3.11"
resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da"
@@ -2900,25 +2913,13 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.2.5.tgz#26d295f3570323b2837d322180dfbf1ba156fefb"
integrity sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==
-"@types/prop-types@*":
- version "15.7.5"
- resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
- integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
-
-"@types/react@>=16.0.0":
- version "18.2.7"
- resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.7.tgz#dfb4518042a3117a045b8c222316f83414a783b3"
- integrity sha512-ojrXpSH2XFCmHm7Jy3q44nXDyN54+EYKP2lBhJ2bqfyPj6cIUW/FZW/Csdia34NQgq7KYcAlHi5184m4X88+yw==
+"@types/react@>=16.0.0", "@types/react@^19.0.0":
+ version "19.0.10"
+ resolved "https://registry.yarnpkg.com/@types/react/-/react-19.0.10.tgz#d0c66dafd862474190fe95ce11a68de69ed2b0eb"
+ integrity sha512-JuRQ9KXLEjaUNjTWpzuR231Z2WpIwczOkBEIvbHNCzQefFIT0L8IqE6NV6ULLyC1SI/i234JnDoMkfg+RjQj2g==
dependencies:
- "@types/prop-types" "*"
- "@types/scheduler" "*"
csstype "^3.0.2"
-"@types/scheduler@*":
- version "0.16.3"
- resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5"
- integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==
-
"@types/stack-utils@^2.0.0":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"
@@ -2931,6 +2932,13 @@
dependencies:
"@types/node" "*"
+"@types/ws@^8.5.14":
+ version "8.18.0"
+ resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.18.0.tgz#8a2ec491d6f0685ceaab9a9b7ff44146236993b5"
+ integrity sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==
+ dependencies:
+ "@types/node" "*"
+
"@types/yargs-parser@*":
version "21.0.0"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b"
@@ -4307,11 +4315,6 @@ expo-linking@~7.0.5:
expo-constants "~17.0.5"
invariant "^2.2.4"
-expo-media-library@~17.0.6:
- version "17.0.6"
- resolved "https://registry.yarnpkg.com/expo-media-library/-/expo-media-library-17.0.6.tgz#355f5f5abf0b5b35cdf009f18567cbba12d8dc82"
- integrity sha512-LUnfrddmee1xLOkyG2NN1l9xQbtvMX3fbM1brEGHg0SKSndvjod3FQdhTzZEYAariqW2RSxQR8v1IsheIoLQXg==
-
expo-modules-autolinking@2.0.8:
version "2.0.8"
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-2.0.8.tgz#b00c10ebb589ce2220548bbaee4865db1cf1f1f7"
@@ -4369,6 +4372,11 @@ expo-status-bar@~2.0.1:
resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-2.0.1.tgz#fc07726346dc30fbb68aadb0d7890b34fba42eee"
integrity sha512-AkIPX7jWHRPp83UBZ1iXtVvyr0g+DgBVvIXTtlmPtmUsm8Vq9Bb5IGj86PW8osuFlgoTVAg7HI/+Ok7yEYwiRg==
+expo-video@^2.0.5:
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/expo-video/-/expo-video-2.0.5.tgz#5c5311b0a20dcb7897d06cd4f9d7fb0ce13711d9"
+ integrity sha512-K5Q4bFKtYq0wEC38mckWUYeaTXsmhl6duidhSdbA63VBy6cwxDOk8uPsFPTQD3FXKJg6wFB0z8ZUASSPuUaY5A==
+
expo@~52.0.36:
version "52.0.37"
resolved "https://registry.yarnpkg.com/expo/-/expo-52.0.37.tgz#159b5f3f9bedb2c56b36a815b8679a2602a406cc"
@@ -5153,6 +5161,11 @@ isomorphic-ws@^4.0.1:
resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc"
integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==
+isomorphic-ws@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf"
+ integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==
+
istanbul-lib-coverage@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756"
@@ -5407,15 +5420,21 @@ jsonfile@^6.0.1:
optionalDependencies:
graceful-fs "^4.1.6"
-jsonwebtoken@~9.0.0:
- version "9.0.0"
- resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz#d0faf9ba1cc3a56255fe49c0961a67e520c1926d"
- integrity sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==
+jsonwebtoken@^9.0.2, jsonwebtoken@~9.0.0:
+ version "9.0.2"
+ resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#65ff91f4abef1784697d40952bb1998c504caaf3"
+ integrity sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==
dependencies:
jws "^3.2.2"
- lodash "^4.17.21"
+ lodash.includes "^4.3.0"
+ lodash.isboolean "^3.0.3"
+ lodash.isinteger "^4.0.4"
+ lodash.isnumber "^3.0.3"
+ lodash.isplainobject "^4.0.6"
+ lodash.isstring "^4.0.1"
+ lodash.once "^4.0.0"
ms "^2.1.1"
- semver "^7.3.8"
+ semver "^7.5.4"
jwa@^1.4.1:
version "1.4.1"
@@ -5535,6 +5554,11 @@ linkifyjs@^4.1.1:
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.1.1.tgz#73d427e3bbaaf4ca8e71c589ad4ffda11a9a5fde"
integrity sha512-zFN/CTVmbcVef+WaDXT63dNzzkfRBKT1j464NJQkV7iSgJU0sLBus9W0HBwnXK13/hf168pbrx/V/bjEHOXNHA==
+linkifyjs@^4.2.0:
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.2.0.tgz#9dd30222b9cbabec9c950e725ec00031c7fa3f08"
+ integrity sha512-pCj3PrQyATaoTYKHrgWRF3SJwsm61udVh+vuls/Rl6SptiDhgE7ziUIudAedRY9QEfynmM7/RmLEfPUyw1HPCw==
+
locate-path@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
@@ -5567,6 +5591,41 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==
+lodash.includes@^4.3.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f"
+ integrity sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==
+
+lodash.isboolean@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6"
+ integrity sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==
+
+lodash.isinteger@^4.0.4:
+ version "4.0.4"
+ resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343"
+ integrity sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==
+
+lodash.isnumber@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc"
+ integrity sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==
+
+lodash.isplainobject@^4.0.6:
+ version "4.0.6"
+ resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
+ integrity sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==
+
+lodash.isstring@^4.0.1:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
+ integrity sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==
+
+lodash.once@^4.0.0:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
+ integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==
+
lodash.throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
@@ -5903,6 +5962,11 @@ mime@1.6.0:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
+mime@^4.0.7:
+ version "4.0.7"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-4.0.7.tgz#0b7a98b08c63bd3c10251e797d67840c9bde9f13"
+ integrity sha512-2OfDPL+e03E0LrXaGYOtTFIYhiuzep94NSsuhrNULq+stylcJedcHdzHtz0atMUuGwJfFYs0YL5xeC/Ca2x0eQ==
+
mimic-fn@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
@@ -7053,7 +7117,7 @@ semver@^7.1.3, semver@~7.6.3:
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==
-semver@^7.3.5, semver@^7.3.8:
+semver@^7.3.5:
version "7.5.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.1.tgz#c90c4d631cf74720e46b21c1d37ea07edfab91ec"
integrity sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==
@@ -7358,10 +7422,10 @@ stream-buffers@2.2.x, stream-buffers@~2.2.0:
version "0.0.0"
uid ""
-stream-chat-react-native-core@6.6.8:
- version "6.6.8"
- resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.6.8.tgz#483ade63ba051426480ab2dfd8ab3b248b90ae88"
- integrity sha512-F8S70DHaiit6BEdKOkSMHq2bjMONhrouvJ+szBQuE430EJDgUlc2VErHk3yJCzqIt5lwfVZktjHuqSIOGVg5LQ==
+stream-chat-react-native-core@6.7.4:
+ version "6.7.4"
+ resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.7.4.tgz#9709465e161e32cf358034a82c284cc16369397a"
+ integrity sha512-YCAXBfdbazFIpO1EI9Czd2QYaFCJX+i9q710L3xPB4mRuaNl2SL8kH+RTj4Ur9Fyl3u1fcDI+1o/iYnaap1Uwg==
dependencies:
"@gorhom/bottom-sheet" "^5.1.1"
dayjs "1.10.5"
@@ -7382,11 +7446,11 @@ stream-chat-react-native-core@6.6.8:
uid ""
stream-chat@^8.57.6:
- version "8.57.6"
- resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.57.6.tgz#dd3a4a0a024ee44bfa6ae7ca15648e6c9f2e498f"
- integrity sha512-+zkC5DtxvdkEBAv7dCzzO4WWosjaM15EjsH3q4xD1nX/yf2qT6BMhPJguM+CUWxwlFh32X0KR+ARtD0ChPqtnA==
+ version "8.60.0"
+ resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.60.0.tgz#b67d4fbb185da53fb8ac5fc5759986d6ad7e19a3"
+ integrity sha512-7FpO7Wno++r+n+x9aFuXtGYtNO06CIMd2Bxe3doYZLhMfS0nuaXloeFlGcMT0r4U/6bnguz1qQdDJUPNQAS8bQ==
dependencies:
- "@babel/runtime" "^7.16.3"
+ "@babel/runtime" "^7.27.0"
"@types/jsonwebtoken" "~9.0.0"
"@types/ws" "^7.4.0"
axios "^1.6.0"
@@ -7396,6 +7460,21 @@ stream-chat@^8.57.6:
jsonwebtoken "~9.0.0"
ws "^7.5.10"
+stream-chat@^9.0.0:
+ version "9.0.0"
+ resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.0.0.tgz#cb22dcb8b7f070c623a13b6b75b212d560534d6c"
+ integrity sha512-I4+/DEp7dP3WBgRmqHaLswL+Y2fyQkUWJhYBS5zx4bpu1cYM6WEir9HYjToDNuJjltqa/FFIEF/tMPWr7iTc0A==
+ dependencies:
+ "@types/jsonwebtoken" "^9.0.8"
+ "@types/ws" "^8.5.14"
+ axios "^1.6.0"
+ base64-js "^1.5.1"
+ form-data "^4.0.0"
+ isomorphic-ws "^5.0.0"
+ jsonwebtoken "^9.0.2"
+ linkifyjs "^4.2.0"
+ ws "^8.18.1"
+
stream-slice@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/stream-slice/-/stream-slice-0.1.2.tgz#2dc4f4e1b936fb13f3eb39a2def1932798d07a4b"
@@ -8085,6 +8164,11 @@ ws@^8.12.1:
resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0"
integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==
+ws@^8.18.1:
+ version "8.18.1"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.1.tgz#ea131d3784e1dfdff91adb0a4a116b127515e3cb"
+ integrity sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==
+
xcode@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/xcode/-/xcode-3.0.1.tgz#3efb62aac641ab2c702458f9a0302696146aa53c"
diff --git a/examples/SampleApp/App.tsx b/examples/SampleApp/App.tsx
index 509d92ab0c..1128c7bbf3 100644
--- a/examples/SampleApp/App.tsx
+++ b/examples/SampleApp/App.tsx
@@ -6,7 +6,6 @@ import { createStackNavigator } from '@react-navigation/stack';
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';
import {
Chat,
- MessageType,
OverlayProvider,
SqliteClient,
ThemeProvider,
@@ -36,7 +35,7 @@ import { SharedGroupsScreen } from './src/screens/SharedGroupsScreen';
import { ThreadScreen } from './src/screens/ThreadScreen';
import { UserSelectorScreen } from './src/screens/UserSelectorScreen';
-import type { StreamChat } from 'stream-chat';
+import type { LocalMessage, StreamChat } from 'stream-chat';
if (__DEV__) {
DevSettings.addMenuItem('Reset local DB (offline storage)', () => {
@@ -45,11 +44,7 @@ if (__DEV__) {
});
}
-import type {
- StackNavigatorParamList,
- StreamChatGenerics,
- UserSelectorParamList,
-} from './src/types';
+import type { StackNavigatorParamList, UserSelectorParamList } from './src/types';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { navigateToChannel, RootNavigationRef } from './src/utils/RootNavigation';
import FastImage from 'react-native-fast-image';
@@ -107,18 +102,16 @@ const App = () => {
}
}
});
- messaging
- .getInitialNotification()
- .then((remoteMessage) => {
- if (remoteMessage) {
- // Notification caused app to open from quit state on iOS
- const channelId = remoteMessage.data?.channel_id as string;
- if (channelId) {
- // this will make the app to start with the channel screen with this channel id
- initialChannelIdGlobalRef.current = channelId;
- }
+ messaging.getInitialNotification().then((remoteMessage) => {
+ if (remoteMessage) {
+ // Notification caused app to open from quit state on iOS
+ const channelId = remoteMessage.data?.channel_id as string;
+ if (channelId) {
+ // this will make the app to start with the channel screen with this channel id
+ initialChannelIdGlobalRef.current = channelId;
}
- });
+ }
+ });
return () => {
unsubscribeOnNotificationOpen();
unsubscribeForegroundEvent();
@@ -171,21 +164,23 @@ const DrawerNavigator: React.FC = () => (
);
+const isMessageAIGenerated = (message: LocalMessage) => !!message.ai_generated;
+
const DrawerNavigatorWrapper: React.FC<{
- chatClient: StreamChat;
+ chatClient: StreamChat;
}> = ({ chatClient }) => {
const { bottom } = useSafeAreaInsets();
const streamChatTheme = useStreamChatTheme();
return (
- bottomInset={bottom} value={{ style: streamChatTheme }}>
-
+
+ !!message.ai_generated}
+ isMessageAIGenerated={isMessageAIGenerated}
>
diff --git a/examples/SampleApp/ios/Podfile.lock b/examples/SampleApp/ios/Podfile.lock
index b4ed7bd87e..269ca91dd2 100644
--- a/examples/SampleApp/ios/Podfile.lock
+++ b/examples/SampleApp/ios/Podfile.lock
@@ -1475,6 +1475,27 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
+ - react-native-image-picker (8.2.0):
+ - DoubleConversion
+ - glog
+ - hermes-engine
+ - RCT-Folly (= 2024.11.18.00)
+ - RCTRequired
+ - RCTTypeSafety
+ - React-Core
+ - React-debug
+ - React-Fabric
+ - React-featureflags
+ - React-graphics
+ - React-ImageManager
+ - React-NativeModulesApple
+ - React-RCTFabric
+ - React-rendererdebug
+ - React-utils
+ - ReactCodegen
+ - ReactCommon/turbomodule/bridging
+ - ReactCommon/turbomodule/core
+ - Yoga
- react-native-netinfo (11.4.1):
- React-Core
- react-native-safe-area-context (5.2.0):
@@ -2213,7 +2234,7 @@ PODS:
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.10)
- SocketRocket (0.7.1)
- - stream-chat-react-native (6.6.8):
+ - stream-chat-react-native (6.7.3):
- DoubleConversion
- glog
- hermes-engine
@@ -2284,6 +2305,7 @@ DEPENDENCIES:
- react-native-blob-util (from `../node_modules/react-native-blob-util`)
- "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)"
- "react-native-document-picker (from `../node_modules/@react-native-documents/picker`)"
+ - react-native-image-picker (from `../node_modules/react-native-image-picker`)
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-video (from `../node_modules/react-native-video`)
@@ -2439,6 +2461,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-camera-roll/camera-roll"
react-native-document-picker:
:path: "../node_modules/@react-native-documents/picker"
+ react-native-image-picker:
+ :path: "../node_modules/react-native-image-picker"
react-native-netinfo:
:path: "../node_modules/@react-native-community/netinfo"
react-native-safe-area-context:
@@ -2554,90 +2578,91 @@ SPEC CHECKSUMS:
hermes-engine: b417d2b2aee3b89b58e63e23a51e02be91dc876d
libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
- op-sqlite: 2e34a191af7e843608357671c94a6e2befd4b986
+ op-sqlite: c33561ea312a2ae38aae032fd3a42635dc6b57e8
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
- RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82
+ RCT-Folly: 36fe2295e44b10d831836cc0d1daec5f8abcf809
RCTDeprecation: b2eecf2d60216df56bc5e6be5f063826d3c1ee35
RCTRequired: 78522de7dc73b81f3ed7890d145fa341f5bb32ea
RCTTypeSafety: c135dd2bf50402d87fd12884cbad5d5e64850edd
React: b229c49ed5898dab46d60f61ed5a0bfa2ee2fadb
React-callinvoker: 2ac508e92c8bd9cf834cc7d7787d94352e4af58f
React-Codegen: 4b8b4817cea7a54b83851d4c1f91f79aa73de30a
- React-Core: 325b4f6d9162ae8b9a6ff42fe78e260eb124180d
- React-CoreModules: 558041e5258f70cd1092f82778d07b8b2ff01897
- React-cxxreact: 8fff17cbe76e6a8f9991b59552e1235429f9c74b
+ React-Core: 13cdd1558d0b3f6d9d5a22e14d89150280e79f02
+ React-CoreModules: b07a6744f48305405e67c845ebf481b6551b712a
+ React-cxxreact: 1055a86c66ac35b4e80bd5fb766aed5f494dfff4
React-debug: c76e92776a86622209279fe6d24a0147584444ed
- React-defaultsnativemodule: 111fb1efc95c2bd0ee18e38e9f7b57d678e6f932
- React-domnativemodule: d5154a815306fd6050ee9346a1490d2fb17eb0e5
- React-Fabric: 51ac32f0a6790b1d3b14d90c6870e5ce5bb3854a
- React-FabricComponents: 1094d6a3c2566b3c56951331c44d7d3960570ac8
- React-FabricImage: 6b210ad3c72704a9ad60dde66c397ce6257333f4
+ React-defaultsnativemodule: c2e3ac39909241374c3322eb2be33f4c15fe6be4
+ React-domnativemodule: 240b3c95b5300cc6537594e73ebc6e8e77585b74
+ React-Fabric: 3b403ca25f74d54454b31d1d2627050e0777d42c
+ React-FabricComponents: 154740cfcd57943709a9d0343769d17173c0ac9c
+ React-FabricImage: 0863e39cea98f3ca2f8c3d92984660795cec84ae
React-featureflags: efb93a998907e4ad5b88f6ed77cc140914d5c36d
- React-featureflagsnativemodule: a74b09429c2e7a57412d78cc159ab86ae4f15db9
- React-graphics: 17ef0ee3ef4a4c1774cc82f1f477ecef4d67c73f
- React-hermes: a9a0c8377627b5506ef9a7b6f60a805c306e3f51
- React-idlecallbacksnativemodule: 0711ec5eb53c7f790641fa00e5f6ec0355d3159b
- React-ImageManager: 23b4701408390428724f0e0ebb2cbed7b37c2b24
- React-jserrorhandler: e21b438ef8b99ea8bf070ff35f00bc0215b5f769
- React-jsi: f3f51595cc4c089037b536368f016d4742bf9cf7
- React-jsiexecutor: cca6c232db461e2fd213a11e9364cfa6fdaa20eb
- React-jsinspector: 8a3c2637b84ebec478f46a43432a522d7489410f
- React-jsinspectortracing: ee0215d2db753cc10f45fc9aa86557718d0b16fb
- React-jsitracing: 258be1fd259141f6aa43012c20c70ebc02e32087
- React-logger: 018826bfd51b9f18e87f67db1590bc510ad20664
- React-Mapbuffer: 9fbb496e7d6f7c34d5e617365ee778bf96d14eae
- React-microtasksnativemodule: 36adde22631838680d1be62776e8ccb83186c06a
- react-native-blob-util: d03eaad9fd1bbe90bd0eedb5bad3333215976086
- react-native-cameraroll: 10054f480dfd6e0bd02fdf08fb6d82f80b362575
- react-native-document-picker: 78c262a7f9f77df2380378aa4b3413b8646ce91b
- react-native-netinfo: cec9c4e86083cb5b6aba0e0711f563e2fbbff187
- react-native-safe-area-context: 02e0f487c16ccf1acc8a666bed2318ceeb5dc14c
- react-native-video: 16b5c395d05f8af23e16bfe3dc0794a5514c882f
- React-NativeModulesApple: ec44c21ae0bbb5f9a2df72db00294e33a00e07f0
- React-perflogger: 9e8d3c0dc0194eb932162812a168aa5dc662f418
- React-performancetimeline: 350424518f433dd43f063dc5f2cf3195c1a5b60f
+ React-featureflagsnativemodule: 51116d72aafea30860f315702d17eb76bbb725a3
+ React-graphics: 91d9920451f633d64d31948da3ba0377b6eda8de
+ React-hermes: 71186f872c932e4574d5feb3ed754dda63a0b3bd
+ React-idlecallbacksnativemodule: 19bf1fa4b2b66fe1898ac1d185129cdcc3221c7c
+ React-ImageManager: 7dc7bfca8e9ecb9a7436b8a89a143a193ef5adcf
+ React-jserrorhandler: d8640792495ac2d78e73acbcc77a8439d1eedfef
+ React-jsi: 0775a66820496769ad83e629f0f5cce621a57fc7
+ React-jsiexecutor: 2cf5ba481386803f3c88b85c63fa102cba5d769e
+ React-jsinspector: d1d9f215c7431b286acc12e83cdf0d90c265f0ed
+ React-jsinspectortracing: c4c1cceb9a9c266ce849c82332e35cc57ee9dae9
+ React-jsitracing: 267618eec9c362658a4587c5ddcfb41b2e00c403
+ React-logger: 795cd5055782db394f187f9db0477d4b25b44291
+ React-Mapbuffer: 0df2a235bd0182f5cbed6c5f095e66deca12e335
+ React-microtasksnativemodule: b31e56a980634f383221bfefd5111d04c14c110b
+ react-native-blob-util: 875bbeee07e4ada135e4edf9fc7b22acf8d9721d
+ react-native-cameraroll: cdc91c4c953d1a18aa3ce88b5a25698025c8c4d2
+ react-native-document-picker: 19be73c0423e4bc886cef74ec282eff750698013
+ react-native-image-picker: 1c620a65f900a47d6d12ec94874c6a1820ebea7d
+ react-native-netinfo: f0a9899081c185db1de5bb2fdc1c88c202a059ac
+ react-native-safe-area-context: 0b43456abcaaa3c8323bbfafe9c5f0f9511219d2
+ react-native-video: a225b4d4d3286f3253dc7b00a62e7c8e59d04d51
+ React-NativeModulesApple: b74b4e3004104429461593fe460ad790cc4928c2
+ React-perflogger: ab51b7592532a0ea45bf6eed7e6cae14a368b678
+ React-performancetimeline: 37192fd1019c3b3b597a877dff12f3af68305c34
React-RCTActionSheet: 592674cf61142497e0e820688f5a696e41bf16dd
- React-RCTAnimation: e6d669872f9b3b4ab9527aab283b7c49283236b7
- React-RCTAppDelegate: de2343fe08be4c945d57e0ecce44afcc7dd8fc03
- React-RCTBlob: 3e2dce94c56218becc4b32b627fc2293149f798d
- React-RCTFabric: adad07a08efb186bc1046041207527927524170d
- React-RCTFBReactNativeSpec: d10ca5e0ccbfeac8c047361fedf8e4ac653887b6
- React-RCTImage: dc04b176c022d12a8f55ae7a7279b1e091066ae0
- React-RCTLinking: 88f5e37fe4f26fbc80791aa2a5f01baf9b9a3fd5
- React-RCTNetwork: f213693565efbd698b8e9c18d700a514b49c0c8e
- React-RCTSettings: a2d32a90c45a3575568cad850abc45924999b8a5
- React-RCTText: 54cdcd1cbf6f6a91dc6317f5d2c2b7fc3f6bf7a0
- React-RCTVibration: 11dae0e7f577b5807bb7d31e2e881eb46f854fd4
+ React-RCTAnimation: 8fbb8dba757b49c78f4db403133ab6399a4ce952
+ React-RCTAppDelegate: 7f88baa8cb4e5d6c38bb4d84339925c70c9ac864
+ React-RCTBlob: f89b162d0fe6b570a18e755eb16cbe356d3c6d17
+ React-RCTFabric: f2151588dc1dc884b34b8660d72ef5237aa4b10e
+ React-RCTFBReactNativeSpec: 8c29630c2f379c729300e4c1e540f3d1b78d1936
+ React-RCTImage: ccac9969940f170503857733f9a5f63578e106e1
+ React-RCTLinking: d82427bbf18415a3732105383dff119131cadd90
+ React-RCTNetwork: 12ad4d0fbde939e00251ca5ca890da2e6825cc3c
+ React-RCTSettings: e7865bf9f455abf427da349c855f8644b5c39afa
+ React-RCTText: 2cdfd88745059ec3202a0842ea75a956c7d6f27d
+ React-RCTVibration: a3a1458e6230dfd64b3768ebc0a4aac430d9d508
React-rendererconsistency: aa476d937c91886dd8b2ddde3191c775585ae47a
- React-rendererdebug: df10d858ac7709b9c8349d952474b0746092c690
+ React-rendererdebug: 5a2219e0ceb78f4ffe9ee2d80fa260bb5bac50b2
React-rncore: 517c6c3647d45de81a7920b6959adf14fed2a5a5
- React-RuntimeApple: 6922a0861c3fc4c7d544fc7d1d5cb38c779d1264
- React-RuntimeCore: 41a95876d16630ce00946eaaee7ffd5222242b44
+ React-RuntimeApple: 40809bf5975c265b990dec2725f2cfb61f1afc75
+ React-RuntimeCore: 375c2645e924fdca875918f07ed987653c517edc
React-runtimeexecutor: a188df372373baf5066e6e229177836488799f80
- React-RuntimeHermes: f2ca409c03c36bb3dcbf61bdfa2636501f9faebd
- React-runtimescheduler: 7ae10fa81428c2479e0a5534943dacb8e34c9d52
+ React-RuntimeHermes: 2de8d61ec25d950ae4aebcab1a895e0bb8b18c95
+ React-runtimescheduler: e8b49a60eca68a3513c259879a352ed010fed255
React-timing: e56b95cb12c6fb9146be7ba3d671cf6b5d17b2e0
- React-utils: 6eabecc0e7d7bcf21b6b33357bc1fe8ae13c7c4c
- ReactAppDependencyProvider: a1fb08dfdc7ebc387b2e54cfc9decd283ed821d8
- ReactCodegen: 0f8899ac1bad260bf3b362ee848ef67a70b5a306
- ReactCommon: a30b578194de911fbe1698efb8247bfe4cb6abff
- RNAudioRecorderPlayer: 11df0c7b614e9767ef24d896465c3a758c592de7
- RNCAsyncStorage: 849b77e6ab3eb838361a902b492993056924faab
- RNFastImage: 462a183c4b0b6b26fdfd639e1ed6ba37536c3b87
- RNFBApp: b5626640e0f4b4fe5be4f44375df703c0d62ee4b
- RNFBMessaging: 8e38f5ca846497f8a9c91d33f311c00ca52d119c
- RNGestureHandler: f7b3a72c099e1e29b5b81688678bc9108d44057c
- RNNotifee: 5e3b271e8ea7456a36eec994085543c9adca9168
- RNReactNativeHapticFeedback: eb5395b503c7a8f10de5e6722ef8afd3c61bc4f5
- RNReanimated: fe5c52894886953248a81a10b2a9b6eeb5398d61
- RNScreens: fc78b9b5a1274426d7a59b7d07c272bba13604fa
- RNShare: dcef43a8864fcc114fd582edba7832a906fd318d
- RNSVG: 71e35e78add645b84b52b0c6f203f91028e1ab5e
+ React-utils: 8ad62100a8780798a380b769e968c4764bad1f4b
+ ReactAppDependencyProvider: f2e81d80afd71a8058589e19d8a134243fa53f17
+ ReactCodegen: 299e99fc57c93edc7c5396ef1a39a3a4d494f25d
+ ReactCommon: c8fdbc582b98a07daf201cd95c1da75dd029f3ee
+ RNAudioRecorderPlayer: 224c7de87722938aedce04000d09baa633148f5b
+ RNCAsyncStorage: dac011cac81189c2b3b8654f3db97d2b6362d165
+ RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8
+ RNFBApp: 60366dd9d6bb01327607e1561a32508592d76db9
+ RNFBMessaging: 9465c2e3adb5e02cae8d40048306a30aea7f55cf
+ RNGestureHandler: 0a16f3f13829c01268ae55610a40b57b713c8161
+ RNNotifee: 4a6ee5c7deaf00e005050052d73ee6315dff7ec9
+ RNReactNativeHapticFeedback: a49e613d48d721c99cad9689a490554104c22154
+ RNReanimated: c9f295fb1679867288d238bfaf3ea39225c95e1b
+ RNScreens: 77f93ec55b749c49549b447527ebf78e990125f3
+ RNShare: 12d13ebc179faf22534c605d17b2c2fa40191850
+ RNSVG: 05776cf3f0d52d3f8e7ebee34b2189da7b8638ff
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
- stream-chat-react-native: fe01622d1cbabaee9a0f65b5e469041b1e7868a4
+ stream-chat-react-native: e6555aac04d25ad09d9f219360dda7a00eb0d9d1
Yoga: be02ca501b03c79d7027a6bbbd0a8db985034f11
PODFILE CHECKSUM: 4f662370295f8f9cee909f1a4c59a614999a209d
diff --git a/examples/SampleApp/package.json b/examples/SampleApp/package.json
index 26ea973741..c202afbc50 100644
--- a/examples/SampleApp/package.json
+++ b/examples/SampleApp/package.json
@@ -42,6 +42,7 @@
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "^2.24.0",
"react-native-haptic-feedback": "^2.3.3",
+ "react-native-image-picker": "^8.2.0",
"react-native-reanimated": "^3.17.1",
"react-native-safe-area-context": "^5.2.0",
"react-native-screens": "^4.9.1",
diff --git a/examples/SampleApp/src/ChatUsers.ts b/examples/SampleApp/src/ChatUsers.ts
index 6b1b37be5c..dec7d186c1 100644
--- a/examples/SampleApp/src/ChatUsers.ts
+++ b/examples/SampleApp/src/ChatUsers.ts
@@ -1,5 +1,4 @@
import { UserResponse } from 'stream-chat';
-import { StreamChatGenerics } from './types';
export const USER_TOKENS: Record = {
e2etest1:
@@ -27,7 +26,7 @@ export const USER_TOKENS: Record = {
rodolphe:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicm9kb2xwaGUifQ.tLl-I8ADBhTKB-x5FB9jK4-am0dELLXgydM6VN9rTL8',
};
-export const USERS: Record> = {
+export const USERS: Record = {
neil: {
id: 'neil',
image: 'https://ca.slack-edge.com/T02RM6X6B-U01173D1D5J-0dead6eea6ea-512',
diff --git a/examples/SampleApp/src/components/AddMemberBottomSheet.tsx b/examples/SampleApp/src/components/AddMemberBottomSheet.tsx
index f3e4d00800..8239fa2155 100644
--- a/examples/SampleApp/src/components/AddMemberBottomSheet.tsx
+++ b/examples/SampleApp/src/components/AddMemberBottomSheet.tsx
@@ -21,8 +21,6 @@ import { usePaginatedUsers } from '../hooks/usePaginatedUsers';
import type { UserResponse } from 'stream-chat';
-import { StreamChatGenerics } from '../types';
-
const styles = StyleSheet.create({
container: {
height: 300,
@@ -94,7 +92,7 @@ export const AddMemberBottomSheet: React.FC = () => {
return null;
}
- const addMember = async (user: UserResponse) => {
+ const addMember = async (user: UserResponse) => {
setAddMemberQueryInProgress(true);
try {
diff --git a/examples/SampleApp/src/components/ChannelInfoOverlay.tsx b/examples/SampleApp/src/components/ChannelInfoOverlay.tsx
index 7c58473d77..ea95c21fbb 100644
--- a/examples/SampleApp/src/components/ChannelInfoOverlay.tsx
+++ b/examples/SampleApp/src/components/ChannelInfoOverlay.tsx
@@ -29,6 +29,7 @@ import {
useTheme,
useViewport,
} from 'stream-chat-react-native';
+import { ChannelMemberResponse } from 'stream-chat';
import { useAppOverlayContext } from '../context/AppOverlayContext';
import { useBottomSheetOverlayContext } from '../context/BottomSheetOverlayContext';
@@ -224,9 +225,9 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
: 0;
const channelName = channel
? channel.data?.name ||
- Object.values(channel.state.members)
+ Object.values(channel.state.members)
.slice(0)
- .reduce((returnString, currentMember, index, originalArray) => {
+ .reduce((returnString, currentMember, index, originalArray) => {
const returnStringLength = returnString.length;
const currentMemberName =
currentMember.user?.name || currentMember.user?.id || 'Unknown User';
@@ -246,7 +247,7 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
}, '')
: '';
const otherMembers = channel
- ? Object.values(channel.state.members).filter((member) => member.user?.id !== clientId)
+ ? Object.values(channel.state.members).filter((member) => member.user?.id !== clientId)
: [];
return (
@@ -292,14 +293,14 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
? 'Online'
: `Last Seen ${dayjs(otherMembers[0].user?.last_active).fromNow()}`
: `${Object.keys(channel.state.members).length} Members, ${
- Object.values(channel.state.members).filter(
+ Object.values(channel.state.members).filter(
(member) => !!member.user?.online,
).length
} Online`}
(channel.state.members)
.map((member) => member.user)
.sort((a, b) =>
!!a?.online && !b?.online
diff --git a/examples/SampleApp/src/components/ChannelPreview.tsx b/examples/SampleApp/src/components/ChannelPreview.tsx
index a129eaec59..eab30d5f08 100644
--- a/examples/SampleApp/src/components/ChannelPreview.tsx
+++ b/examples/SampleApp/src/components/ChannelPreview.tsx
@@ -22,7 +22,7 @@ import { useChannelInfoOverlayContext } from '../context/ChannelInfoOverlayConte
import type { StackNavigationProp } from '@react-navigation/stack';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
+import type { StackNavigatorParamList } from '../types';
import { ChannelState } from 'stream-chat';
const styles = StyleSheet.create({
@@ -71,7 +71,7 @@ const CustomChannelPreviewStatus = (
);
};
-export const ChannelPreview: React.FC> = (
+export const ChannelPreview: React.FC = (
props,
) => {
const { channel } = props;
@@ -82,7 +82,7 @@ export const ChannelPreview: React.FC();
+ const { client } = useChatContext();
const navigation = useNavigation();
diff --git a/examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx b/examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx
index 0df48bad0f..b3e91999c3 100644
--- a/examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx
+++ b/examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx
@@ -8,7 +8,7 @@ import { DEFAULT_PAGINATION_LIMIT } from '../../utils/constants';
import type { MessageResponse } from 'stream-chat';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../../types';
+import type { StackNavigatorParamList } from '../../types';
dayjs.extend(calendar);
@@ -52,13 +52,13 @@ export type MessageSearchListProps = {
EmptySearchIndicator: React.ComponentType;
loading: boolean;
loadMore: () => void;
- messages: MessageResponse[] | undefined;
+ messages: MessageResponse[] | undefined;
refreshing?: boolean;
refreshList?: () => void;
showResultCount?: boolean;
};
export const MessageSearchList: React.FC = React.forwardRef(
- (props, scrollRef: React.Ref> | null>) => {
+ (props, scrollRef: React.Ref | null>) => {
const {
EmptySearchIndicator,
loading,
diff --git a/examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx b/examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx
index 0d1037e5ec..07f4e93bc0 100644
--- a/examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx
+++ b/examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx
@@ -4,7 +4,6 @@ import { TouchableOpacity } from 'react-native-gesture-handler';
import { useNavigation } from '@react-navigation/core';
import {
- DefaultStreamChatGenerics,
MessageInputContextValue,
Search,
SendRight,
@@ -16,20 +15,15 @@ import {
import { NewDirectMessagingScreenNavigationProp } from '../screens/NewDirectMessagingScreen';
-import { StreamChatGenerics as LocalStreamChatGenerics } from '../types';
import { useUserSearchContext } from '../context/UserSearchContext';
import { useAppContext } from '../context/AppContext';
-type NewDirectMessagingSendButtonPropsWithContext<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Pick, 'giphyActive' | 'sendMessage'> & {
+type NewDirectMessagingSendButtonPropsWithContext = Pick & {
/** Disables the button */ disabled: boolean;
};
-const SendButtonWithContext = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: NewDirectMessagingSendButtonPropsWithContext,
+const SendButtonWithContext = (
+ props: NewDirectMessagingSendButtonPropsWithContext,
) => {
const { disabled = false, giphyActive, sendMessage } = props;
const {
@@ -53,9 +47,9 @@ const SendButtonWithContext = <
);
};
-const areEqual = (
- prevProps: NewDirectMessagingSendButtonPropsWithContext,
- nextProps: NewDirectMessagingSendButtonPropsWithContext,
+const areEqual = (
+ prevProps: NewDirectMessagingSendButtonPropsWithContext,
+ nextProps: NewDirectMessagingSendButtonPropsWithContext,
) => {
const {
disabled: prevDisabled,
@@ -91,20 +85,18 @@ const MemoizedNewDirectMessagingSendButton = React.memo(
areEqual,
) as typeof SendButtonWithContext;
-export type SendButtonProps<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Partial>;
+export type SendButtonProps = Partial;
/**
* UI Component for send button in MessageInput component.
*/
-export const NewDirectMessagingSendButton = (props: SendButtonProps) => {
+export const NewDirectMessagingSendButton = (props: SendButtonProps) => {
const { chatClient } = useAppContext();
const navigation = useNavigation();
- const { channel } = useChannelContext();
+ const { channel } = useChannelContext();
const { selectedUserIds, reset } = useUserSearchContext();
- const { giphyActive, text } = useMessageInputContext();
+ const { giphyActive, text } = useMessageInputContext();
const sendMessage = async () => {
if (!channel) {
@@ -133,7 +125,7 @@ export const NewDirectMessagingSendButton = (props: SendButtonProps
+
export const ThreadsUnreadCountBadge: React.FC = () => {
const { chatClient } = useAppContext();
- const { unreadCount } = useStateStore(chatClient?.threads?.state, selector);
+ const { unreadCount } = useStateStore(chatClient?.threads?.state, selector) ?? { unreadCount: 0 };
return ;
};
diff --git a/examples/SampleApp/src/components/UserInfoOverlay.tsx b/examples/SampleApp/src/components/UserInfoOverlay.tsx
index 90831ccca2..a0f9f59598 100644
--- a/examples/SampleApp/src/components/UserInfoOverlay.tsx
+++ b/examples/SampleApp/src/components/UserInfoOverlay.tsx
@@ -35,7 +35,6 @@ import { useAppOverlayContext } from '../context/AppOverlayContext';
import { useBottomSheetOverlayContext } from '../context/BottomSheetOverlayContext';
import { useUserInfoOverlayContext } from '../context/UserInfoOverlayContext';
-import type { StreamChatGenerics } from '../types';
import { useAppContext } from '../context/AppContext';
import { UserResponse } from 'stream-chat';
@@ -105,7 +104,7 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
const { overlayOpacity, visible } = props;
const { chatClient } = useAppContext();
const { overlay, setOverlay } = useAppOverlayContext();
- const { client } = useChatContext();
+ const { client } = useChatContext();
const { setData } = useBottomSheetOverlayContext();
const { data, reset } = useUserInfoOverlayContext();
const { vh } = useViewport();
@@ -298,7 +297,6 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
// Check if the channel already exists.
const channels = await client.queryChannels({
- distinct: true,
members,
});
@@ -351,7 +349,6 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
// Check if the channel already exists.
const channels = await client.queryChannels({
- distinct: true,
members,
});
diff --git a/examples/SampleApp/src/components/UserSearch/SelectedUserTag.tsx b/examples/SampleApp/src/components/UserSearch/SelectedUserTag.tsx
index c1ae1d5f8f..4ea60b956e 100644
--- a/examples/SampleApp/src/components/UserSearch/SelectedUserTag.tsx
+++ b/examples/SampleApp/src/components/UserSearch/SelectedUserTag.tsx
@@ -4,7 +4,6 @@ import { useTheme } from 'stream-chat-react-native';
import type { UserResponse } from 'stream-chat';
-import type { StreamChatGenerics } from '../../types';
const styles = StyleSheet.create({
tagContainer: {
@@ -29,7 +28,7 @@ const styles = StyleSheet.create({
type SelectedUserTagProps = {
index: number;
onPress: () => void;
- tag: UserResponse;
+ tag: UserResponse;
disabled?: boolean;
};
diff --git a/examples/SampleApp/src/components/UserSearch/UserGridItem.tsx b/examples/SampleApp/src/components/UserSearch/UserGridItem.tsx
index fdb7afa4ca..c61449e923 100644
--- a/examples/SampleApp/src/components/UserSearch/UserGridItem.tsx
+++ b/examples/SampleApp/src/components/UserSearch/UserGridItem.tsx
@@ -5,7 +5,6 @@ import { Avatar, Close, useTheme } from 'stream-chat-react-native';
import type { UserResponse } from 'stream-chat';
-import type { StreamChatGenerics } from '../../types';
const presenceIndicator = { cx: 7, cy: 7, r: 5 };
@@ -40,7 +39,7 @@ const styles = StyleSheet.create({
export type UserGridItemProps = {
onPress: () => void;
- user: UserResponse;
+ user: UserResponse;
removeButton?: boolean;
};
@@ -57,7 +56,6 @@ export const UserGridItem: React.FC = ({
return (
[];
+ results?: UserResponse[];
showOnlineStatus?: boolean;
- toggleSelectedUser?: (user: UserResponse) => void;
+ toggleSelectedUser?: (user: UserResponse) => void;
};
export const UserSearchResults: React.FC = ({
@@ -87,7 +86,7 @@ export const UserSearchResults: React.FC = ({
} = useUserSearchContext();
const [sections, setSections] = useState<
Array<{
- data: UserResponse[];
+ data: UserResponse[];
title: string;
}>
>([]);
@@ -113,7 +112,7 @@ export const UserSearchResults: React.FC = ({
useEffect(() => {
const newSections: {
[key: string]: {
- data: UserResponse[];
+ data: UserResponse[];
title: string;
};
} = {};
@@ -204,7 +203,7 @@ export const UserSearchResults: React.FC = ({
},
]}
>
-
+
) => void;
- results: UserResponse[];
+ onPress: (user: UserResponse) => void;
+ results: UserResponse[];
gridSize?: number;
loading?: boolean;
loadMore?: () => void;
diff --git a/examples/SampleApp/src/context/AppContext.ts b/examples/SampleApp/src/context/AppContext.ts
index f50d94f24d..0ca2b2300a 100644
--- a/examples/SampleApp/src/context/AppContext.ts
+++ b/examples/SampleApp/src/context/AppContext.ts
@@ -2,10 +2,10 @@ import React from 'react';
import type { StreamChat } from 'stream-chat';
-import type { LoginConfig, StreamChatGenerics } from '../types';
+import type { LoginConfig } from '../types';
type AppContextType = {
- chatClient: StreamChat | null;
+ chatClient: StreamChat | null;
loginUser: (config: LoginConfig) => void;
logout: () => void;
switchUser: (userId?: string) => void;
diff --git a/examples/SampleApp/src/context/BottomSheetOverlayContext.tsx b/examples/SampleApp/src/context/BottomSheetOverlayContext.tsx
index 437b4f668a..16bb3f3110 100644
--- a/examples/SampleApp/src/context/BottomSheetOverlayContext.tsx
+++ b/examples/SampleApp/src/context/BottomSheetOverlayContext.tsx
@@ -2,14 +2,13 @@ import React, { PropsWithChildren, useContext, useState } from 'react';
import type { ChannelContextValue } from 'stream-chat-react-native';
-import type { StreamChatGenerics } from '../types';
export const isAddMemberBottomSheetData = (
data: BottomSheetOverlayData,
-): data is Pick, 'channel'> => 'channel' in data;
+): data is Pick => 'channel' in data;
export type BottomSheetOverlayData =
- | Pick, 'channel'>
+ | Pick
| {
onConfirm: () => void;
title: string;
diff --git a/examples/SampleApp/src/context/ChannelInfoOverlayContext.tsx b/examples/SampleApp/src/context/ChannelInfoOverlayContext.tsx
index 59646feb63..dc73658fea 100644
--- a/examples/SampleApp/src/context/ChannelInfoOverlayContext.tsx
+++ b/examples/SampleApp/src/context/ChannelInfoOverlayContext.tsx
@@ -4,7 +4,7 @@ import { ChannelState } from 'stream-chat';
import type { StackNavigationProp } from '@react-navigation/stack';
import type { ChannelContextValue } from 'stream-chat-react-native';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
+import type { StackNavigatorParamList } from '../types';
type ChannelListScreenNavigationProp = StackNavigationProp<
StackNavigatorParamList,
@@ -12,10 +12,10 @@ type ChannelListScreenNavigationProp = StackNavigationProp<
>;
export type ChannelInfoOverlayData = Partial<
- Pick, 'channel'>
+ Pick
> & {
clientId?: string;
- membership?: ChannelState['membership'];
+ membership?: ChannelState['membership'];
navigation?: ChannelListScreenNavigationProp;
};
diff --git a/examples/SampleApp/src/context/UserInfoOverlayContext.tsx b/examples/SampleApp/src/context/UserInfoOverlayContext.tsx
index f905fb380a..da5ebdb4a5 100644
--- a/examples/SampleApp/src/context/UserInfoOverlayContext.tsx
+++ b/examples/SampleApp/src/context/UserInfoOverlayContext.tsx
@@ -4,7 +4,7 @@ import type { StackNavigationProp } from '@react-navigation/stack';
import type { ChannelState } from 'stream-chat';
import type { ChannelContextValue } from 'stream-chat-react-native';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
+import type { StackNavigatorParamList } from '../types';
type GroupChannelDetailsScreenNavigationProp = StackNavigationProp<
StackNavigatorParamList,
@@ -12,9 +12,9 @@ type GroupChannelDetailsScreenNavigationProp = StackNavigationProp<
>;
export type UserInfoOverlayData = Partial<
- Pick, 'channel'>
+ Pick
> & {
- member?: ChannelState['members'][0];
+ member?: ChannelState['members'][0];
navigation?: GroupChannelDetailsScreenNavigationProp;
};
diff --git a/examples/SampleApp/src/custom-types.d.ts b/examples/SampleApp/src/custom-types.d.ts
new file mode 100644
index 0000000000..2dfa7528d4
--- /dev/null
+++ b/examples/SampleApp/src/custom-types.d.ts
@@ -0,0 +1,45 @@
+import {
+ DefaultAttachmentData,
+ DefaultChannelData,
+ DefaultCommandData,
+ DefaultEventData,
+ DefaultMemberData,
+ DefaultMessageData,
+ DefaultPollData,
+ DefaultPollOptionData,
+ DefaultReactionData,
+ DefaultThreadData,
+ DefaultUserData,
+} from 'stream-chat-react-native';
+
+declare module 'stream-chat' {
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
+
+ interface CustomAttachmentData extends DefaultAttachmentData {
+ id?: string;
+ }
+
+ interface CustomChannelData extends DefaultChannelData {}
+
+ interface CustomCommandData extends DefaultCommandData {}
+
+ interface CustomEventData extends DefaultEventData {}
+
+ interface CustomMemberData extends DefaultMemberData {}
+
+ interface CustomUserData extends DefaultUserData {}
+
+ interface CustomMessageData extends DefaultMessageData {
+ ai_generated?: boolean;
+ }
+
+ interface CustomPollOptionData extends DefaultPollOptionData {}
+
+ interface CustomPollData extends DefaultPollData {}
+
+ interface CustomReactionData extends DefaultReactionData {}
+
+ interface CustomThreadData extends DefaultThreadData {}
+
+ /* eslint-enable @typescript-eslint/no-empty-object-type */
+}
diff --git a/examples/SampleApp/src/hooks/useChannelMembersStatus.ts b/examples/SampleApp/src/hooks/useChannelMembersStatus.ts
index e7fc8dc6a8..92db54fbf7 100644
--- a/examples/SampleApp/src/hooks/useChannelMembersStatus.ts
+++ b/examples/SampleApp/src/hooks/useChannelMembersStatus.ts
@@ -5,9 +5,7 @@ import { getUserActivityStatus } from '../utils/getUserActivityStatus';
import type { Channel } from 'stream-chat';
-import type { StreamChatGenerics } from '../types';
-
-export const useChannelMembersStatus = (channel: Channel) => {
+export const useChannelMembersStatus = (channel: Channel) => {
const watchersCount = channel.state.watcher_count;
const memberCount = channel?.data?.member_count;
diff --git a/examples/SampleApp/src/hooks/useChatClient.ts b/examples/SampleApp/src/hooks/useChatClient.ts
index e22502c72b..7e11e8235a 100644
--- a/examples/SampleApp/src/hooks/useChatClient.ts
+++ b/examples/SampleApp/src/hooks/useChatClient.ts
@@ -6,7 +6,7 @@ import { SqliteClient } from 'stream-chat-react-native';
import { USER_TOKENS, USERS } from '../ChatUsers';
import AsyncStore from '../utils/AsyncStore';
-import type { LoginConfig, StreamChatGenerics } from '../types';
+import type { LoginConfig } from '../types';
import { PermissionsAndroid, Platform } from 'react-native';
const messaging = getMessaging();
@@ -30,10 +30,10 @@ const requestAndroidPermission = async () => {
};
export const useChatClient = () => {
- const [chatClient, setChatClient] = useState | null>(null);
+ const [chatClient, setChatClient] = useState(null);
const [isConnecting, setIsConnecting] = useState(true);
- const unsubscribePushListenersRef = useRef<() => void>();
+ const unsubscribePushListenersRef = useRef<() => void>(undefined);
/**
* @param config the user login config
@@ -42,7 +42,7 @@ export const useChatClient = () => {
const loginUser = async (config: LoginConfig) => {
// unsubscribe from previous push listeners
unsubscribePushListenersRef.current?.();
- const client = StreamChat.getInstance(config.apiKey, {
+ const client = StreamChat.getInstance(config.apiKey, {
timeout: 6000,
// logger: (type, msg) => console.log(type, msg)
});
diff --git a/examples/SampleApp/src/hooks/usePaginatedAttachments.ts b/examples/SampleApp/src/hooks/usePaginatedAttachments.ts
index 6a845c5396..54413afe4e 100644
--- a/examples/SampleApp/src/hooks/usePaginatedAttachments.ts
+++ b/examples/SampleApp/src/hooks/usePaginatedAttachments.ts
@@ -4,10 +4,8 @@ import { useAppContext } from '../context/AppContext';
import type { Channel, MessageResponse } from 'stream-chat';
-import type { StreamChatGenerics } from '../types';
-
export const usePaginatedAttachments = (
- channel: Channel,
+ channel: Channel,
attachmentType: string,
) => {
const { chatClient } = useAppContext();
@@ -15,7 +13,7 @@ export const usePaginatedAttachments = (
const hasMoreResults = useRef(true);
const queryInProgress = useRef(false);
const [loading, setLoading] = useState(true);
- const [messages, setMessages] = useState[]>([]);
+ const [messages, setMessages] = useState([]);
const fetchAttachments = async () => {
if (queryInProgress.current) {
diff --git a/examples/SampleApp/src/hooks/usePaginatedPinnedMessages.ts b/examples/SampleApp/src/hooks/usePaginatedPinnedMessages.ts
index fbdaa8d319..2cfa5d73d9 100644
--- a/examples/SampleApp/src/hooks/usePaginatedPinnedMessages.ts
+++ b/examples/SampleApp/src/hooks/usePaginatedPinnedMessages.ts
@@ -4,17 +4,16 @@ import { useAppContext } from '../context/AppContext';
import type { Channel, MessageResponse } from 'stream-chat';
-import type { StreamChatGenerics } from '../types';
import { DEFAULT_PAGINATION_LIMIT } from '../utils/constants';
-export const usePaginatedPinnedMessages = (channel: Channel) => {
+export const usePaginatedPinnedMessages = (channel: Channel) => {
const { chatClient } = useAppContext();
const offset = useRef(0);
const hasMoreResults = useRef(true);
const queryInProgress = useRef(false);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(false);
- const [messages, setMessages] = useState[]>([]);
+ const [messages, setMessages] = useState([]);
const fetchPinnedMessages = async () => {
if (queryInProgress.current) {
diff --git a/examples/SampleApp/src/hooks/usePaginatedSearchedMessages.ts b/examples/SampleApp/src/hooks/usePaginatedSearchedMessages.ts
index 017f3e975d..d7c2757b29 100644
--- a/examples/SampleApp/src/hooks/usePaginatedSearchedMessages.ts
+++ b/examples/SampleApp/src/hooks/usePaginatedSearchedMessages.ts
@@ -4,16 +4,15 @@ import { useAppContext } from '../context/AppContext';
import type { MessageFilters, MessageResponse } from 'stream-chat';
-import type { StreamChatGenerics } from '../types';
import { DEFAULT_PAGINATION_LIMIT } from '../utils/constants';
export const usePaginatedSearchedMessages = (
- messageFilters: string | MessageFilters = {},
+ messageFilters: string | MessageFilters = {},
) => {
const [loading, setLoading] = useState(true);
const [refreshing, setRefreshing] = useState(false);
const [error, setError] = useState(false);
- const [messages, setMessages] = useState[]>();
+ const [messages, setMessages] = useState();
const offset = useRef(0);
const hasMoreResults = useRef(true);
const queryInProgress = useRef(false);
diff --git a/examples/SampleApp/src/hooks/usePaginatedUsers.ts b/examples/SampleApp/src/hooks/usePaginatedUsers.ts
index d36ab1c75d..3b375f4461 100644
--- a/examples/SampleApp/src/hooks/usePaginatedUsers.ts
+++ b/examples/SampleApp/src/hooks/usePaginatedUsers.ts
@@ -4,41 +4,40 @@ import { useAppContext } from '../context/AppContext';
import type { UserFilters, UserResponse } from 'stream-chat';
-import type { StreamChatGenerics } from '../types';
export type PaginatedUsers = {
clearText: () => void;
- initialResults: UserResponse[] | null;
+ initialResults: UserResponse[] | null;
loading: boolean;
loadMore: () => void;
onChangeSearchText: (newText: string) => void;
onFocusInput: () => void;
removeUser: (index: number) => void;
reset: () => void;
- results: UserResponse[];
+ results: UserResponse[];
searchText: string;
selectedUserIds: string[];
- selectedUsers: UserResponse[];
+ selectedUsers: UserResponse[];
setInitialResults: React.Dispatch<
- React.SetStateAction[] | null>
+ React.SetStateAction
>;
- setResults: React.Dispatch[]>>;
+ setResults: React.Dispatch>;
setSearchText: React.Dispatch>;
- setSelectedUsers: React.Dispatch[]>>;
- toggleUser: (user: UserResponse) => void;
+ setSelectedUsers: React.Dispatch>;
+ toggleUser: (user: UserResponse) => void;
};
export const usePaginatedUsers = (): PaginatedUsers => {
const { chatClient } = useAppContext();
- const [initialResults, setInitialResults] = useState[] | null>(
+ const [initialResults, setInitialResults] = useState(
null,
);
const [loading, setLoading] = useState(true);
- const [results, setResults] = useState[]>([]);
+ const [results, setResults] = useState([]);
const [searchText, setSearchText] = useState('');
const [selectedUserIds, setSelectedUserIds] = useState([]);
- const [selectedUsers, setSelectedUsers] = useState[]>([]);
+ const [selectedUsers, setSelectedUsers] = useState([]);
const hasMoreResults = useRef(true);
const offset = useRef(0);
@@ -51,7 +50,7 @@ export const usePaginatedUsers = (): PaginatedUsers => {
setSelectedUsers([]);
};
- const addUser = (user: UserResponse) => {
+ const addUser = (user: UserResponse) => {
setSelectedUsers([...selectedUsers, user]);
setSelectedUserIds((prevSelectedUserIds) => {
prevSelectedUserIds.push(user.id);
@@ -79,7 +78,7 @@ export const usePaginatedUsers = (): PaginatedUsers => {
});
};
- const toggleUser = (user: UserResponse) => {
+ const toggleUser = (user: UserResponse) => {
if (!user.id) {
return;
}
diff --git a/examples/SampleApp/src/screens/ChannelFilesScreen.tsx b/examples/SampleApp/src/screens/ChannelFilesScreen.tsx
index a47c9d54d1..cde55c465a 100644
--- a/examples/SampleApp/src/screens/ChannelFilesScreen.tsx
+++ b/examples/SampleApp/src/screens/ChannelFilesScreen.tsx
@@ -1,11 +1,10 @@
import React, { useEffect, useState } from 'react';
-import { SectionList, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
+import { Alert, SectionList, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import Dayjs from 'dayjs';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import {
FileIcon,
getFileSizeDisplayText,
- goToURL,
ThemeProvider,
useTheme,
} from 'stream-chat-react-native';
@@ -17,7 +16,7 @@ import { File } from '../icons/File';
import type { RouteProp } from '@react-navigation/native';
import type { Attachment } from 'stream-chat';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
+import type { StackNavigatorParamList } from '../types';
const styles = StyleSheet.create({
container: {
@@ -90,7 +89,7 @@ export const ChannelFilesScreen: React.FC = ({
const [sections, setSections] = useState<
Array<{
- data: Attachment[];
+ data: Attachment[];
title: string;
}>
>([]);
@@ -99,7 +98,7 @@ export const ChannelFilesScreen: React.FC = ({
const newSections: Record<
string,
{
- data: Attachment[];
+ data: Attachment[];
title: string;
}
> = {};
@@ -139,14 +138,16 @@ export const ChannelFilesScreen: React.FC = ({
{(sections.length > 0 || !loading) && (
- >
+
contentContainerStyle={styles.sectionContentContainer}
ListEmptyComponent={EmptyListComponent}
onEndReached={loadMore}
renderItem={({ index, item: attachment, section }) => (
goToURL(attachment.asset_url)}
+ onPress={() => {
+ Alert.alert('Not implemented.');
+ }}
style={{
borderBottomColor: border,
borderBottomWidth: index === section.data.length - 1 ? 0 : 1,
diff --git a/examples/SampleApp/src/screens/ChannelImagesScreen.tsx b/examples/SampleApp/src/screens/ChannelImagesScreen.tsx
index e1914ebc9a..fd124f72a4 100644
--- a/examples/SampleApp/src/screens/ChannelImagesScreen.tsx
+++ b/examples/SampleApp/src/screens/ChannelImagesScreen.tsx
@@ -26,7 +26,7 @@ import { Picture } from '../icons/Picture';
import type { RouteProp } from '@react-navigation/native';
import type { Attachment } from 'stream-chat';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
+import type { StackNavigatorParamList } from '../types';
const screen = Dimensions.get('screen').width;
@@ -70,7 +70,7 @@ export const ChannelImagesScreen: React.FC = ({
messages: images,
setMessages: setImages,
setSelectedMessage: setImage,
- } = useImageGalleryContext();
+ } = useImageGalleryContext();
const { setOverlay } = useOverlayContext();
const { loading, loadMore, messages } = usePaginatedAttachments(channel, 'image');
const {
@@ -110,9 +110,9 @@ export const ChannelImagesScreen: React.FC = ({
* Photos array created from all currently available
* photo attachments
*/
- const photos = messages.reduce((acc: Photo[], cur) => {
+ const photos = messages.reduce((acc: Photo[], cur) => {
const attachmentImages =
- (cur.attachments as Attachment[])?.filter(
+ (cur.attachments as Attachment[])?.filter(
(attachment) =>
attachment.type === 'image' &&
!attachment.title_link &&
@@ -151,7 +151,7 @@ export const ChannelImagesScreen: React.FC = ({
*/
const imageString = messagesWithImages
.map((message) =>
- (message.attachments as Attachment[])
+ (message.attachments as Attachment[])
.map((attachment) => attachment.image_url || attachment.thumb_url || '')
.join(),
)
diff --git a/examples/SampleApp/src/screens/ChannelListScreen.tsx b/examples/SampleApp/src/screens/ChannelListScreen.tsx
index 7662df6e58..b1aa577a47 100644
--- a/examples/SampleApp/src/screens/ChannelListScreen.tsx
+++ b/examples/SampleApp/src/screens/ChannelListScreen.tsx
@@ -1,4 +1,4 @@
-import React, { useCallback, useMemo, useRef, useState } from 'react';
+import React, { RefObject, useCallback, useMemo, useRef, useState } from 'react';
import {
FlatList,
FlatListProps,
@@ -19,8 +19,6 @@ import { usePaginatedSearchedMessages } from '../hooks/usePaginatedSearchedMessa
import type { ChannelSort } from 'stream-chat';
-import type { StreamChatGenerics } from '../types';
-
const styles = StyleSheet.create({
channelListContainer: {
height: '100%',
@@ -61,7 +59,7 @@ const baseFilters = {
type: 'messaging',
};
-const sort: ChannelSort = [
+const sort: ChannelSort = [
{ pinned_at: -1 },
{ last_message_at: -1 },
{ updated_at: -1 },
@@ -85,7 +83,7 @@ export const ChannelListScreen: React.FC = () => {
} = useTheme();
const searchInputRef = useRef(null);
- const scrollRef = useRef> | null>(null);
+ const scrollRef = useRef | null>(null);
const [searchInputText, setSearchInputText] = useState('');
const [searchQuery, setSearchQuery] = useState('');
@@ -104,7 +102,7 @@ export const ChannelListScreen: React.FC = () => {
[chatClientUserId],
);
- useScrollToTop(scrollRef);
+ useScrollToTop(scrollRef as RefObject>);
// eslint-disable-next-line react/no-unstable-nested-components
const EmptySearchIndicator = () => (
@@ -116,7 +114,7 @@ export const ChannelListScreen: React.FC = () => {
);
- const additionalFlatListProps = useMemo>>>(
+ const additionalFlatListProps = useMemo>>(
() => ({
getItemLayout: (_: unknown, index: number) => ({
index,
@@ -138,7 +136,7 @@ export const ChannelListScreen: React.FC = () => {
);
const setScrollRef = useCallback(
- () => (ref: FlatList> | null) => {
+ () => (ref: FlatList | null) => {
scrollRef.current = ref;
},
[],
@@ -217,7 +215,7 @@ export const ChannelListScreen: React.FC = () => {
)}
-
+ ;
+ channel: StreamChatChannel;
};
const ChannelHeader: React.FC = ({ channel }) => {
@@ -115,12 +115,12 @@ export const ChannelScreen: React.FC = ({
},
} = useTheme();
- const [channel, setChannel] = useState | undefined>(
+ const [channel, setChannel] = useState(
channelFromProp,
);
const [selectedThread, setSelectedThread] =
- useState['thread']>();
+ useState();
useEffect(() => {
const initChannel = async () => {
@@ -168,7 +168,7 @@ export const ChannelScreen: React.FC = ({
thread={selectedThread}
>
-
+
diff --git a/examples/SampleApp/src/screens/GroupChannelDetailsScreen.tsx b/examples/SampleApp/src/screens/GroupChannelDetailsScreen.tsx
index 77f5a8582b..2bddc63cb2 100644
--- a/examples/SampleApp/src/screens/GroupChannelDetailsScreen.tsx
+++ b/examples/SampleApp/src/screens/GroupChannelDetailsScreen.tsx
@@ -38,7 +38,7 @@ import { getUserActivityStatus } from '../utils/getUserActivityStatus';
import type { StackNavigationProp } from '@react-navigation/stack';
import type { Channel, UserResponse } from 'stream-chat';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
+import type { StackNavigatorParamList } from '../types';
import { Pin } from '../icons/Pin';
import { NewGroupIcon } from '../icons/NewGroupIcon';
@@ -177,7 +177,7 @@ export const GroupChannelDetailsScreen: React.FC = ({
const [textInputFocused, setTextInputFocused] = useState(false);
const membersStatus = useChannelMembersStatus(channel);
- const displayName = useChannelPreviewDisplayName(channel, 30);
+ const displayName = useChannelPreviewDisplayName(channel, 30);
const allMembersLength = allMembers.length;
useEffect(() => {
@@ -368,7 +368,7 @@ export const GroupChannelDetailsScreen: React.FC = ({
await channel.update({
...channel.data,
name: groupName,
- } as Parameters['update']>[0]);
+ } as Parameters[0]);
if (textInputRef.current) {
textInputRef.current.blur();
}
diff --git a/examples/SampleApp/src/screens/MentionsScreen.tsx b/examples/SampleApp/src/screens/MentionsScreen.tsx
index d1367d9dac..11c01155bd 100644
--- a/examples/SampleApp/src/screens/MentionsScreen.tsx
+++ b/examples/SampleApp/src/screens/MentionsScreen.tsx
@@ -1,4 +1,4 @@
-import React, { useMemo, useRef } from 'react';
+import React, { RefObject, useMemo, useRef } from 'react';
import { FlatList, StyleSheet, Text, View } from 'react-native';
import { AtMentions, useTheme } from 'stream-chat-react-native';
import { MessageResponse } from 'stream-chat';
@@ -12,7 +12,6 @@ import type { StackNavigationProp } from '@react-navigation/stack';
import type { BottomTabNavigatorParamList } from '../types';
import { useAppContext } from '../context/AppContext';
-import type { StreamChatGenerics } from '../types';
const styles = StyleSheet.create({
container: {
@@ -64,9 +63,9 @@ export const MentionsScreen: React.FC = () => {
[chatClient],
);
- const scrollRef = useRef> | null>(null);
+ const scrollRef = useRef | null>(null);
- useScrollToTop(scrollRef);
+ useScrollToTop(scrollRef as RefObject>);
const { loading, loadMore, messages, refreshing, refreshList } =
usePaginatedSearchedMessages(messageFilters);
diff --git a/examples/SampleApp/src/screens/NewDirectMessagingScreen.tsx b/examples/SampleApp/src/screens/NewDirectMessagingScreen.tsx
index 306f81cdb9..228129e300 100644
--- a/examples/SampleApp/src/screens/NewDirectMessagingScreen.tsx
+++ b/examples/SampleApp/src/screens/NewDirectMessagingScreen.tsx
@@ -22,7 +22,7 @@ import type { StackNavigationProp } from '@react-navigation/stack';
import type { Channel as StreamChatChannel } from 'stream-chat';
import { NewDirectMessagingSendButton } from '../components/NewDirectMessagingSendButton';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
+import type { StackNavigatorParamList } from '../types';
const styles = StyleSheet.create({
container: {
@@ -136,7 +136,7 @@ export const NewDirectMessagingScreen: React.FC =
const messageInputRef = useRef(null);
const searchInputRef = useRef(null);
- const currentChannel = useRef>();
+ const currentChannel = useRef(undefined);
const isDraft = useRef(true);
const [focusOnMessageInput, setFocusOnMessageInput] = useState(false);
@@ -163,7 +163,6 @@ export const NewDirectMessagingScreen: React.FC =
// Check if the channel already exists.
const channels = await chatClient.queryChannels({
- distinct: true,
members,
});
@@ -312,7 +311,7 @@ export const NewDirectMessagingScreen: React.FC =
},
]}
>
-
+ {
setFocusOnMessageInput(true);
diff --git a/examples/SampleApp/src/screens/SharedGroupsScreen.tsx b/examples/SampleApp/src/screens/SharedGroupsScreen.tsx
index bc082eedbb..c0c0894e97 100644
--- a/examples/SampleApp/src/screens/SharedGroupsScreen.tsx
+++ b/examples/SampleApp/src/screens/SharedGroupsScreen.tsx
@@ -18,7 +18,7 @@ import { ScreenHeader } from '../components/ScreenHeader';
import { useAppContext } from '../context/AppContext';
import { Contacts } from '../icons/Contacts';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
+import type { StackNavigatorParamList } from '../types';
const styles = StyleSheet.create({
container: {
@@ -54,7 +54,7 @@ const styles = StyleSheet.create({
},
});
-type CustomPreviewProps = ChannelPreviewMessengerProps;
+type CustomPreviewProps = ChannelPreviewMessengerProps;
const CustomPreview: React.FC = ({ channel }) => {
const { chatClient } = useAppContext();
@@ -107,16 +107,12 @@ const CustomPreview: React.FC = ({ channel }) => {
{displayAvatar.images ? (
) : (
{
);
};
-type ListComponentProps = ChannelListMessengerProps;
+type ListComponentProps = ChannelListMessengerProps;
// If the length of channels is 1, which means we only got 1:1-distinct channel,
// And we don't want to show 1:1-distinct channel in this list.
diff --git a/examples/SampleApp/src/screens/ThreadScreen.tsx b/examples/SampleApp/src/screens/ThreadScreen.tsx
index d5df5d40ff..9f7d27d75e 100644
--- a/examples/SampleApp/src/screens/ThreadScreen.tsx
+++ b/examples/SampleApp/src/screens/ThreadScreen.tsx
@@ -4,7 +4,7 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import {
Channel,
Thread,
- ThreadContextValue,
+ ThreadType,
useAttachmentPickerContext,
useTheme,
useTypingString,
@@ -15,8 +15,8 @@ import { ScreenHeader } from '../components/ScreenHeader';
import type { RouteProp } from '@react-navigation/native';
-import type { StackNavigatorParamList, StreamChatGenerics } from '../types';
-import { ThreadState } from 'stream-chat';
+import type { StackNavigatorParamList } from '../types';
+import { LocalMessage, ThreadState, UserResponse } from 'stream-chat';
const selector = (nextValue: ThreadState) => ({ parentMessage: nextValue.parentMessage }) as const;
@@ -33,20 +33,17 @@ type ThreadScreenProps = {
};
export type ThreadHeaderProps = {
- thread: ThreadContextValue['thread'];
+ thread: LocalMessage | ThreadType;
};
const ThreadHeader: React.FC = ({ thread }) => {
const typing = useTypingString();
- let subtitleText = thread?.user?.name;
+ let subtitleText = ((thread as LocalMessage)?.user as UserResponse)?.name;
const { parentMessage } =
- useStateStore(
- (thread?.threadInstance as ThreadContextValue['threadInstance'])?.state,
- selector,
- ) || {};
+ useStateStore((thread as ThreadType)?.threadInstance?.state, selector) || {};
if (subtitleText == null) {
- subtitleText = parentMessage?.user?.name;
+ subtitleText = (parentMessage?.user as UserResponse)?.name;
}
return (
@@ -78,7 +75,7 @@ export const ThreadScreen: React.FC = ({
return (
-
+ = ({
>
- />
+
diff --git a/examples/SampleApp/src/types.ts b/examples/SampleApp/src/types.ts
index 02bf4e24bf..aeec68cf85 100644
--- a/examples/SampleApp/src/types.ts
+++ b/examples/SampleApp/src/types.ts
@@ -1,39 +1,7 @@
-import type { Immutable } from 'seamless-immutable';
-import type { Channel, UserResponse } from 'stream-chat';
-import type { ThreadContextValue } from 'stream-chat-react-native';
+import type { Channel, LocalMessage, UserResponse } from 'stream-chat';
+import type { ThreadType } from 'stream-chat-react-native';
import type { Theme } from '@react-navigation/native';
-export type LocalAttachmentType = {
- file_size?: number;
- mime_type?: string;
-};
-export type LocalChannelType = Record;
-export type LocalCommandType = string & {};
-export type LocalEventType = Record;
-export type LocalMessageType = Record;
-export type LocalReactionType = Record;
-export type LocalUserType = {
- image?: string;
-};
-type LocalPollOptionType = Record;
-type LocalPollType = Record;
-type LocalMemberType = Record;
-
-export type StreamChatGenerics = {
- attachmentType: LocalAttachmentType;
- channelType: LocalChannelType;
- commandType: LocalCommandType;
- eventType: LocalEventType;
- memberType: LocalMemberType;
- messageType: LocalMessageType;
- pollOptionType: LocalPollOptionType;
- pollType: LocalPollType;
- reactionType: LocalReactionType;
- userType: LocalUserType;
-}
-
-// export type StreamChatGenerics = DefaultGenerics;
-
export type DrawerNavigatorParamList = {
HomeScreen: undefined;
UserSelectorScreen: undefined;
@@ -41,36 +9,36 @@ export type DrawerNavigatorParamList = {
export type StackNavigatorParamList = {
ChannelFilesScreen: {
- channel: Channel;
+ channel: Channel;
};
ChannelImagesScreen: {
- channel: Channel;
+ channel: Channel;
};
ChannelListScreen: undefined;
ChannelPinnedMessagesScreen: {
- channel: Channel;
+ channel: Channel;
};
ChannelScreen: {
- channel?: Channel;
+ channel?: Channel;
channelId?: string;
messageId?: string;
};
GroupChannelDetailsScreen: {
- channel: Channel;
+ channel: Channel;
};
MessagingScreen: undefined;
NewDirectMessagingScreen: undefined;
NewGroupChannelAddMemberScreen: undefined;
NewGroupChannelAssignNameScreen: undefined;
OneOnOneChannelDetailScreen: {
- channel: Channel;
+ channel: Channel;
};
SharedGroupsScreen: {
- user: Immutable> | UserResponse;
+ user: UserResponse;
};
ThreadScreen: {
- channel: Channel;
- thread: ThreadContextValue['thread'];
+ channel: Channel;
+ thread: LocalMessage | ThreadType;
};
};
diff --git a/examples/SampleApp/src/utils/RootNavigation.ts b/examples/SampleApp/src/utils/RootNavigation.ts
index 1684b85393..381ca2d436 100644
--- a/examples/SampleApp/src/utils/RootNavigation.ts
+++ b/examples/SampleApp/src/utils/RootNavigation.ts
@@ -2,7 +2,8 @@ import React from 'react';
import { CommonActions, NavigationContainerRef } from '@react-navigation/native';
import { StackNavigatorParamList } from '../types';
-export const RootNavigationRef = React.createRef();
+export const RootNavigationRef =
+ React.createRef>();
export const navigateToChannel = (channelId: string | null | undefined) => {
if (!channelId || !RootNavigationRef.current) {
@@ -27,7 +28,6 @@ export const navigateToChannel = (channelId: string | null | undefined) => {
} else {
// navigate to channel screen
return CommonActions.navigate({
- key: `${Date.now()}`,
name: 'ChannelScreen',
params: { channelId },
});
diff --git a/examples/SampleApp/src/utils/base.tsx b/examples/SampleApp/src/utils/base.tsx
index 71907384da..7c50c2bfb5 100644
--- a/examples/SampleApp/src/utils/base.tsx
+++ b/examples/SampleApp/src/utils/base.tsx
@@ -9,6 +9,7 @@ export type IconProps = Partial &
dark?: boolean;
height?: number;
width?: number;
+ scale?: number;
};
export const RootSvg = (props: IconProps) => {
const { backgroundFill = 'none', children, height = 24, width = 24 } = props;
diff --git a/examples/SampleApp/src/utils/getUserActivityStatus.ts b/examples/SampleApp/src/utils/getUserActivityStatus.ts
index d9eeeaa591..df839c08e8 100644
--- a/examples/SampleApp/src/utils/getUserActivityStatus.ts
+++ b/examples/SampleApp/src/utils/getUserActivityStatus.ts
@@ -1,15 +1,12 @@
import Dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
-import { StreamChatGenerics } from '../types';
-
-import type { Immutable } from 'seamless-immutable';
import type { UserResponse } from 'stream-chat';
Dayjs.extend(relativeTime);
export const getUserActivityStatus = (
- user?: Immutable> | UserResponse,
+ user?: UserResponse,
) => {
if (!user) {
return '';
diff --git a/examples/SampleApp/yarn.lock b/examples/SampleApp/yarn.lock
index 0fda1d1b52..098e0553c2 100644
--- a/examples/SampleApp/yarn.lock
+++ b/examples/SampleApp/yarn.lock
@@ -989,13 +989,20 @@
pirates "^4.0.6"
source-map-support "^0.5.16"
-"@babel/runtime@^7.16.3", "@babel/runtime@^7.17.2", "@babel/runtime@^7.25.0", "@babel/runtime@^7.8.4":
+"@babel/runtime@^7.17.2", "@babel/runtime@^7.25.0", "@babel/runtime@^7.8.4":
version "7.26.9"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.9.tgz#aa4c6facc65b9cb3f87d75125ffd47781b475433"
integrity sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==
dependencies:
regenerator-runtime "^0.14.0"
+"@babel/runtime@^7.27.0":
+ version "7.27.0"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762"
+ integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==
+ dependencies:
+ regenerator-runtime "^0.14.0"
+
"@babel/template@^7.25.0", "@babel/template@^7.25.9", "@babel/template@^7.26.9", "@babel/template@^7.3.3":
version "7.26.9"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.26.9.tgz#4577ad3ddf43d194528cff4e1fa6b232fa609bb2"
@@ -2558,10 +2565,10 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
-"@types/jsonwebtoken@~9.0.0":
- version "9.0.8"
- resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.8.tgz#313490052801edfb031bb32b6bbd77cc9f230852"
- integrity sha512-7fx54m60nLFUVYlxAB1xpe9CBWX2vSrk50Y6ogRJ1v5xxtba7qXTg5BgYDN5dq+yuQQ9HaVlHJyAAt1/mxryFg==
+"@types/jsonwebtoken@^9.0.8", "@types/jsonwebtoken@~9.0.0":
+ version "9.0.9"
+ resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz#a4c3a446c0ebaaf467a58398382616f416345fb3"
+ integrity sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==
dependencies:
"@types/ms" "*"
"@types/node" "*"
@@ -2616,6 +2623,13 @@
dependencies:
"@types/node" "*"
+"@types/ws@^8.5.14":
+ version "8.18.0"
+ resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.18.0.tgz#8a2ec491d6f0685ceaab9a9b7ff44146236993b5"
+ integrity sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==
+ dependencies:
+ "@types/node" "*"
+
"@types/yargs-parser@*":
version "21.0.3"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15"
@@ -5229,6 +5243,11 @@ isomorphic-ws@^4.0.1:
resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc"
integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==
+isomorphic-ws@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf"
+ integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==
+
istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756"
@@ -5768,7 +5787,7 @@ jsonfile@^4.0.0:
optionalDependencies:
graceful-fs "^4.1.6"
-jsonwebtoken@~9.0.0:
+jsonwebtoken@^9.0.2, jsonwebtoken@~9.0.0:
version "9.0.2"
resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#65ff91f4abef1784697d40952bb1998c504caaf3"
integrity sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==
@@ -5854,7 +5873,7 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
-linkifyjs@^4.1.1:
+linkifyjs@^4.1.1, linkifyjs@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.2.0.tgz#9dd30222b9cbabec9c950e725ec00031c7fa3f08"
integrity sha512-pCj3PrQyATaoTYKHrgWRF3SJwsm61udVh+vuls/Rl6SptiDhgE7ziUIudAedRY9QEfynmM7/RmLEfPUyw1HPCw==
@@ -6273,6 +6292,11 @@ mime@^2.4.1:
resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367"
integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==
+mime@^4.0.7:
+ version "4.0.7"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-4.0.7.tgz#0b7a98b08c63bd3c10251e797d67840c9bde9f13"
+ integrity sha512-2OfDPL+e03E0LrXaGYOtTFIYhiuzep94NSsuhrNULq+stylcJedcHdzHtz0atMUuGwJfFYs0YL5xeC/Ca2x0eQ==
+
mimic-fn@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
@@ -6890,6 +6914,11 @@ react-native-haptic-feedback@^2.3.3:
resolved "https://registry.yarnpkg.com/react-native-haptic-feedback/-/react-native-haptic-feedback-2.3.3.tgz#88b6876e91399a69bd1b551fe1681b2f3dc1214e"
integrity sha512-svS4D5PxfNv8o68m9ahWfwje5NqukM3qLS48+WTdhbDkNUkOhP9rDfDSRHzlhk4zq+ISjyw95EhLeh8NkKX5vQ==
+react-native-image-picker@^8.2.0:
+ version "8.2.0"
+ resolved "https://registry.yarnpkg.com/react-native-image-picker/-/react-native-image-picker-8.2.0.tgz#d8656fdd1a0f1ad262c9c129d4f75900b685e56e"
+ integrity sha512-jIGllQJuJIn0YKss/JEeb0Kos1HSsnIpU+i3bYxR27sOxSyDZQyP9dKR22olssQPlfH+rGNR/Jc6xKRkhm48vw==
+
react-native-is-edge-to-edge@1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/react-native-is-edge-to-edge/-/react-native-is-edge-to-edge-1.1.6.tgz#69ec13f70d76e9245e275eed4140d0873a78f902"
@@ -7530,10 +7559,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
-stream-chat-react-native-core@6.7.3:
- version "6.7.3"
- resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.7.3.tgz#7e213c03a7414c85ec4ba9da247d9703878ab520"
- integrity sha512-dYoYkVah7l4bmkI0vl7Ma6qD+xjsmeFWOdz7EVwbtR+B3HPMsgz8eRAmBj/p2xcSANxh1bPRD0iLlvD30vXyzg==
+stream-chat-react-native-core@6.7.4:
+ version "6.7.4"
+ resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.7.4.tgz#9709465e161e32cf358034a82c284cc16369397a"
+ integrity sha512-YCAXBfdbazFIpO1EI9Czd2QYaFCJX+i9q710L3xPB4mRuaNl2SL8kH+RTj4Ur9Fyl3u1fcDI+1o/iYnaap1Uwg==
dependencies:
"@gorhom/bottom-sheet" "^5.1.1"
dayjs "1.10.5"
@@ -7558,11 +7587,11 @@ stream-chat-react-native-core@6.7.3:
uid ""
stream-chat@^8.57.6:
- version "8.57.6"
- resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.57.6.tgz#dd3a4a0a024ee44bfa6ae7ca15648e6c9f2e498f"
- integrity sha512-+zkC5DtxvdkEBAv7dCzzO4WWosjaM15EjsH3q4xD1nX/yf2qT6BMhPJguM+CUWxwlFh32X0KR+ARtD0ChPqtnA==
+ version "8.60.0"
+ resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.60.0.tgz#b67d4fbb185da53fb8ac5fc5759986d6ad7e19a3"
+ integrity sha512-7FpO7Wno++r+n+x9aFuXtGYtNO06CIMd2Bxe3doYZLhMfS0nuaXloeFlGcMT0r4U/6bnguz1qQdDJUPNQAS8bQ==
dependencies:
- "@babel/runtime" "^7.16.3"
+ "@babel/runtime" "^7.27.0"
"@types/jsonwebtoken" "~9.0.0"
"@types/ws" "^7.4.0"
axios "^1.6.0"
@@ -7572,6 +7601,21 @@ stream-chat@^8.57.6:
jsonwebtoken "~9.0.0"
ws "^7.5.10"
+stream-chat@^9.0.0:
+ version "9.0.0"
+ resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.0.0.tgz#cb22dcb8b7f070c623a13b6b75b212d560534d6c"
+ integrity sha512-I4+/DEp7dP3WBgRmqHaLswL+Y2fyQkUWJhYBS5zx4bpu1cYM6WEir9HYjToDNuJjltqa/FFIEF/tMPWr7iTc0A==
+ dependencies:
+ "@types/jsonwebtoken" "^9.0.8"
+ "@types/ws" "^8.5.14"
+ axios "^1.6.0"
+ base64-js "^1.5.1"
+ form-data "^4.0.0"
+ isomorphic-ws "^5.0.0"
+ jsonwebtoken "^9.0.2"
+ linkifyjs "^4.2.0"
+ ws "^8.18.1"
+
strict-uri-encode@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
@@ -8223,6 +8267,11 @@ ws@^7, ws@^7.5.10:
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9"
integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==
+ws@^8.18.1:
+ version "8.18.1"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.1.tgz#ea131d3784e1dfdff91adb0a4a116b127515e3cb"
+ integrity sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==
+
y18n@^4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
diff --git a/examples/TypeScriptMessaging/App.tsx b/examples/TypeScriptMessaging/App.tsx
index 36cb7032cd..3135dd4dd7 100644
--- a/examples/TypeScriptMessaging/App.tsx
+++ b/examples/TypeScriptMessaging/App.tsx
@@ -27,30 +27,6 @@ import { AuthProgressLoader } from './AuthProgressLoader';
LogBox.ignoreAllLogs(true);
-type LocalAttachmentType = Record;
-type LocalChannelType = Record;
-type LocalCommandType = string;
-type LocalEventType = Record;
-type LocalMessageType = Record;
-type LocalReactionType = Record;
-type LocalUserType = Record;
-type LocalPollOptionType = Record;
-type LocalPollType = Record;
-type LocalMemberType = Record;
-
-type StreamChatGenerics = {
- attachmentType: LocalAttachmentType;
- channelType: LocalChannelType;
- commandType: LocalCommandType;
- eventType: LocalEventType;
- memberType: LocalMemberType;
- messageType: LocalMessageType;
- pollOptionType: LocalPollOptionType;
- pollType: LocalPollType;
- reactionType: LocalReactionType;
- userType: LocalUserType;
-};
-
const options = {
presence: true,
state: true,
@@ -77,7 +53,7 @@ const filters = {
type: 'messaging',
};
-const sort: ChannelSort = [
+const sort: ChannelSort = [
{ pinned_at: -1 },
{ last_message_at: -1 },
{ updated_at: -1 },
@@ -102,7 +78,7 @@ const ChannelListScreen: React.FC = ({ navigation }) =>
return (
-
+ {
setChannel(channel);
@@ -150,7 +126,7 @@ const ChannelScreen: React.FC = ({ navigation }) => {
thread={thread}
>
-
+ {
setThread(selectedThread);
if (channel?.id) {
@@ -200,7 +176,7 @@ const ThreadScreen: React.FC = ({ navigation }) => {
justifyContent: 'flex-start',
}}
>
- onThreadDismount={() => setThread(null)} />
+ setThread(null)} />
@@ -215,12 +191,12 @@ type NavigationParamsList = ChannelRoute & ChannelListRoute & ThreadRoute;
const Stack = createStackNavigator();
type AppContextType = {
- channel: ChannelType | undefined;
- setChannel: React.Dispatch | undefined>>;
+ channel: ChannelType | undefined;
+ setChannel: React.Dispatch>;
setThread: React.Dispatch<
- React.SetStateAction['thread'] | undefined>
+ React.SetStateAction
>;
- thread: ThreadContextValue['thread'] | undefined;
+ thread: ThreadContextValue['thread'] | undefined;
};
const AppContext = React.createContext({} as AppContextType);
@@ -241,7 +217,7 @@ const App = () => {
}
return (
-
+ {
};
export default () => {
- const [channel, setChannel] = useState>();
- const [thread, setThread] = useState['thread']>();
+ const [channel, setChannel] = useState();
+ const [thread, setThread] = useState();
const theme = useStreamChatTheme();
const colorScheme = useColorScheme();
diff --git a/examples/TypeScriptMessaging/custom-types.d.ts b/examples/TypeScriptMessaging/custom-types.d.ts
new file mode 100644
index 0000000000..e6400ab92a
--- /dev/null
+++ b/examples/TypeScriptMessaging/custom-types.d.ts
@@ -0,0 +1,41 @@
+import {
+ DefaultAttachmentData,
+ DefaultChannelData,
+ DefaultCommandData,
+ DefaultEventData,
+ DefaultMemberData,
+ DefaultMessageData,
+ DefaultPollData,
+ DefaultPollOptionData,
+ DefaultReactionData,
+ DefaultThreadData,
+ DefaultUserData,
+} from 'stream-chat-react-native';
+
+declare module 'stream-chat' {
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
+
+ interface CustomAttachmentData extends DefaultAttachmentData {}
+
+ interface CustomChannelData extends DefaultChannelData {}
+
+ interface CustomCommandData extends DefaultCommandData {}
+
+ interface CustomEventData extends DefaultEventData {}
+
+ interface CustomMemberData extends DefaultMemberData {}
+
+ interface CustomUserData extends DefaultUserData {}
+
+ interface CustomMessageData extends DefaultMessageData {}
+
+ interface CustomPollOptionData extends DefaultPollOptionData {}
+
+ interface CustomPollData extends DefaultPollData {}
+
+ interface CustomReactionData extends DefaultReactionData {}
+
+ interface CustomThreadData extends DefaultThreadData {}
+
+ /* eslint-enable @typescript-eslint/no-empty-object-type */
+}
diff --git a/examples/TypeScriptMessaging/useStreamChatTheme.ts b/examples/TypeScriptMessaging/useStreamChatTheme.ts
index 8c64521d70..0802c9ce30 100644
--- a/examples/TypeScriptMessaging/useStreamChatTheme.ts
+++ b/examples/TypeScriptMessaging/useStreamChatTheme.ts
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { useColorScheme } from 'react-native';
import type { DeepPartial, Theme } from 'stream-chat-react-native';
-const getChatStyle = (colorScheme: string): DeepPartial => ({
+const getChatStyle = (colorScheme: string | null | undefined): DeepPartial => ({
avatar: {
image: {
height: 32,
diff --git a/examples/TypeScriptMessaging/yarn.lock b/examples/TypeScriptMessaging/yarn.lock
index 6d93580f89..96279a2958 100644
--- a/examples/TypeScriptMessaging/yarn.lock
+++ b/examples/TypeScriptMessaging/yarn.lock
@@ -989,13 +989,20 @@
pirates "^4.0.6"
source-map-support "^0.5.16"
-"@babel/runtime@^7.16.3", "@babel/runtime@^7.17.2", "@babel/runtime@^7.25.0", "@babel/runtime@^7.8.4":
+"@babel/runtime@^7.17.2", "@babel/runtime@^7.25.0", "@babel/runtime@^7.8.4":
version "7.26.9"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.9.tgz#aa4c6facc65b9cb3f87d75125ffd47781b475433"
integrity sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==
dependencies:
regenerator-runtime "^0.14.0"
+"@babel/runtime@^7.27.0":
+ version "7.27.0"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762"
+ integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==
+ dependencies:
+ regenerator-runtime "^0.14.0"
+
"@babel/template@^7.25.0", "@babel/template@^7.25.9", "@babel/template@^7.26.9", "@babel/template@^7.3.3":
version "7.26.9"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.26.9.tgz#4577ad3ddf43d194528cff4e1fa6b232fa609bb2"
@@ -2047,10 +2054,10 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
-"@types/jsonwebtoken@~9.0.0":
- version "9.0.8"
- resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.8.tgz#313490052801edfb031bb32b6bbd77cc9f230852"
- integrity sha512-7fx54m60nLFUVYlxAB1xpe9CBWX2vSrk50Y6ogRJ1v5xxtba7qXTg5BgYDN5dq+yuQQ9HaVlHJyAAt1/mxryFg==
+"@types/jsonwebtoken@^9.0.8", "@types/jsonwebtoken@~9.0.0":
+ version "9.0.9"
+ resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz#a4c3a446c0ebaaf467a58398382616f416345fb3"
+ integrity sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==
dependencies:
"@types/ms" "*"
"@types/node" "*"
@@ -2105,6 +2112,13 @@
dependencies:
"@types/node" "*"
+"@types/ws@^8.5.14":
+ version "8.18.0"
+ resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.18.0.tgz#8a2ec491d6f0685ceaab9a9b7ff44146236993b5"
+ integrity sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==
+ dependencies:
+ "@types/node" "*"
+
"@types/yargs-parser@*":
version "21.0.3"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15"
@@ -4662,6 +4676,11 @@ isomorphic-ws@^4.0.1:
resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc"
integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==
+isomorphic-ws@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf"
+ integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==
+
istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756"
@@ -5201,7 +5220,7 @@ jsonfile@^4.0.0:
optionalDependencies:
graceful-fs "^4.1.6"
-jsonwebtoken@~9.0.0:
+jsonwebtoken@^9.0.2, jsonwebtoken@~9.0.0:
version "9.0.2"
resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#65ff91f4abef1784697d40952bb1998c504caaf3"
integrity sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==
@@ -5287,7 +5306,7 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
-linkifyjs@^4.1.1:
+linkifyjs@^4.1.1, linkifyjs@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.2.0.tgz#9dd30222b9cbabec9c950e725ec00031c7fa3f08"
integrity sha512-pCj3PrQyATaoTYKHrgWRF3SJwsm61udVh+vuls/Rl6SptiDhgE7ziUIudAedRY9QEfynmM7/RmLEfPUyw1HPCw==
@@ -5689,6 +5708,11 @@ mime@^2.4.1:
resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367"
integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==
+mime@^4.0.7:
+ version "4.0.7"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-4.0.7.tgz#0b7a98b08c63bd3c10251e797d67840c9bde9f13"
+ integrity sha512-2OfDPL+e03E0LrXaGYOtTFIYhiuzep94NSsuhrNULq+stylcJedcHdzHtz0atMUuGwJfFYs0YL5xeC/Ca2x0eQ==
+
mimic-fn@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
@@ -6921,10 +6945,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
-stream-chat-react-native-core@6.6.8:
- version "6.6.8"
- resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.6.8.tgz#483ade63ba051426480ab2dfd8ab3b248b90ae88"
- integrity sha512-F8S70DHaiit6BEdKOkSMHq2bjMONhrouvJ+szBQuE430EJDgUlc2VErHk3yJCzqIt5lwfVZktjHuqSIOGVg5LQ==
+stream-chat-react-native-core@6.7.4:
+ version "6.7.4"
+ resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.7.4.tgz#9709465e161e32cf358034a82c284cc16369397a"
+ integrity sha512-YCAXBfdbazFIpO1EI9Czd2QYaFCJX+i9q710L3xPB4mRuaNl2SL8kH+RTj4Ur9Fyl3u1fcDI+1o/iYnaap1Uwg==
dependencies:
"@gorhom/bottom-sheet" "^5.1.1"
dayjs "1.10.5"
@@ -6949,11 +6973,11 @@ stream-chat-react-native-core@6.6.8:
uid ""
stream-chat@^8.57.6:
- version "8.57.6"
- resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.57.6.tgz#dd3a4a0a024ee44bfa6ae7ca15648e6c9f2e498f"
- integrity sha512-+zkC5DtxvdkEBAv7dCzzO4WWosjaM15EjsH3q4xD1nX/yf2qT6BMhPJguM+CUWxwlFh32X0KR+ARtD0ChPqtnA==
+ version "8.60.0"
+ resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.60.0.tgz#b67d4fbb185da53fb8ac5fc5759986d6ad7e19a3"
+ integrity sha512-7FpO7Wno++r+n+x9aFuXtGYtNO06CIMd2Bxe3doYZLhMfS0nuaXloeFlGcMT0r4U/6bnguz1qQdDJUPNQAS8bQ==
dependencies:
- "@babel/runtime" "^7.16.3"
+ "@babel/runtime" "^7.27.0"
"@types/jsonwebtoken" "~9.0.0"
"@types/ws" "^7.4.0"
axios "^1.6.0"
@@ -6963,6 +6987,21 @@ stream-chat@^8.57.6:
jsonwebtoken "~9.0.0"
ws "^7.5.10"
+stream-chat@^9.0.0:
+ version "9.0.0"
+ resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.0.0.tgz#cb22dcb8b7f070c623a13b6b75b212d560534d6c"
+ integrity sha512-I4+/DEp7dP3WBgRmqHaLswL+Y2fyQkUWJhYBS5zx4bpu1cYM6WEir9HYjToDNuJjltqa/FFIEF/tMPWr7iTc0A==
+ dependencies:
+ "@types/jsonwebtoken" "^9.0.8"
+ "@types/ws" "^8.5.14"
+ axios "^1.6.0"
+ base64-js "^1.5.1"
+ form-data "^4.0.0"
+ isomorphic-ws "^5.0.0"
+ jsonwebtoken "^9.0.2"
+ linkifyjs "^4.2.0"
+ ws "^8.18.1"
+
strict-uri-encode@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
@@ -7595,6 +7634,11 @@ ws@^7, ws@^7.5.10:
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9"
integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==
+ws@^8.18.1:
+ version "8.18.1"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.1.tgz#ea131d3784e1dfdff91adb0a4a116b127515e3cb"
+ integrity sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==
+
y18n@^4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
diff --git a/package/CHANGELOG.md b/package/CHANGELOG.md
index 2432911297..23f9bf9742 100644
--- a/package/CHANGELOG.md
+++ b/package/CHANGELOG.md
@@ -418,6 +418,7 @@
### [5.39.3](https://github.com/GetStream/stream-chat-react-native/compare/v5.39.2...v5.39.3) (2024-10-15)
+
### Bug Fixes
- ChannelAvatar crash when used outside of ChannelList ([#2708](https://github.com/GetStream/stream-chat-react-native/issues/2708)) ([85f4ab2](https://github.com/GetStream/stream-chat-react-native/commit/85f4ab21adf4b0da636475f0285e3360d9b1309b))
diff --git a/package/expo-package/package.json b/package/expo-package/package.json
index 9a0d1eb208..c0080f8f57 100644
--- a/package/expo-package/package.json
+++ b/package/expo-package/package.json
@@ -10,6 +10,7 @@
"main": "src/index.js",
"types": "types/index.d.ts",
"dependencies": {
+ "mime": "^4.0.7",
"stream-chat-react-native-core": "6.7.4"
},
"peerDependencies": {
@@ -22,12 +23,16 @@
"expo-image-manipulator": "*",
"expo-image-picker": "*",
"expo-media-library": "*",
- "expo-sharing": "*"
+ "expo-sharing": "*",
+ "expo-video": "*"
},
"peerDependenciesMeta": {
"expo-av": {
"optional": true
},
+ "expo-video": {
+ "optional": true
+ },
"expo-clipboard": {
"optional": true
},
diff --git a/package/expo-package/src/optionalDependencies/AudioVideo.ts b/package/expo-package/src/optionalDependencies/AudioVideo.ts
index 4505c97b69..486a47842f 100644
--- a/package/expo-package/src/optionalDependencies/AudioVideo.ts
+++ b/package/expo-package/src/optionalDependencies/AudioVideo.ts
@@ -1,19 +1,17 @@
-let VideoComponent;
let AudioComponent;
let RecordingObject;
try {
const audioVideoPackage = require('expo-av');
- VideoComponent = audioVideoPackage.Video;
AudioComponent = audioVideoPackage.Audio;
RecordingObject = audioVideoPackage.RecordingObject;
} catch (e) {
// do nothing
}
-if (!VideoComponent || !AudioComponent) {
+if (!AudioComponent) {
console.log(
- 'Audio Video library is currently not installed. To allow in-app audio or video playback, install the "expo-av" package.',
+ 'Audio Video library is currently not installed. To allow in-app audio playback, install the "expo-av" package.',
);
}
-export { AudioComponent, VideoComponent, RecordingObject };
+export { AudioComponent, RecordingObject };
diff --git a/package/expo-package/src/optionalDependencies/Video.tsx b/package/expo-package/src/optionalDependencies/Video.tsx
index ee56a3da2e..28876d528d 100644
--- a/package/expo-package/src/optionalDependencies/Video.tsx
+++ b/package/expo-package/src/optionalDependencies/Video.tsx
@@ -1,28 +1,71 @@
import React, { useEffect } from 'react';
-import { AudioComponent, VideoComponent } from './AudioVideo';
+import { useEventListener } from 'expo';
+
+import { AudioComponent } from './AudioVideo';
+
+let videoPackage;
+
+try {
+ videoPackage = require('expo-video');
+} catch (e) {
+ // do nothing
+}
+
+if (!videoPackage) {
+ console.log(
+ 'The video library is currently not installed. To allow in-app video playback, install the "expo-video" package.',
+ );
+}
+
+const VideoComponent = videoPackage ? videoPackage.VideoView : null;
+const useVideoPlayer = videoPackage ? videoPackage.useVideoPlayer : null;
+
+export const Video = videoPackage
+ ? ({ onLoadStart, onLoad, onEnd, onProgress, onBuffer, resizeMode, style, uri, videoRef }) => {
+ const player = useVideoPlayer(uri, (player) => {
+ player.timeUpdateEventInterval = 0.5;
+ videoRef.current = player;
+ });
+
+ useEventListener(player, 'statusChange', ({ status, oldStatus }) => {
+ if ((!oldStatus || oldStatus === 'idle') && status === 'loading') {
+ onLoadStart();
+ } else if ((oldStatus === 'loading' || oldStatus === 'idle') && status === 'readyToPlay') {
+ onLoad({ duration: player.duration });
+ onBuffer({ buffering: false });
+ } else if (oldStatus === 'readyToPlay' && status === 'loading') {
+ onBuffer({ buffering: true });
+ }
+ });
+
+ useEventListener(player, 'playToEnd', () => {
+ player.replay();
+ onEnd();
+ });
+
+ useEventListener(player, 'timeUpdate', ({ currentTime }) =>
+ onProgress({ currentTime, seekableDuration: player.duration }),
+ );
-export const Video = VideoComponent
- ? ({ onPlaybackStatusUpdate, paused, resizeMode, style, uri, videoRef }) => {
// This is done so that the audio of the video is not muted when the phone is in silent mode for iOS.
useEffect(() => {
const initializeSound = async () => {
- await AudioComponent.setAudioModeAsync({
- playsInSilentModeIOS: true,
- });
+ if (AudioComponent) {
+ await AudioComponent.setAudioModeAsync({
+ playsInSilentModeIOS: true,
+ });
+ }
};
initializeSound();
}, []);
return (
);
diff --git a/package/expo-package/src/optionalDependencies/getPhotos.ts b/package/expo-package/src/optionalDependencies/getPhotos.ts
index cd858364a2..c8f244a04a 100644
--- a/package/expo-package/src/optionalDependencies/getPhotos.ts
+++ b/package/expo-package/src/optionalDependencies/getPhotos.ts
@@ -1,4 +1,7 @@
import { Platform } from 'react-native';
+import mime from 'mime';
+
+import type { File } from 'stream-chat-react-native-core';
let MediaLibrary;
@@ -13,12 +16,11 @@ if (!MediaLibrary) {
'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
);
}
-import type { Asset } from 'stream-chat-react-native-core';
import { getLocalAssetUri } from './getLocalAssetUri';
type ReturnType = {
- assets: Array & { source: 'picker' }>;
+ assets: File[];
endCursor: string | undefined;
hasNextPage: boolean;
iOSLimited: boolean;
@@ -52,14 +54,13 @@ export const getPhotos = MediaLibrary
const assets = await Promise.all(
results.assets.map(async (asset) => {
const localUri = await getLocalAssetUri(asset.id);
+ const mimeType = mime.getType(asset.filename);
return {
duration: asset.duration * 1000,
height: asset.height,
- id: asset.id,
name: asset.filename,
- originalUri: asset.uri,
- source: 'picker' as const,
- type: asset.mediaType,
+ thumb_url: asset.mediaType === 'photo' ? undefined : asset.uri,
+ type: mimeType,
uri: localUri || asset.uri,
width: asset.width,
};
diff --git a/package/expo-package/src/optionalDependencies/pickDocument.ts b/package/expo-package/src/optionalDependencies/pickDocument.ts
index 6c12ebe74b..5071c8d729 100644
--- a/package/expo-package/src/optionalDependencies/pickDocument.ts
+++ b/package/expo-package/src/optionalDependencies/pickDocument.ts
@@ -38,13 +38,21 @@ export const pickDocument = DocumentPicker
// Applicable to latest version of expo-document-picker
if (assets) {
return {
- assets,
+ assets: assets.map((asset) => ({
+ ...asset,
+ type: asset.mimeType,
+ })),
cancelled: false,
};
}
// Applicable to older version of expo-document-picker
return {
- assets: [rest],
+ assets: [
+ {
+ ...rest,
+ type: rest.mimeType,
+ },
+ ],
cancelled: false,
};
} catch (err) {
diff --git a/package/expo-package/src/optionalDependencies/pickImage.ts b/package/expo-package/src/optionalDependencies/pickImage.ts
index 6b3df6e6af..25ef02f531 100644
--- a/package/expo-package/src/optionalDependencies/pickImage.ts
+++ b/package/expo-package/src/optionalDependencies/pickImage.ts
@@ -45,11 +45,10 @@ export const pickImage = ImagePicker
duration: asset.duration,
name: asset.fileName,
size: asset.fileSize,
- source: 'picker',
type: asset.mimeType,
uri: asset.uri,
}));
- return { assets, cancelled: false, source: 'picker' };
+ return { assets, cancelled: false };
} else {
return { cancelled: true };
}
diff --git a/package/expo-package/src/optionalDependencies/takePhoto.ts b/package/expo-package/src/optionalDependencies/takePhoto.ts
index 6baec01d2a..53580644ed 100644
--- a/package/expo-package/src/optionalDependencies/takePhoto.ts
+++ b/package/expo-package/src/optionalDependencies/takePhoto.ts
@@ -63,7 +63,6 @@ export const takePhoto = ImagePicker
duration: photo.duration, // in milliseconds
name: 'video_recording_' + date + '.' + photo.uri.split('.').pop(),
size: photo.fileSize,
- source: 'camera',
type: photo.mimeType,
uri: photo.uri,
};
@@ -95,10 +94,8 @@ export const takePhoto = ImagePicker
const date = new Date().toISOString().replace(clearFilter, '_');
return {
cancelled: false,
- mimeType: photo.mimeType,
name: 'image_' + date + '.' + photo.uri.split('.').pop(),
size: photo.fileSize,
- source: 'camera',
type: photo.mimeType,
uri: photo.uri,
...size,
diff --git a/package/expo-package/yarn.lock b/package/expo-package/yarn.lock
index 76edabf830..3b073df7e5 100644
--- a/package/expo-package/yarn.lock
+++ b/package/expo-package/yarn.lock
@@ -1094,13 +1094,6 @@
pirates "^4.0.6"
source-map-support "^0.5.16"
-"@babel/runtime@^7.16.3":
- version "7.22.3"
- resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.3.tgz#0a7fce51d43adbf0f7b517a71f4c3aaca92ebcbb"
- integrity sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==
- dependencies:
- regenerator-runtime "^0.13.11"
-
"@babel/runtime@^7.17.2", "@babel/runtime@^7.20.0":
version "7.24.7"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.7.tgz#f4f0d5530e8dbdf59b3451b9b3e594b6ba082e12"
@@ -1108,6 +1101,13 @@
dependencies:
regenerator-runtime "^0.14.0"
+"@babel/runtime@^7.27.0":
+ version "7.27.0"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762"
+ integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==
+ dependencies:
+ regenerator-runtime "^0.14.0"
+
"@babel/runtime@^7.8.4":
version "7.26.9"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.9.tgz#aa4c6facc65b9cb3f87d75125ffd47781b475433"
@@ -1796,12 +1796,18 @@
integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==
"@types/jsonwebtoken@~9.0.0":
- version "9.0.2"
- resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#9eeb56c76dd555039be2a3972218de5bd3b8d83e"
- integrity sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==
+ version "9.0.9"
+ resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz#a4c3a446c0ebaaf467a58398382616f416345fb3"
+ integrity sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==
dependencies:
+ "@types/ms" "*"
"@types/node" "*"
+"@types/ms@*":
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-2.1.0.tgz#052aa67a48eccc4309d7f0191b7e41434b90bb78"
+ integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==
+
"@types/node-forge@^1.3.0":
version "1.3.11"
resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da"
@@ -3462,14 +3468,20 @@ jsonfile@^6.0.1:
graceful-fs "^4.1.6"
jsonwebtoken@~9.0.0:
- version "9.0.0"
- resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz#d0faf9ba1cc3a56255fe49c0961a67e520c1926d"
- integrity sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==
+ version "9.0.2"
+ resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#65ff91f4abef1784697d40952bb1998c504caaf3"
+ integrity sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==
dependencies:
jws "^3.2.2"
- lodash "^4.17.21"
+ lodash.includes "^4.3.0"
+ lodash.isboolean "^3.0.3"
+ lodash.isinteger "^4.0.4"
+ lodash.isnumber "^3.0.3"
+ lodash.isplainobject "^4.0.6"
+ lodash.isstring "^4.0.1"
+ lodash.once "^4.0.0"
ms "^2.1.1"
- semver "^7.3.8"
+ semver "^7.5.4"
jwa@^1.4.1:
version "1.4.1"
@@ -3609,6 +3621,41 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==
+lodash.includes@^4.3.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f"
+ integrity sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==
+
+lodash.isboolean@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6"
+ integrity sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==
+
+lodash.isinteger@^4.0.4:
+ version "4.0.4"
+ resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343"
+ integrity sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==
+
+lodash.isnumber@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc"
+ integrity sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==
+
+lodash.isplainobject@^4.0.6:
+ version "4.0.6"
+ resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
+ integrity sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==
+
+lodash.isstring@^4.0.1:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
+ integrity sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==
+
+lodash.once@^4.0.0:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
+ integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==
+
lodash@^4.17.15, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
@@ -3719,6 +3766,11 @@ mime@1.6.0:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
+mime@^4.0.7:
+ version "4.0.7"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-4.0.7.tgz#0b7a98b08c63bd3c10251e797d67840c9bde9f13"
+ integrity sha512-2OfDPL+e03E0LrXaGYOtTFIYhiuzep94NSsuhrNULq+stylcJedcHdzHtz0atMUuGwJfFYs0YL5xeC/Ca2x0eQ==
+
mimic-fn@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
@@ -4343,11 +4395,6 @@ regenerate@^1.4.2:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a"
integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==
-regenerator-runtime@^0.13.11:
- version "0.13.11"
- resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
- integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
-
regenerator-runtime@^0.14.0:
version "0.14.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f"
@@ -4532,7 +4579,7 @@ semver@^6.3.1:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==
-semver@^7.3.5, semver@^7.3.8:
+semver@^7.3.5:
version "7.5.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.1.tgz#c90c4d631cf74720e46b21c1d37ea07edfab91ec"
integrity sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==
@@ -4733,10 +4780,10 @@ stream-buffers@2.2.x, stream-buffers@~2.2.0:
resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4"
integrity sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg==
-stream-chat-react-native-core@6.7.3:
- version "6.7.3"
- resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.7.3.tgz#7e213c03a7414c85ec4ba9da247d9703878ab520"
- integrity sha512-dYoYkVah7l4bmkI0vl7Ma6qD+xjsmeFWOdz7EVwbtR+B3HPMsgz8eRAmBj/p2xcSANxh1bPRD0iLlvD30vXyzg==
+stream-chat-react-native-core@6.7.4:
+ version "6.7.4"
+ resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.7.4.tgz#9709465e161e32cf358034a82c284cc16369397a"
+ integrity sha512-YCAXBfdbazFIpO1EI9Czd2QYaFCJX+i9q710L3xPB4mRuaNl2SL8kH+RTj4Ur9Fyl3u1fcDI+1o/iYnaap1Uwg==
dependencies:
"@gorhom/bottom-sheet" "^5.1.1"
dayjs "1.10.5"
@@ -4753,11 +4800,11 @@ stream-chat-react-native-core@6.7.3:
use-sync-external-store "^1.4.0"
stream-chat@^8.57.6:
- version "8.57.6"
- resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.57.6.tgz#dd3a4a0a024ee44bfa6ae7ca15648e6c9f2e498f"
- integrity sha512-+zkC5DtxvdkEBAv7dCzzO4WWosjaM15EjsH3q4xD1nX/yf2qT6BMhPJguM+CUWxwlFh32X0KR+ARtD0ChPqtnA==
+ version "8.60.0"
+ resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.60.0.tgz#b67d4fbb185da53fb8ac5fc5759986d6ad7e19a3"
+ integrity sha512-7FpO7Wno++r+n+x9aFuXtGYtNO06CIMd2Bxe3doYZLhMfS0nuaXloeFlGcMT0r4U/6bnguz1qQdDJUPNQAS8bQ==
dependencies:
- "@babel/runtime" "^7.16.3"
+ "@babel/runtime" "^7.27.0"
"@types/jsonwebtoken" "~9.0.0"
"@types/ws" "^7.4.0"
axios "^1.6.0"
diff --git a/package/native-package/package.json b/package/native-package/package.json
index dd67073fa9..4ad8f4e23f 100644
--- a/package/native-package/package.json
+++ b/package/native-package/package.json
@@ -20,17 +20,17 @@
"types": "types/index.d.ts",
"dependencies": {
"es6-symbol": "^3.1.3",
+ "mime": "^4.0.7",
"stream-chat-react-native-core": "6.7.4"
},
"peerDependencies": {
"@react-native-camera-roll/camera-roll": ">=7.8.0",
"@react-native-clipboard/clipboard": ">=1.14.1",
+ "@react-native-documents/picker": ">=10.1.1",
"@stream-io/flat-list-mvcp": ">=0.10.3",
- "react-native": ">=0.67.0",
+ "react-native": ">=0.71.0",
"react-native-audio-recorder-player": ">=3.6.4",
"react-native-blob-util": ">=0.19.9",
- "react-native-document-picker": ">=9.3.0",
- "@react-native-documents/picker": ">=10.1.1",
"react-native-haptic-feedback": ">=2.2.0",
"react-native-image-picker": ">=7.1.2",
"react-native-share": ">=10.2.1",
@@ -49,9 +49,6 @@
"react-native-share": {
"optional": true
},
- "react-native-document-picker": {
- "optional": true
- },
"@react-native-documents/picker": {
"optional": true
},
diff --git a/package/native-package/src/optionalDependencies/getPhotos.ts b/package/native-package/src/optionalDependencies/getPhotos.ts
index bfbf051d37..0b1c0d22c9 100644
--- a/package/native-package/src/optionalDependencies/getPhotos.ts
+++ b/package/native-package/src/optionalDependencies/getPhotos.ts
@@ -1,4 +1,7 @@
import { PermissionsAndroid, Platform } from 'react-native';
+import mime from 'mime';
+
+import type { File } from 'stream-chat-react-native-core';
let CameraRollDependency;
@@ -11,12 +14,10 @@ try {
);
}
-import type { Asset } from 'stream-chat-react-native-core';
-
import { getLocalAssetUri } from './getLocalAssetUri';
type ReturnType = {
- assets: Array & { source: 'picker' }>;
+ assets: File[];
endCursor: string | undefined;
hasNextPage: boolean;
iOSLimited: boolean;
@@ -90,16 +91,22 @@ export const getPhotos = CameraRollDependency
const assets = await Promise.all(
results.edges.map(async (edge) => {
const originalUri = edge.node?.image?.uri;
- const uri = getLocalAssetUri ? await getLocalAssetUri(originalUri) : originalUri;
+ const type =
+ Platform.OS === 'ios'
+ ? mime.getType(edge.node.image.filename as string)
+ : edge.node.type;
+ const isImage = type.includes('image');
+
+ const uri =
+ isImage && getLocalAssetUri ? await getLocalAssetUri(originalUri) : originalUri;
+
return {
...edge.node.image,
- duration: edge.node.image.playableDuration * 1000,
- // since we include filename, fileSize in the query, we can safely assume it will be defined
name: edge.node.image.filename as string,
- originalUri,
+ duration: edge.node.image.playableDuration * 1000,
+ thumb_url: isImage ? undefined : originalUri,
size: edge.node.image.fileSize as number,
- source: 'picker' as const,
- type: edge.node.type,
+ type,
uri,
};
}),
diff --git a/package/native-package/src/optionalDependencies/pickDocument.ts b/package/native-package/src/optionalDependencies/pickDocument.ts
index a0bab9279b..42aebe01bb 100644
--- a/package/native-package/src/optionalDependencies/pickDocument.ts
+++ b/package/native-package/src/optionalDependencies/pickDocument.ts
@@ -1,7 +1,7 @@
/**
* Types are approximated from what we need from the DocumentPicker API.
*
- * For its full API, see https://github.com/rnmods/react-native-document-picker/blob/master/src/index.tsx
+ * For its full API, see https://github.com/react-native-documents/document-picker/blob/main/packages/document-picker/src/index.ts
* */
type ResponseValue = {
name: string;
@@ -19,31 +19,12 @@ type DocumentPickerType =
let DocumentPicker: DocumentPickerType;
-let OldDocumentPicker: DocumentPickerType;
-let NewDocumentPicker: DocumentPickerType;
-
-try {
- NewDocumentPicker = require('@react-native-documents/picker');
-} catch (err) {
- // we log below
-}
-
try {
- OldDocumentPicker = require('react-native-document-picker').default;
+ DocumentPicker = require('@react-native-documents/picker');
} catch (err) {
- // we log below
-}
-
-if (NewDocumentPicker) {
- DocumentPicker = NewDocumentPicker;
-} else if (OldDocumentPicker) {
- DocumentPicker = OldDocumentPicker;
- console.log(
- "You're using the react-native-document-picker library, which is no longer supported and has moved to @react-native-documents/picker. Things might not work as intended. Please migrate to the new library as soon as possible !",
- );
-} else {
+ // do nothing
console.log(
- 'Neither react-native-document-picker nor @react-native-documents/picker are installed.',
+ 'The @react-native-documents/picker is not installed. Installing it will enable you to pick and upload files from within your app.',
);
}
@@ -62,9 +43,9 @@ export const pickDocument = DocumentPicker
return {
assets: res.map(({ name, size, type, uri }) => ({
- mimeType: type,
name,
size,
+ type,
uri,
})),
cancelled: false,
diff --git a/package/native-package/src/optionalDependencies/pickImage.ts b/package/native-package/src/optionalDependencies/pickImage.ts
index 770319b285..1d04e68753 100644
--- a/package/native-package/src/optionalDependencies/pickImage.ts
+++ b/package/native-package/src/optionalDependencies/pickImage.ts
@@ -26,11 +26,10 @@ export const pickImage = ImagePicker
duration: asset.duration ? asset.duration * 1000 : undefined, // in milliseconds
name: asset.fileName,
size: asset.fileSize,
- source: 'picker',
type: asset.type,
uri: asset.uri,
}));
- return { assets, cancelled: false, source: 'picker' };
+ return { assets, cancelled: false };
} else {
return { cancelled: true };
}
diff --git a/package/native-package/src/optionalDependencies/takePhoto.ts b/package/native-package/src/optionalDependencies/takePhoto.ts
index 477841ddc1..914dec735b 100644
--- a/package/native-package/src/optionalDependencies/takePhoto.ts
+++ b/package/native-package/src/optionalDependencies/takePhoto.ts
@@ -53,10 +53,8 @@ export const takePhoto = ImagePicker
...asset,
cancelled: false,
duration: asset.duration * 1000,
- mimeType: asset.type,
name: 'video_recording_' + date + '.' + asset.fileName.split('.').pop(),
size: asset.fileSize,
- source: 'camera',
type: asset.type,
uri: asset.uri,
};
@@ -90,10 +88,8 @@ export const takePhoto = ImagePicker
const date = new Date().toISOString().replace(clearFilter, '_');
return {
cancelled: false,
- mimeType: asset.type,
name: 'video_recording_' + date + '.' + asset.fileName.split('.').pop(),
size: asset.size,
- source: 'camera',
type: asset.type,
uri: asset.uri,
...size,
diff --git a/package/native-package/yarn.lock b/package/native-package/yarn.lock
index 42037de3b3..91c31ab4ef 100644
--- a/package/native-package/yarn.lock
+++ b/package/native-package/yarn.lock
@@ -759,13 +759,6 @@
pirates "^4.0.6"
source-map-support "^0.5.16"
-"@babel/runtime@^7.16.3":
- version "7.22.3"
- resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.3.tgz#0a7fce51d43adbf0f7b517a71f4c3aaca92ebcbb"
- integrity sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==
- dependencies:
- regenerator-runtime "^0.13.11"
-
"@babel/runtime@^7.17.2":
version "7.24.7"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.7.tgz#f4f0d5530e8dbdf59b3451b9b3e594b6ba082e12"
@@ -780,6 +773,13 @@
dependencies:
regenerator-runtime "^0.14.0"
+"@babel/runtime@^7.27.0":
+ version "7.27.0"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762"
+ integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==
+ dependencies:
+ regenerator-runtime "^0.14.0"
+
"@babel/runtime@^7.8.4":
version "7.25.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.0.tgz#3af9a91c1b739c569d5d80cc917280919c544ecb"
@@ -1253,12 +1253,18 @@
"@types/istanbul-lib-report" "*"
"@types/jsonwebtoken@~9.0.0":
- version "9.0.2"
- resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#9eeb56c76dd555039be2a3972218de5bd3b8d83e"
- integrity sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==
+ version "9.0.9"
+ resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz#a4c3a446c0ebaaf467a58398382616f416345fb3"
+ integrity sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==
dependencies:
+ "@types/ms" "*"
"@types/node" "*"
+"@types/ms@*":
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-2.1.0.tgz#052aa67a48eccc4309d7f0191b7e41434b90bb78"
+ integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==
+
"@types/node-forge@^1.3.0":
version "1.3.11"
resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da"
@@ -2422,14 +2428,20 @@ json5@^2.2.3:
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
jsonwebtoken@~9.0.0:
- version "9.0.0"
- resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz#d0faf9ba1cc3a56255fe49c0961a67e520c1926d"
- integrity sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==
+ version "9.0.2"
+ resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#65ff91f4abef1784697d40952bb1998c504caaf3"
+ integrity sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==
dependencies:
jws "^3.2.2"
- lodash "^4.17.21"
+ lodash.includes "^4.3.0"
+ lodash.isboolean "^3.0.3"
+ lodash.isinteger "^4.0.4"
+ lodash.isnumber "^3.0.3"
+ lodash.isplainobject "^4.0.6"
+ lodash.isstring "^4.0.1"
+ lodash.once "^4.0.0"
ms "^2.1.1"
- semver "^7.3.8"
+ semver "^7.5.4"
jwa@^1.4.1:
version "1.4.1"
@@ -2496,12 +2508,47 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==
+lodash.includes@^4.3.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f"
+ integrity sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==
+
+lodash.isboolean@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6"
+ integrity sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==
+
+lodash.isinteger@^4.0.4:
+ version "4.0.4"
+ resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343"
+ integrity sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==
+
+lodash.isnumber@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc"
+ integrity sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==
+
+lodash.isplainobject@^4.0.6:
+ version "4.0.6"
+ resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
+ integrity sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==
+
+lodash.isstring@^4.0.1:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
+ integrity sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==
+
+lodash.once@^4.0.0:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
+ integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==
+
lodash.throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==
-lodash@^4.17.15, lodash@^4.17.21:
+lodash@^4.17.15:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -2520,13 +2567,6 @@ lru-cache@^5.1.1:
dependencies:
yallist "^3.0.2"
-lru-cache@^6.0.0:
- version "6.0.0"
- resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
- integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
- dependencies:
- yallist "^4.0.0"
-
make-dir@^2.0.0, make-dir@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
@@ -2782,6 +2822,11 @@ mime@1.6.0:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
+mime@^4.0.7:
+ version "4.0.7"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-4.0.7.tgz#0b7a98b08c63bd3c10251e797d67840c9bde9f13"
+ integrity sha512-2OfDPL+e03E0LrXaGYOtTFIYhiuzep94NSsuhrNULq+stylcJedcHdzHtz0atMUuGwJfFYs0YL5xeC/Ca2x0eQ==
+
minimatch@^3.0.4, minimatch@^3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
@@ -3167,7 +3212,7 @@ regenerate@^1.4.2:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a"
integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==
-regenerator-runtime@^0.13.11, regenerator-runtime@^0.13.2:
+regenerator-runtime@^0.13.2:
version "0.13.11"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
@@ -3277,12 +3322,10 @@ semver@^7.1.3:
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==
-semver@^7.3.8:
- version "7.5.1"
- resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.1.tgz#c90c4d631cf74720e46b21c1d37ea07edfab91ec"
- integrity sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==
- dependencies:
- lru-cache "^6.0.0"
+semver@^7.5.4:
+ version "7.7.1"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.1.tgz#abd5098d82b18c6c81f6074ff2647fd3e7220c9f"
+ integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==
send@0.19.0:
version "0.19.0"
@@ -3409,10 +3452,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
-stream-chat-react-native-core@6.7.3:
- version "6.7.3"
- resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.7.3.tgz#7e213c03a7414c85ec4ba9da247d9703878ab520"
- integrity sha512-dYoYkVah7l4bmkI0vl7Ma6qD+xjsmeFWOdz7EVwbtR+B3HPMsgz8eRAmBj/p2xcSANxh1bPRD0iLlvD30vXyzg==
+stream-chat-react-native-core@6.7.4:
+ version "6.7.4"
+ resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.7.4.tgz#9709465e161e32cf358034a82c284cc16369397a"
+ integrity sha512-YCAXBfdbazFIpO1EI9Czd2QYaFCJX+i9q710L3xPB4mRuaNl2SL8kH+RTj4Ur9Fyl3u1fcDI+1o/iYnaap1Uwg==
dependencies:
"@gorhom/bottom-sheet" "^5.1.1"
dayjs "1.10.5"
@@ -3429,11 +3472,11 @@ stream-chat-react-native-core@6.7.3:
use-sync-external-store "^1.4.0"
stream-chat@^8.57.6:
- version "8.57.6"
- resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.57.6.tgz#dd3a4a0a024ee44bfa6ae7ca15648e6c9f2e498f"
- integrity sha512-+zkC5DtxvdkEBAv7dCzzO4WWosjaM15EjsH3q4xD1nX/yf2qT6BMhPJguM+CUWxwlFh32X0KR+ARtD0ChPqtnA==
+ version "8.60.0"
+ resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.60.0.tgz#b67d4fbb185da53fb8ac5fc5759986d6ad7e19a3"
+ integrity sha512-7FpO7Wno++r+n+x9aFuXtGYtNO06CIMd2Bxe3doYZLhMfS0nuaXloeFlGcMT0r4U/6bnguz1qQdDJUPNQAS8bQ==
dependencies:
- "@babel/runtime" "^7.16.3"
+ "@babel/runtime" "^7.27.0"
"@types/jsonwebtoken" "~9.0.0"
"@types/ws" "^7.4.0"
axios "^1.6.0"
@@ -3707,11 +3750,6 @@ yallist@^3.0.2:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
-yallist@^4.0.0:
- version "4.0.0"
- resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
- integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
-
yargs-parser@^21.1.1:
version "21.1.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
diff --git a/package/package.json b/package/package.json
index e19c9d442a..fb0c16ef08 100644
--- a/package/package.json
+++ b/package/package.json
@@ -77,16 +77,16 @@
"path": "0.12.7",
"react-native-markdown-package": "1.8.2",
"react-native-url-polyfill": "^1.3.0",
- "stream-chat": "^8.57.6",
+ "stream-chat": "^9.0.0",
"use-sync-external-store": "^1.4.0"
},
"peerDependencies": {
"@op-engineering/op-sqlite": ">=9.3.0",
"@react-native-community/netinfo": ">=11.3.1",
- "react-native": ">=0.67.0",
+ "react-native": ">=0.71.0",
"react-native-gesture-handler": ">=2.16.1",
"react-native-reanimated": ">=3.16.0",
- "react-native-svg": ">=12.3.0"
+ "react-native-svg": ">=13.6.0"
},
"peerDependenciesMeta": {
"@op-engineering/op-sqlite": {
diff --git a/package/src/components/AITypingIndicatorView/AITypingIndicatorView.tsx b/package/src/components/AITypingIndicatorView/AITypingIndicatorView.tsx
index 1709b8fcad..5082512924 100644
--- a/package/src/components/AITypingIndicatorView/AITypingIndicatorView.tsx
+++ b/package/src/components/AITypingIndicatorView/AITypingIndicatorView.tsx
@@ -7,21 +7,16 @@ import { Channel } from 'stream-chat';
import { AIStates, useAIState } from './hooks/useAIState';
import { useChannelContext, useTheme, useTranslationContext } from '../../contexts';
-import type { DefaultStreamChatGenerics } from '../../types/types';
-export type AITypingIndicatorViewProps<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = {
- channel?: Channel;
+export type AITypingIndicatorViewProps = {
+ channel?: Channel;
};
-export const AITypingIndicatorView = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->({
+export const AITypingIndicatorView = ({
channel: channelFromProps,
-}: AITypingIndicatorViewProps) => {
+}: AITypingIndicatorViewProps) => {
const { t } = useTranslationContext();
- const { channel: channelFromContext } = useChannelContext();
+ const { channel: channelFromContext } = useChannelContext();
const channel = channelFromProps || channelFromContext;
const { aiState } = useAIState(channel);
const allowedStates = {
diff --git a/package/src/components/AITypingIndicatorView/hooks/useAIState.ts b/package/src/components/AITypingIndicatorView/hooks/useAIState.ts
index 2c7f9c4258..de0ad7ae93 100644
--- a/package/src/components/AITypingIndicatorView/hooks/useAIState.ts
+++ b/package/src/components/AITypingIndicatorView/hooks/useAIState.ts
@@ -3,7 +3,6 @@ import { useEffect, useState } from 'react';
import { AIState, Channel, Event } from 'stream-chat';
import { useChatContext } from '../../../contexts';
-import type { DefaultStreamChatGenerics } from '../../../types/types';
export const AIStates = {
Error: 'AI_STATE_ERROR',
@@ -18,12 +17,8 @@ export const AIStates = {
* @param {Channel} channel - The channel for which we want to know the AI state.
* @returns {{ aiState: AIState }} The current AI state for the given channel.
*/
-export const useAIState = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- channel?: Channel,
-): { aiState: AIState } => {
- const { isOnline } = useChatContext();
+export const useAIState = (channel?: Channel): { aiState: AIState } => {
+ const { isOnline } = useChatContext();
const [aiState, setAiState] = useState(AIStates.Idle);
@@ -38,16 +33,13 @@ export const useAIState = <
return;
}
- const indicatorChangedListener = channel.on(
- 'ai_indicator.update',
- (event: Event) => {
- const { cid } = event;
- const state = event.ai_state as AIState;
- if (channel.cid === cid) {
- setAiState(state);
- }
- },
- );
+ const indicatorChangedListener = channel.on('ai_indicator.update', (event: Event) => {
+ const { cid } = event;
+ const state = event.ai_state as AIState;
+ if (channel.cid === cid) {
+ setAiState(state);
+ }
+ });
const indicatorClearedListener = channel.on('ai_indicator.clear', (event) => {
const { cid } = event;
diff --git a/package/src/components/Attachment/Attachment.tsx b/package/src/components/Attachment/Attachment.tsx
index a7894b55f3..07ab1d6cda 100644
--- a/package/src/components/Attachment/Attachment.tsx
+++ b/package/src/components/Attachment/Attachment.tsx
@@ -13,14 +13,12 @@ import {
} from '../../contexts/messagesContext/MessagesContext';
import { isVideoPlayerAvailable } from '../../native';
-import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
+import { FileTypes } from '../../types/types';
export type ActionHandler = (name: string, value: string) => void;
-export type AttachmentPropsWithContext<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Pick<
- MessagesContextValue,
+export type AttachmentPropsWithContext = Pick<
+ MessagesContextValue,
| 'AttachmentActions'
| 'Card'
| 'FileAttachment'
@@ -34,14 +32,10 @@ export type AttachmentPropsWithContext<
/**
* The attachment to render
*/
- attachment: AttachmentType;
+ attachment: AttachmentType;
};
-const AttachmentWithContext = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: AttachmentPropsWithContext,
-) => {
+const AttachmentWithContext = (props: AttachmentPropsWithContext) => {
const {
attachment,
AttachmentActions,
@@ -68,7 +62,7 @@ const AttachmentWithContext = <
<>
{hasAttachmentActions && (
-
+
)}
>
);
@@ -79,7 +73,7 @@ const AttachmentWithContext = <
<>
{hasAttachmentActions && (
-
+
)}
>
) : (
@@ -99,7 +93,8 @@ const AttachmentWithContext = <
return (
<>
-
+ {/** TODO: Please rethink this, the fix is temporary. */}
+
>
);
} else {
@@ -107,10 +102,7 @@ const AttachmentWithContext = <
}
};
-const areEqual = (
- prevProps: AttachmentPropsWithContext,
- nextProps: AttachmentPropsWithContext,
-) => {
+const areEqual = (prevProps: AttachmentPropsWithContext, nextProps: AttachmentPropsWithContext) => {
const {
attachment: prevAttachment,
isAttachmentEqual,
@@ -145,11 +137,9 @@ const MemoizedAttachment = React.memo(
areEqual,
) as typeof AttachmentWithContext;
-export type AttachmentProps<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Partial<
+export type AttachmentProps = Partial<
Pick<
- MessagesContextValue,
+ MessagesContextValue,
| 'AttachmentActions'
| 'Card'
| 'FileAttachment'
@@ -161,16 +151,12 @@ export type AttachmentProps<
| 'isAttachmentEqual'
>
> &
- Pick, 'attachment'>;
+ Pick;
/**
* Attachment - The message attachment
*/
-export const Attachment = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: AttachmentProps,
-) => {
+export const Attachment = (props: AttachmentProps) => {
const {
attachment,
AttachmentActions: PropAttachmentActions,
@@ -193,7 +179,7 @@ export const Attachment = <
isAttachmentEqual,
myMessageTheme: ContextMyMessageTheme,
UrlPreview: ContextUrlPreview,
- } = useMessagesContext();
+ } = useMessagesContext();
if (!attachment) {
return null;
diff --git a/package/src/components/Attachment/AttachmentActions.tsx b/package/src/components/Attachment/AttachmentActions.tsx
index f594d5375e..a860772f15 100644
--- a/package/src/components/Attachment/AttachmentActions.tsx
+++ b/package/src/components/Attachment/AttachmentActions.tsx
@@ -17,8 +17,6 @@ import {
} from '../../contexts/messageContext/MessageContext';
import { useTheme } from '../../contexts/themeContext/ThemeContext';
-import type { DefaultStreamChatGenerics } from '../../types/types';
-
const styles = StyleSheet.create({
actionButton: {
borderRadius: 20,
@@ -33,10 +31,8 @@ const styles = StyleSheet.create({
},
});
-export type AttachmentActionsPropsWithContext<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Pick, 'actions'> &
- Pick, 'handleAction'> & {
+export type AttachmentActionsPropsWithContext = Pick &
+ Pick & {
styles?: Partial<{
actionButton: StyleProp;
buttonText: StyleProp;
@@ -44,11 +40,7 @@ export type AttachmentActionsPropsWithContext<
}>;
};
-const AttachmentActionsWithContext = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: AttachmentActionsPropsWithContext,
-) => {
+const AttachmentActionsWithContext = (props: AttachmentActionsPropsWithContext) => {
const { actions, handleAction, styles: stylesProp = {} } = props;
const {
@@ -116,9 +108,9 @@ const AttachmentActionsWithContext = <
);
};
-const areEqual = (
- prevProps: AttachmentActionsPropsWithContext,
- nextProps: AttachmentActionsPropsWithContext,
+const areEqual = (
+ prevProps: AttachmentActionsPropsWithContext,
+ nextProps: AttachmentActionsPropsWithContext,
) => {
const { actions: prevActions } = prevProps;
const { actions: nextActions } = nextProps;
@@ -133,21 +125,15 @@ const MemoizedAttachmentActions = React.memo(
areEqual,
) as typeof AttachmentActionsWithContext;
-export type AttachmentActionsProps<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Attachment &
- Partial, 'handleAction'>>;
+export type AttachmentActionsProps = Attachment &
+ Partial>;
/**
* AttachmentActions - The actions you can take on an attachment.
* Actions in combination with attachments can be used to build [commands](https://getstream.io/chat/docs/#channel_commands).
*/
-export const AttachmentActions = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: AttachmentActionsProps,
-) => {
- const { handleAction } = useMessageContext();
+export const AttachmentActions = (props: AttachmentActionsProps) => {
+ const { handleAction } = useMessageContext();
return ;
};
diff --git a/package/src/components/Attachment/AudioAttachment.tsx b/package/src/components/Attachment/AudioAttachment.tsx
index ad94d4a3c9..bd051c4434 100644
--- a/package/src/components/Attachment/AudioAttachment.tsx
+++ b/package/src/components/Attachment/AudioAttachment.tsx
@@ -15,7 +15,7 @@ import {
VideoProgressData,
VideoSeekResponse,
} from '../../native';
-import { FileTypes, type FileUpload } from '../../types/types';
+import { AudioUpload, FileTypes } from '../../types/types';
import { getTrimmedAttachmentTitle } from '../../utils/getTrimmedAttachmentTitle';
import { ProgressControl } from '../ProgressControl/ProgressControl';
import { WaveProgressBar } from '../ProgressControl/WaveProgressBar';
@@ -23,7 +23,7 @@ import { WaveProgressBar } from '../ProgressControl/WaveProgressBar';
dayjs.extend(duration);
export type AudioAttachmentProps = {
- item: Omit;
+ item: Omit;
onLoad: (index: string, duration: number) => void;
onPlayPause: (index: string, pausedStatus?: boolean) => void;
onProgress: (index: string, progress: number) => void;
diff --git a/package/src/components/Attachment/Card.tsx b/package/src/components/Attachment/Card.tsx
index 09e9bca733..ed8582bc9d 100644
--- a/package/src/components/Attachment/Card.tsx
+++ b/package/src/components/Attachment/Card.tsx
@@ -27,7 +27,7 @@ import {
} from '../../contexts/messagesContext/MessagesContext';
import { useTheme } from '../../contexts/themeContext/ThemeContext';
import { Play } from '../../icons/Play';
-import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
+import { FileTypes } from '../../types/types';
import { makeImageCompatibleUrl } from '../../utils/utils';
import { ImageBackground } from '../UIComponents/ImageBackground';
@@ -82,16 +82,11 @@ const styles = StyleSheet.create({
},
});
-export type CardPropsWithContext<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Attachment &
+export type CardPropsWithContext = Attachment &
Pick &
+ Pick &
Pick<
- MessageContextValue,
- 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
- > &
- Pick<
- MessagesContextValue,
+ MessagesContextValue,
'additionalPressableProps' | 'CardCover' | 'CardFooter' | 'CardHeader' | 'myMessageTheme'
> & {
channelId: string | undefined;
@@ -110,11 +105,7 @@ export type CardPropsWithContext<
}>;
};
-const CardWithContext = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: CardPropsWithContext,
-) => {
+const CardWithContext = (props: CardPropsWithContext) => {
const {
additionalPressableProps,
author_name,
@@ -289,10 +280,7 @@ const CardWithContext = <
);
};
-const areEqual = (
- prevProps: CardPropsWithContext,
- nextProps: CardPropsWithContext,
-) => {
+const areEqual = (prevProps: CardPropsWithContext, nextProps: CardPropsWithContext) => {
const { myMessageTheme: prevMyMessageTheme } = prevProps;
const { myMessageTheme: nextMyMessageTheme } = nextProps;
@@ -307,17 +295,12 @@ const areEqual = = Attachment &
+export type CardProps = Attachment &
Partial<
- Pick, 'ImageComponent'> &
- Pick<
- MessageContextValue,
- 'onLongPress' | 'onPress' | 'onPressIn' | 'myMessageTheme'
- > &
+ Pick &
+ Pick &
Pick<
- MessagesContextValue,
+ MessagesContextValue,
'additionalPressableProps' | 'CardCover' | 'CardFooter' | 'CardHeader'
>
>;
@@ -325,16 +308,11 @@ export type CardProps<
/**
* UI component for card in attachments.
*/
-export const Card = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: CardProps,
-) => {
- const { ImageComponent } = useChatContext();
- const { message, onLongPress, onPress, onPressIn, preventPress } =
- useMessageContext();
+export const Card = (props: CardProps) => {
+ const { ImageComponent } = useChatContext();
+ const { message, onLongPress, onPress, onPressIn, preventPress } = useMessageContext();
const { additionalPressableProps, CardCover, CardFooter, CardHeader, myMessageTheme } =
- useMessagesContext();
+ useMessagesContext();
return (
= Pick<
- MessageContextValue,
+export type FileAttachmentPropsWithContext = Pick<
+ MessageContextValue,
'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
> &
Pick<
- MessagesContextValue,
+ MessagesContextValue,
'additionalPressableProps' | 'AttachmentActions' | 'FileAttachmentIcon'
> & {
/** The attachment to render */
- attachment: Attachment;
+ attachment: Attachment;
attachmentSize?: number;
styles?: Partial<{
container: StyleProp;
@@ -59,11 +56,7 @@ export type FileAttachmentPropsWithContext<
}>;
};
-const FileAttachmentWithContext = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: FileAttachmentPropsWithContext,
-) => {
+const FileAttachmentWithContext = (props: FileAttachmentPropsWithContext) => {
const {
additionalPressableProps,
attachment,
@@ -149,22 +142,16 @@ const FileAttachmentWithContext = <
);
};
-export type FileAttachmentProps<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Partial, 'attachment'>> &
- Pick, 'attachment'>;
-
-export const FileAttachment = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: FileAttachmentProps,
-) => {
- const { onLongPress, onPress, onPressIn, preventPress } = useMessageContext();
+export type FileAttachmentProps = Partial> &
+ Pick;
+
+export const FileAttachment = (props: FileAttachmentProps) => {
+ const { onLongPress, onPress, onPressIn, preventPress } = useMessageContext();
const {
additionalPressableProps,
AttachmentActions = AttachmentActionsDefault,
FileAttachmentIcon = FileIconDefault,
- } = useMessagesContext();
+ } = useMessagesContext();
return (
= Pick, 'files'> &
- Pick, 'Attachment' | 'AudioAttachment'> & {
+export type FileAttachmentGroupPropsWithContext = Pick &
+ Pick & {
/**
* The unique id for the message with file attachments
*/
@@ -33,19 +31,13 @@ export type FileAttachmentGroupPropsWithContext<
}>;
};
-type FilesToDisplayType<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Attachment & {
+type FilesToDisplayType = Attachment & {
duration: number;
paused: boolean;
progress: number;
};
-const FileAttachmentGroupWithContext = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: FileAttachmentGroupPropsWithContext,
-) => {
+const FileAttachmentGroupWithContext = (props: FileAttachmentGroupPropsWithContext) => {
const { Attachment, AudioAttachment, files, messageId, styles: stylesProp = {} } = props;
const [filesToDisplay, setFilesToDisplay] = useState([]);
@@ -108,7 +100,7 @@ const FileAttachmentGroupWithContext = <
{filesToDisplay.map((file, index) => (
(
- prevProps: FileAttachmentGroupPropsWithContext,
- nextProps: FileAttachmentGroupPropsWithContext,
+const areEqual = (
+ prevProps: FileAttachmentGroupPropsWithContext,
+ nextProps: FileAttachmentGroupPropsWithContext,
) => {
const { files: prevFiles } = prevProps;
const { files: nextFiles } = nextProps;
@@ -159,22 +153,17 @@ const MemoizedFileAttachmentGroup = React.memo(
areEqual,
) as typeof FileAttachmentGroupWithContext;
-export type FileAttachmentGroupProps<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Partial, 'messageId'>> &
- Pick, 'messageId'>;
+export type FileAttachmentGroupProps = Partial<
+ Omit
+> &
+ Pick;
-export const FileAttachmentGroup = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: FileAttachmentGroupProps,
-) => {
+export const FileAttachmentGroup = (props: FileAttachmentGroupProps) => {
const { files: propFiles, messageId } = props;
- const { files: contextFiles } = useMessageContext();
+ const { files: contextFiles } = useMessageContext();
- const { Attachment = AttachmentDefault, AudioAttachment } =
- useMessagesContext();
+ const { Attachment = AttachmentDefault, AudioAttachment } = useMessagesContext();
const files = propFiles || contextFiles;
diff --git a/package/src/components/Attachment/Gallery.tsx b/package/src/components/Attachment/Gallery.tsx
index c2ecb55930..e3a8031b87 100644
--- a/package/src/components/Attachment/Gallery.tsx
+++ b/package/src/components/Attachment/Gallery.tsx
@@ -1,7 +1,7 @@
import React, { useMemo } from 'react';
import { Pressable, StyleSheet, Text, View } from 'react-native';
-import type { Attachment } from 'stream-chat';
+import type { Attachment, LocalMessage } from 'stream-chat';
import { GalleryImage } from './GalleryImage';
import { buildGallery } from './utils/buildGallery/buildGallery';
@@ -11,7 +11,6 @@ import { getGalleryImageBorderRadius } from './utils/getGalleryImageBorderRadius
import { openUrlSafely } from './utils/openUrlSafely';
-import type { MessageType } from '../../components/MessageList/hooks/useMessageList';
import { useTranslationContext } from '../../contexts';
import { useChatConfigContext } from '../../contexts/chatConfigContext/ChatConfigContext';
import {
@@ -33,14 +32,15 @@ import {
import { useTheme } from '../../contexts/themeContext/ThemeContext';
import { useLoadingImage } from '../../hooks/useLoadingImage';
import { isVideoPlayerAvailable } from '../../native';
-import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
+import { FileTypes } from '../../types/types';
import { getUrlWithoutParams } from '../../utils/utils';
-export type GalleryPropsWithContext<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Pick, 'setSelectedMessage' | 'setMessages'> &
+export type GalleryPropsWithContext = Pick<
+ ImageGalleryContextValue,
+ 'setSelectedMessage' | 'setMessages'
+> &
Pick<
- MessageContextValue,
+ MessageContextValue,
| 'alignment'
| 'groupStyles'
| 'images'
@@ -52,7 +52,7 @@ export type GalleryPropsWithContext<
| 'threadList'
> &
Pick<
- MessagesContextValue,
+ MessagesContextValue,
| 'additionalPressableProps'
| 'legacyImageViewerSwipeBehaviour'
| 'VideoThumbnail'
@@ -76,14 +76,10 @@ export type GalleryPropsWithContext<
*
* TODO: Fix circular dependencies of imports
*/
- message?: MessageType;
+ message?: LocalMessage;
};
-const GalleryWithContext = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: GalleryPropsWithContext,
-) => {
+const GalleryWithContext = (props: GalleryPropsWithContext) => {
const {
additionalPressableProps,
alignment,
@@ -237,9 +233,7 @@ const GalleryWithContext = <
);
};
-type GalleryThumbnailProps<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = {
+type GalleryThumbnailProps = {
borderRadius: {
borderBottomLeftRadius: number;
borderBottomRightRadius: number;
@@ -247,15 +241,15 @@ type GalleryThumbnailProps<
borderTopRightRadius: number;
};
colIndex: number;
- imagesAndVideos: Attachment[];
+ imagesAndVideos: Attachment[];
invertedDirections: boolean;
- message: MessageType;
+ message: LocalMessage;
numOfColumns: number;
numOfRows: number;
rowIndex: number;
thumbnail: Thumbnail;
} & Pick<
- MessagesContextValue,
+ MessagesContextValue,
| 'additionalPressableProps'
| 'legacyImageViewerSwipeBehaviour'
| 'VideoThumbnail'
@@ -263,16 +257,11 @@ type GalleryThumbnailProps<
| 'ImageLoadingFailedIndicator'
| 'ImageReloadIndicator'
> &
- Pick, 'setSelectedMessage' | 'setMessages'> &
- Pick<
- MessageContextValue,
- 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
- > &
+ Pick &
+ Pick &
Pick;
-const GalleryThumbnail = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->({
+const GalleryThumbnail = ({
additionalPressableProps,
borderRadius,
colIndex,
@@ -295,7 +284,7 @@ const GalleryThumbnail = <
setSelectedMessage,
thumbnail,
VideoThumbnail,
-}: GalleryThumbnailProps) => {
+}: GalleryThumbnailProps) => {
const {
theme: {
colors: { overlay },
@@ -426,16 +415,14 @@ const GalleryThumbnail = <
);
};
-const GalleryImageThumbnail = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->({
+const GalleryImageThumbnail = ({
borderRadius,
ImageLoadingFailedIndicator,
ImageLoadingIndicator,
ImageReloadIndicator,
thumbnail,
}: Pick<
- GalleryThumbnailProps,
+ GalleryThumbnailProps,
| 'ImageLoadingFailedIndicator'
| 'ImageLoadingIndicator'
| 'ImageReloadIndicator'
@@ -506,10 +493,7 @@ const GalleryImageThumbnail = <
);
};
-const areEqual = (
- prevProps: GalleryPropsWithContext,
- nextProps: GalleryPropsWithContext,
-) => {
+const areEqual = (prevProps: GalleryPropsWithContext, nextProps: GalleryPropsWithContext) => {
const {
groupStyles: prevGroupStyles,
hasThreadReplies: prevHasThreadReplies,
@@ -578,18 +562,12 @@ const areEqual = = Partial>;
+export type GalleryProps = Partial;
/**
* UI component for card in attachments.
*/
-export const Gallery = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: GalleryProps,
-) => {
+export const Gallery = (props: GalleryProps) => {
const {
additionalPressableProps: propAdditionalPressableProps,
alignment: propAlignment,
@@ -612,8 +590,7 @@ export const Gallery = <
VideoThumbnail: PropVideoThumbnail,
} = props;
- const { setMessages, setSelectedMessage: contextSetSelectedMessage } =
- useImageGalleryContext();
+ const { setMessages, setSelectedMessage: contextSetSelectedMessage } = useImageGalleryContext();
const {
alignment: contextAlignment,
groupStyles: contextGroupStyles,
@@ -625,7 +602,7 @@ export const Gallery = <
preventPress: contextPreventPress,
threadList: contextThreadList,
videos: contextVideos,
- } = useMessageContext();
+ } = useMessageContext();
const {
additionalPressableProps: contextAdditionalPressableProps,
ImageLoadingFailedIndicator: ContextImageLoadingFailedIndicator,
@@ -634,7 +611,7 @@ export const Gallery = <
legacyImageViewerSwipeBehaviour,
myMessageTheme: contextMyMessageTheme,
VideoThumbnail: ContextVideoThumnbnail,
- } = useMessagesContext();
+ } = useMessagesContext();
const { setOverlay: contextSetOverlay } = useOverlayContext();
const images = propImages || contextImages;
diff --git a/package/src/components/Attachment/GalleryImage.tsx b/package/src/components/Attachment/GalleryImage.tsx
index 44fc81f7a2..75328eece0 100644
--- a/package/src/components/Attachment/GalleryImage.tsx
+++ b/package/src/components/Attachment/GalleryImage.tsx
@@ -3,12 +3,10 @@ import { Image, ImageProps } from 'react-native';
import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext';
-import type { DefaultStreamChatGenerics } from '../../types/types';
import { getUrlWithoutParams, isLocalUrl, makeImageCompatibleUrl } from '../../utils/utils';
-export type GalleryImageWithContextProps<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = GalleryImageProps & Pick, 'ImageComponent'>;
+export type GalleryImageWithContextProps = GalleryImageProps &
+ Pick;
export const GalleryImageWithContext = (props: GalleryImageWithContextProps) => {
const { ImageComponent = Image, uri, ...rest } = props;
@@ -47,12 +45,8 @@ export type GalleryImageProps = Omit & {
uri: string;
};
-export const GalleryImage = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: GalleryImageProps,
-) => {
- const { ImageComponent } = useChatContext();
+export const GalleryImage = (props: GalleryImageProps) => {
+ const { ImageComponent } = useChatContext();
return ;
};
diff --git a/package/src/components/Attachment/Giphy.tsx b/package/src/components/Attachment/Giphy.tsx
index 29eda46dce..cc60590399 100644
--- a/package/src/components/Attachment/Giphy.tsx
+++ b/package/src/components/Attachment/Giphy.tsx
@@ -24,7 +24,7 @@ import {
import { useTheme } from '../../contexts/themeContext/ThemeContext';
import { useLoadingImage } from '../../hooks/useLoadingImage';
import { GiphyIcon, GiphyLightning } from '../../icons';
-import type { DefaultStreamChatGenerics } from '../../types/types';
+
import { makeImageCompatibleUrl } from '../../utils/utils';
const styles = StyleSheet.create({
@@ -134,11 +134,12 @@ const styles = StyleSheet.create({
},
});
-export type GiphyPropsWithContext<
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
-> = Pick, 'setSelectedMessage' | 'setMessages'> &
+export type GiphyPropsWithContext = Pick<
+ ImageGalleryContextValue,
+ 'setSelectedMessage' | 'setMessages'
+> &
Pick<
- MessageContextValue,
+ MessageContextValue,
| 'handleAction'
| 'isMyMessage'
| 'message'
@@ -147,22 +148,18 @@ export type GiphyPropsWithContext<
| 'onPressIn'
| 'preventPress'
> &
- Pick, 'ImageComponent'> &
+ Pick &
Pick<
- MessagesContextValue,
+ MessagesContextValue,
| 'giphyVersion'
| 'additionalPressableProps'
| 'ImageLoadingIndicator'
| 'ImageLoadingFailedIndicator'
> & {
- attachment: Attachment;
+ attachment: Attachment;
} & Pick;
-const GiphyWithContext = <
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
->(
- props: GiphyPropsWithContext,
-) => {
+const GiphyWithContext = (props: GiphyPropsWithContext) => {
const {
additionalPressableProps,
attachment,
@@ -389,10 +386,7 @@ const GiphyWithContext = <
);
};
-const areEqual = (
- prevProps: GiphyPropsWithContext,
- nextProps: GiphyPropsWithContext,
-) => {
+const areEqual = (prevProps: GiphyPropsWithContext, nextProps: GiphyPropsWithContext) => {
const {
attachment: { actions: prevActions, image_url: prevImageUrl, thumb_url: prevThumbUrl },
giphyVersion: prevGiphyVersion,
@@ -448,31 +442,25 @@ const areEqual = = Partial> & {
- attachment: Attachment