Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
def03f1
feat: offline support
madsroskar May 18, 2022
ec67fbc
Merge branch 'develop' of https://github.com/GetStream/stream-chat-re…
vishalnarkhede Jun 29, 2022
c22f808
refactor: drop un-used function pragmaUserVersion
vishalnarkhede Jun 29, 2022
e7552ed
refactor: reverting changes to ChannelPreview
vishalnarkhede Jun 29, 2022
36e5656
fix: fixing migration code issue
vishalnarkhede Jun 30, 2022
79ba34a
refactor: drop limits from queries
vishalnarkhede Jun 30, 2022
49da68a
refactor: handling of message.read events and reads entity
vishalnarkhede Jul 1, 2022
3c184ee
refactor: added members to separate table
vishalnarkhede Jul 2, 2022
94020bf
refactor: relative explicit query with left join to enrich users
vishalnarkhede Jul 2, 2022
a1a4a3c
refactor: cleanup and reorganizing
vishalnarkhede Jul 2, 2022
25deac9
Merge branch 'santhosh/improve-pagination' of https://github.com/GetS…
vishalnarkhede Jul 3, 2022
6bfddd2
refactor: added index and foreign key constraints
vishalnarkhede Jul 3, 2022
09f488b
refactor: changes to be compatible with js client
vishalnarkhede Jul 4, 2022
a06fa2d
test: mocking sqlite
vanGalilea Jul 4, 2022
e6db270
refactor: added missing fields on channels table
vishalnarkhede Jul 4, 2022
b15c766
Merge branch 'steve/testing-with-sql' of https://github.com/GetStream…
vishalnarkhede Jul 4, 2022
0c61dbe
refactor: changes to be in sync with event from js client
vishalnarkhede Jul 5, 2022
10d1840
refactor: renaming table and cleanup of columns
vishalnarkhede Jul 6, 2022
8742a26
refactor: moving all quick-sqlite logic to separate class
vishalnarkhede Jul 6, 2022
db95a7c
test: added simple test for offline support
vishalnarkhede Jul 6, 2022
f58706d
Merge branch 'develop' of https://github.com/GetStream/stream-chat-re…
vishalnarkhede Jul 6, 2022
d94fe72
Merge branch 'v5-release' of https://github.com/GetStream/stream-chat…
vishalnarkhede Jul 6, 2022
dd66ba8
refactor: handle member related events
vishalnarkhede Jul 6, 2022
361a65e
refactor: added usage of sync api
vishalnarkhede Jul 7, 2022
ee089eb
refactor: cleaning up un-necessary packages
vishalnarkhede Jul 7, 2022
34c9d12
refactor: fixed issue with update message foreign key constraint failure
vishalnarkhede Jul 8, 2022
c88fdc8
refactor: cleanup
vishalnarkhede Jul 8, 2022
64330a5
refactor: cleanup
vishalnarkhede Jul 8, 2022
e5ffbff
tests: writing tests for offline feature
vishalnarkhede Jul 14, 2022
1a34123
refactor: removed dev-menu package and usage
vishalnarkhede Jul 14, 2022
53489ce
Merge branch 'v5-release' of https://github.com/GetStream/stream-chat…
vishalnarkhede Jul 14, 2022
b353545
refactor: remove unused initDevMenu import
vishalnarkhede Jul 14, 2022
d42e9b8
refactor: remove un-used flipper packages
vishalnarkhede Jul 14, 2022
e5b9604
docs: adding code comments
vishalnarkhede Jul 14, 2022
74211ef
refactor: removing unnecessary generics
vishalnarkhede Jul 14, 2022
dd5a326
refactor: cleanup of mapper functions
vishalnarkhede Jul 14, 2022
e3ce37e
refactor: renaming offlineChannelsActive to staticChannelsActive
vishalnarkhede Jul 15, 2022
0e94be2
refactor: removed metro config changes
vishalnarkhede Jul 15, 2022
6bcdd1f
buiild: fixed issue with manual release script
vishalnarkhede Jul 15, 2022
2deea16
refactor: cleanup of handleEventToSyncDB
vishalnarkhede Jul 15, 2022
d5bc9a5
refactor: fixing lint issue
vishalnarkhede Jul 15, 2022
1d19d61
fix: removed redundant usage of useStreami18n hook
vishalnarkhede Jul 15, 2022
2851b34
fix: issue with message not displayed in static state
vishalnarkhede Jul 18, 2022
697d7c0
build: updating stream-chat version
vishalnarkhede Jul 19, 2022
2654425
fix: issue with appendWhereClause and undefined value
vishalnarkhede Jul 19, 2022
04f91f3
fix: issue with members state initialization
vishalnarkhede Jul 20, 2022
7a7e7ab
build: do not format on save
vishalnarkhede Jul 20, 2022
dd6e003
fix: issue mapping memberCount to api response
vishalnarkhede Jul 20, 2022
ebb8306
build: upgrading stream-chat version
vishalnarkhede Jul 20, 2022
939b1f3
fix: reposition image error indicator
madsroskar Jul 21, 2022
653d8e5
Merge branch 'mads/reposition-image-error-indicator' of https://githu…
vishalnarkhede Jul 21, 2022
2134c6b
refactor: use network error handling to useLoadingImage
vishalnarkhede Jul 21, 2022
cf0b111
Merge branch 'v5-release' of https://github.com/GetStream/stream-chat…
vishalnarkhede Jul 21, 2022
d8e1598
fix: image loading issue after network is recovered
vishalnarkhede Jul 21, 2022
20f2af3
fix: logic for sync api and lint issues
vishalnarkhede Jul 22, 2022
faee446
feat: point cameraroll dependency to the stream fork version
santhoshvai Jul 25, 2022
779fc57
Merge branch 'v5-release' of https://github.com/GetStream/stream-chat…
vishalnarkhede Jul 25, 2022
ef1bb2c
Merge branch 'vishal/offline-support-with-hydration-1' of https://git…
vishalnarkhede Jul 25, 2022
24fa3f2
fix: message.new event handling
vishalnarkhede Jul 25, 2022
64e0350
Merge branch 'v5-release' of https://github.com/GetStream/stream-chat…
vishalnarkhede Jul 26, 2022
8c366a2
refactor: remove unnecessary client as hook dep
vishalnarkhede Jul 26, 2022
66b32f1
refactor: code review changes
vishalnarkhede Jul 26, 2022
9aa56e2
refactor: moving offline support logic to Chat component
vishalnarkhede Jul 28, 2022
ea828c3
refactor: fix lint and typescript issues
vishalnarkhede Jul 28, 2022
a02f1f6
refactor: handle quick-sqlite not being installed in better way
vishalnarkhede Jul 29, 2022
0284459
Merge branch 'develop' into vishal/offline-support-with-hydration-1
santhoshvai Jul 30, 2022
b79edfe
Merge branch 'v5-release' of https://github.com/GetStream/stream-chat…
vishalnarkhede Aug 2, 2022
bb475cb
Merge branch 'vishal/offline-support-with-hydration-1' of https://git…
vishalnarkhede Aug 2, 2022
b507295
docs: lint fixes
vishalnarkhede Aug 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"editor.formatOnSave": true
}
}
8 changes: 4 additions & 4 deletions bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ cd ..
sed -e 's|"version": "[^"]*"|"version": "'"$1"'"|g' -i.bak src/version.json
rm src/version.json.bak

git add package.json
git add {expo,native}-package/package.json
git add src/version.json

git add yarn.lock
git add expo-package/yarn.lock
git add native-package/yarn.lock

npm version "$1" --force
npm version --no-git-tag-version "$1"

npm publish --tag="$tag"

Expand All @@ -45,6 +47,4 @@ npm publish --tag="$tag"


cd ../expo-package
npm publish --tag="$tag"

git push --follow-tags
npm publish --tag="$tag"
23 changes: 12 additions & 11 deletions docusaurus/docs/reactnative/basics/upgrade_helper.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import TabItem from '@theme/TabItem';

## Update Camera Roll dependency

Replace the `@react-native-community/cameraroll` with `@stream-io/react-native-cameraroll`. We had to roll out our fork as `@react-native-community/cameraroll` is no longer accepting pull requests for important fixes like Android 11 compatibility.
Replace the `@react-native-community/cameraroll` with `@stream-io/react-native-cameraroll`. We had to roll out our fork as `@react-native-community/cameraroll` is no longer accepting pull requests for important fixes like Android 11 compatibility.

```bash
# Remove existing cameraroll dependency
Expand All @@ -32,14 +32,15 @@ Offline Support is a major opt-in feature introduced in v5 of SDK. To enable off

Until v4, you could provide separate `Chat` component for each usage of `Channel` component or `ChannelList` component.
But from v5, it is necessary that you provide only one instance of `Chat` component within your application.
This component needs to be a parent for all the chat related components such as `ChannelList`, `Channel` or `Thread`.
This component needs to be a parent for all the chat related components such as `ChannelList`, `Channel` or `Thread`.

- **Do not wait for `connectUser` call to succeed**

It is important that you call `connectUser` method on chat client, before you render Chat components.
But you don't need to wait for `connectUser` to succeed before rendering Chat components. This is to ensure:
- Chat components have access to current user information, which is important to store/access offline data.
- In case or slow or no network, Chat components will still load the chat data without waiting for connectUser to succeed.

- Chat components have access to current user information, which is important to store/access offline data.
- In case or slow or no network, Chat components will still load the chat data without waiting for connectUser to succeed.

```tsx {7,8,16}
const chatClient = StreamChat.getInstance('API_KEY');
Expand All @@ -48,23 +49,23 @@ Offline Support is a major opt-in feature introduced in v5 of SDK. To enable off

useEffect(() => {
const startChat = async () => {
const connectPromise = chatClient.connectUser(user, tokenOrTokenProvider)
const connectPromise = chatClient.connectUser(user, tokenOrTokenProvider);
setIsClientReady(true); // this allows components to render
await connectPromise();
// Any other post-connectUser logic you may have goes here.
}
};

startChat();
}, [])
}, []);

if (!isClientReady) return null; // or some loading indicator;

return (
<Chat client={chatClient} enableOfflineSupport>
...
</Chat>
)
}
);
};
```

- **Add `enableOfflineSupport` prop on Chat component**
Expand All @@ -74,5 +75,5 @@ Offline Support is a major opt-in feature introduced in v5 of SDK. To enable off

<Chat client={chatClient} enableOfflineSupport>
...
</Chat>
```
</Chat>;
```
15 changes: 15 additions & 0 deletions examples/ExpoMessaging/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6904,6 +6904,21 @@ stream-chat@6.7.0:
jsonwebtoken "^8.5.1"
ws "^7.4.4"

stream-chat@7.0.0-offline-support.3:
version "7.0.0-offline-support.3"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-7.0.0-offline-support.3.tgz#de18a7401f6007b89f5aaf6015ee933b45e218de"
integrity sha512-uYeDt1MqCDsZ9AIdBw5c7hRM0dshxLUkaYy3Co6gdAqh6AXCEVVDSzjxXT2w1wpKZpxpwZoy4YyQJTYKrNcJNA==
dependencies:
"@babel/runtime" "^7.16.3"
"@types/jsonwebtoken" "^8.5.6"
"@types/ws" "^7.4.0"
axios "^0.22.0"
base64-js "^1.5.1"
form-data "^4.0.0"
isomorphic-ws "^4.0.1"
jsonwebtoken "^8.5.1"
ws "^7.4.4"

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"
Expand Down
7 changes: 5 additions & 2 deletions examples/SampleApp/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import { UserSelectorScreen } from './src/screens/UserSelectorScreen';

import type { StreamChat } from 'stream-chat';

LogBox.ignoreLogs(["Seems like you're using an old API"]);
LogBox.ignoreLogs(['Each child in a list should have a unique']);

import type {
StackNavigatorParamList,
StreamChatGenerics,
Expand Down Expand Up @@ -128,7 +131,7 @@ const App = () => {
}}
>
<AppContext.Provider value={{ chatClient, loginUser, logout, switchUser }}>
{isConnecting ? (
{isConnecting && !chatClient ? (
<LoadingScreen />
) : chatClient ? (
<DrawerNavigatorWrapper chatClient={chatClient} />
Expand Down Expand Up @@ -165,7 +168,7 @@ const DrawerNavigatorWrapper: React.FC<{
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<OverlayProvider<StreamChatGenerics> bottomInset={bottom} value={{ style: streamChatTheme }}>
<Chat<StreamChatGenerics> client={chatClient}>
<Chat<StreamChatGenerics> client={chatClient} enableOfflineSupport>
<AppOverlayProvider>
<UserSearchProvider>
<DrawerNavigator />
Expand Down
36 changes: 22 additions & 14 deletions examples/SampleApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ PODS:
- FirebaseCoreDiagnostics (~> 8.0)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Logger (~> 7.7)
- FirebaseCoreDiagnostics (8.14.0):
- FirebaseCoreDiagnostics (8.15.0):
- GoogleDataTransport (~> 9.1)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Logger (~> 7.7)
Expand All @@ -66,7 +66,7 @@ PODS:
- GoogleUtilities/Environment (~> 7.7)
- nanopb (~> 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- FirebaseInstallations (8.14.0):
- FirebaseInstallations (8.15.0):
- FirebaseCore (~> 8.0)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/UserDefaults (~> 7.7)
Expand Down Expand Up @@ -162,9 +162,9 @@ PODS:
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleDataTransport (9.1.2):
- GoogleUtilities/Environment (~> 7.2)
- nanopb (~> 2.30908.0)
- GoogleDataTransport (9.1.4):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.7.0):
- GoogleUtilities/Environment
Expand Down Expand Up @@ -193,7 +193,7 @@ PODS:
- nanopb/decode (2.30908.0)
- nanopb/encode (2.30908.0)
- OpenSSL-Universal (1.1.180)
- PromisesObjC (2.0.0)
- PromisesObjC (2.1.0)
- RCT-Folly (2021.06.28.00-v2):
- boost
- DoubleConversion
Expand Down Expand Up @@ -409,14 +409,18 @@ PODS:
- React-jsinspector (0.67.3)
- React-logger (0.67.3):
- glog
- react-native-cameraroll (4.0.4):
- react-native-cameraroll (4.2.0):
- React-Core
- react-native-document-picker (5.0.4):
- React-Core
- react-native-image-resizer (1.4.5):
- React-Core
- react-native-netinfo (6.0.0):
- React-Core
- react-native-quick-sqlite (3.1.8):
- React
- React-callinvoker
- React-Core
- react-native-safe-area-context (3.2.0):
- React-Core
- react-native-video (5.2.0):
Expand Down Expand Up @@ -606,10 +610,11 @@ DEPENDENCIES:
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- "react-native-cameraroll (from `../node_modules/@react-native-community/cameraroll`)"
- "react-native-cameraroll (from `../node_modules/@stream-io/react-native-cameraroll`)"
- react-native-document-picker (from `../node_modules/react-native-document-picker`)
- react-native-image-resizer (from `../node_modules/react-native-image-resizer`)
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-quick-sqlite (from `../node_modules/react-native-quick-sqlite`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-video (from `../node_modules/react-native-video`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
Expand Down Expand Up @@ -709,13 +714,15 @@ EXTERNAL SOURCES:
React-logger:
:path: "../node_modules/react-native/ReactCommon/logger"
react-native-cameraroll:
:path: "../node_modules/@react-native-community/cameraroll"
:path: "../node_modules/@stream-io/react-native-cameraroll"
react-native-document-picker:
:path: "../node_modules/react-native-document-picker"
react-native-image-resizer:
:path: "../node_modules/react-native-image-resizer"
react-native-netinfo:
:path: "../node_modules/@react-native-community/netinfo"
react-native-quick-sqlite:
:path: "../node_modules/react-native-quick-sqlite"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
react-native-video:
Expand Down Expand Up @@ -783,9 +790,9 @@ SPEC CHECKSUMS:
FirebaseAnalytics: 2fc3876e2eb347673ad2f35e249ae7b15d6c88f5
FirebaseAppDistribution: 54c3de22099cd46d93b6a24b1e70474530bb3188
FirebaseCore: b84a44ee7ba999e0f9f76d198a9c7f60a797b848
FirebaseCoreDiagnostics: fd0c8490f34287229c1d6c103d3a55f81ec85712
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseCrashlytics: 079ef36f5c4b7161188928faec40fa276ebefd84
FirebaseInstallations: 7d1d967a307c12f1aadd76844fc321cef699b1ce
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FirebaseMessaging: 5ebc42d281567658a2cb72b9ef3506e4a1a1a6e4
Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Expand All @@ -799,13 +806,13 @@ SPEC CHECKSUMS:
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85
GoogleAppMeasurement: 71156240babd3cc6ced03e0d54816f01a880c730
GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940
GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b
GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
hermes-engine: bf7577d12ac6ccf53ab8b5af3c6ccf0dd8458c5c
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58
PromisesObjC: 99b6f43f9e1044bd87a95a60beff28c2c44ddb72
RCT-Folly: 803a9cfd78114b2ec0f140cfa6fa2a6bafb2d685
RCTRequired: 3c77b683474faf23920fbefc71c4e13af21470c0
RCTTypeSafety: 720b1841260dac692444c2822b27403178da8b28
Expand All @@ -819,10 +826,11 @@ SPEC CHECKSUMS:
React-jsiexecutor: 15ea57ead631a11fad57634ff69f78e797113a39
React-jsinspector: 1e1e03345cf6d47779e2061d679d0a87d9ae73d8
React-logger: 1e10789cb84f99288479ba5f20822ce43ced6ffe
react-native-cameraroll: 88f4e62d9ecd0e1f253abe4f685474f2ea14bfa2
react-native-cameraroll: 71a4a68ebcff2fcb7305f4b408f9a972658bcdc7
react-native-document-picker: 1a7518132d4a06b67f459be9bb1464a567d2b3b4
react-native-image-resizer: d9fb629a867335bdc13230ac2a58702bb8c8828f
react-native-netinfo: e849fc21ca2f4128a5726c801a82fc6f4a6db50d
react-native-quick-sqlite: e31f937c9385597bfb402ea0e7677e0093bc17d0
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
react-native-video: a4c2635d0802f983594b7057e1bce8f442f0ad28
React-perflogger: 93d3f142d6d9a46e635f09ba0518027215a41098
Expand Down
3 changes: 2 additions & 1 deletion examples/SampleApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"dependencies": {
"@notifee/react-native": "^5.0.3",
"@react-native-async-storage/async-storage": "1.15.17",
"@react-native-community/cameraroll": "4.0.4",
"@react-native-community/masked-view": "0.1.11",
"@react-native-community/netinfo": "6.0.0",
"@react-native-firebase/app": "^14.7.0",
Expand All @@ -36,6 +35,7 @@
"@react-navigation/native": "5.9.4",
"@react-navigation/stack": "5.14.5",
"@stream-io/flat-list-mvcp": "0.10.2",
"@stream-io/react-native-cameraroll": "^4.2.0",
"patch-package": "6.4.7",
"react": "17.0.2",
"react-native": "0.67.3",
Expand All @@ -46,6 +46,7 @@
"react-native-image-crop-picker": "0.36.2",
"react-native-image-resizer": "1.4.5",
"react-native-markdown-package": "1.8.1",
"react-native-quick-sqlite": "^3.1.5",
"react-native-reanimated": "2.7.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "3.2.0",
Expand Down
9 changes: 6 additions & 3 deletions examples/SampleApp/src/hooks/useChatClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react';
import { StreamChat } from 'stream-chat';
import messaging from '@react-native-firebase/messaging';
import notifee from '@notifee/react-native';

import { QuickSqliteClient } from 'stream-chat-react-native';
import { USER_TOKENS, USERS } from '../ChatUsers';
import AsyncStore from '../utils/AsyncStore';

Expand Down Expand Up @@ -74,15 +74,17 @@ export const useChatClient = () => {
unsubscribePushListenersRef.current?.();
const client = StreamChat.getInstance<StreamChatGenerics>(config.apiKey, {
timeout: 6000,
// logger: (type, msg) => console.log(type, msg)
});

const user = {
id: config.userId,
image: config.userImage,
name: config.userName,
};

await client.connectUser(user, config.userToken);
const promise = client.connectUser(user, config.userToken);
setChatClient(client);
await promise;
Comment on lines +85 to +87

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious can this be?

    setChatClient(client);
    await client.connectUser(user, config.userToken);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, our client needs to have user set before we can load Chat components. Basically SDK should know which user is trying to access the data. E.g. logic around isMyMessage or own_reactions.etc

await AsyncStore.setItem('@stream-rn-sampleapp-login-config', config);

const permissionAuthStatus = await messaging().hasPermission();
Expand Down Expand Up @@ -162,6 +164,7 @@ export const useChatClient = () => {
};

const logout = async () => {
QuickSqliteClient.resetDB();
setChatClient(null);
chatClient?.disconnectUser();
await AsyncStore.removeItem('@stream-rn-sampleapp-login-config');
Expand Down
9 changes: 5 additions & 4 deletions examples/SampleApp/src/screens/ChannelListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const options = {
state: true,
watch: true,
};

export const ChannelListScreen: React.FC = () => {
const { chatClient } = useAppContext();
const navigation = useNavigation();
Expand All @@ -81,7 +80,7 @@ export const ChannelListScreen: React.FC = () => {
() => ({
...baseFilters,
members: {
$in: [chatClientUserId || ''],
$in: [chatClientUserId],
},
}),
[chatClientUserId],
Expand All @@ -98,12 +97,14 @@ export const ChannelListScreen: React.FC = () => {
</View>
);

if (!chatClient) return null;

const setScrollRef = (ref: React.RefObject<FlatList<Channel<StreamChatGenerics>> | null>) => {
scrollRef.current = ref;
};

if (!chatClient) {
return null;
}

return (
<View
style={[
Expand Down
4 changes: 2 additions & 2 deletions examples/SampleApp/src/screens/ChannelScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ export const ChannelScreen: React.FC<ChannelScreenProps> = ({
if (!chatClient || !channelId) return;

const newChannel = chatClient?.channel('messaging', channelId);
setChannel(newChannel);

if (!newChannel?.initialized) {
await newChannel?.watch();
}
setChannel(newChannel);
};

initChannel();
}, [channelId]);
}, [channelId, chatClient]);

useFocusEffect(() => {
setSelectedThread(undefined);
Expand Down
Loading