stream-chat-react-native-core 5.9.0 → 5.9.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.9.0"
2
+ "version": "5.9.1-beta.2"
3
3
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native-core",
3
3
  "description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
4
- "version": "5.9.0",
4
+ "version": "5.9.1-beta.2",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -35,8 +35,8 @@ import { useCreateTypingContext } from './hooks/useCreateTypingContext';
35
35
  import { useTargetedMessage } from './hooks/useTargetedMessage';
36
36
 
37
37
  import { ChannelContextValue, ChannelProvider } from '../../contexts/channelContext/ChannelContext';
38
- import { useChannelState } from '../../contexts/channelsStateContext/useChannelState';
39
38
  import type { UseChannelStateValue } from '../../contexts/channelsStateContext/useChannelState';
39
+ import { useChannelState } from '../../contexts/channelsStateContext/useChannelState';
40
40
  import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext';
41
41
  import {
42
42
  InputMessageInputContextValue,
@@ -771,25 +771,29 @@ const ChannelWithContext = <
771
771
  const channelSubscriptions: Array<ReturnType<ChannelType['on']>> = [];
772
772
  const clientSubscriptions: Array<ReturnType<StreamChat['on']>> = [];
773
773
 
774
- const subscribe = () => {
775
- if (!channel) return;
774
+ if (!channel) return;
776
775
 
777
- /**
778
- * The more complex sync logic around internet connectivity (NetInfo) is part of Chat.tsx
779
- * listen to client.connection.recovered and all channel events
780
- */
776
+ clientSubscriptions.push(
777
+ client.on('channel.deleted', (event) => {
778
+ if (event.cid === channel.cid) {
779
+ setDeleted(true);
780
+ }
781
+ }),
782
+ );
783
+
784
+ if (enableOfflineSupport) {
781
785
  clientSubscriptions.push(DBSyncManager.onSyncStatusChange(connectionChangedHandler));
786
+ } else {
782
787
  clientSubscriptions.push(
783
- client.on('channel.deleted', (event) => {
784
- if (event.cid === channel.cid) {
785
- setDeleted(true);
788
+ client.on('connection.changed', (event) => {
789
+ if (event.online) {
790
+ connectionChangedHandler();
786
791
  }
787
792
  }),
788
793
  );
789
- channelSubscriptions.push(channel.on(handleEvent));
790
- };
794
+ }
791
795
 
792
- subscribe();
796
+ channelSubscriptions.push(channel.on(handleEvent));
793
797
 
794
798
  return () => {
795
799
  clientSubscriptions.forEach((s) => s.unsubscribe());
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.9.0"
2
+ "version": "5.9.1-beta.2"
3
3
  }