File tree Expand file tree Collapse file tree 10 files changed +44
-13
lines changed
groupChannelThread/component Expand file tree Collapse file tree 10 files changed +44
-13
lines changed Original file line number Diff line number Diff line change 14
14
"@react-native-firebase/messaging" : " ^14.7.0" ,
15
15
"@react-navigation/native" : " ^6.1.17" ,
16
16
"@react-navigation/native-stack" : " ^6.10.0" ,
17
- "@sendbird/chat" : " ^4.12.9 " ,
17
+ "@sendbird/chat" : " ^4.13.3 " ,
18
18
"date-fns" : " ^4.1.0" ,
19
19
"react" : " 18.2.0" ,
20
20
"react-native" : " 0.74.3" ,
Original file line number Diff line number Diff line change 98
98
]
99
99
},
100
100
"resolutions" : {
101
- "@sendbird/chat" : " 4.12.9 " ,
101
+ "@sendbird/chat" : " 4.13.3 " ,
102
102
"@types/react" : " ^18"
103
103
}
104
104
}
Original file line number Diff line number Diff line change 55
55
"typescript" : " 5.2.2"
56
56
},
57
57
"peerDependencies" : {
58
- "@sendbird/chat" : " ^4.12.9 " ,
58
+ "@sendbird/chat" : " ^4.13.3 " ,
59
59
"react" : " >=16.13.1"
60
60
},
61
61
"react-native-builder-bob" : {
Original file line number Diff line number Diff line change 109
109
"@react-native-clipboard/clipboard" : " >=1.8.5" ,
110
110
"@react-native-community/netinfo" : " >=9.3.0" ,
111
111
"@react-native-firebase/messaging" : " >=14.4.0" ,
112
- "@sendbird/chat" : " ^4.12.9 " ,
112
+ "@sendbird/chat" : " ^4.13.3 " ,
113
113
"@sendbird/react-native-scrollview-enhancer" : " *" ,
114
114
"date-fns" : " >=2.28.0" ,
115
115
"expo-av" : " >=12.0.4" ,
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
75
75
} ) ;
76
76
77
77
useEffect ( ( ) => {
78
- return subscribe ( ( { type } ) => {
78
+ return subscribe ( ( { type, data } ) => {
79
79
switch ( type ) {
80
80
case 'TYPING_BUBBLE_RENDERED' :
81
81
case 'MESSAGES_RECEIVED' : {
@@ -84,6 +84,22 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
84
84
}
85
85
break ;
86
86
}
87
+ case 'MESSAGES_UPDATED' : {
88
+ const lastMessage = props . channel . lastMessage ;
89
+ const [ updatedMessage ] = data . messages ;
90
+
91
+ const lastMessageUpdated =
92
+ updatedMessage && lastMessage && lastMessage . messageId === updatedMessage . messageId ;
93
+
94
+ const isMaybeStreaming = props . channel . hasAiBot && lastMessageUpdated ;
95
+
96
+ if ( isMaybeStreaming ) {
97
+ scrollToBottom ( false ) ;
98
+ } else if ( ! props . scrolledAwayFromBottom && lastMessageUpdated ) {
99
+ scrollToBottom ( true ) ;
100
+ }
101
+ break ;
102
+ }
87
103
case 'MESSAGE_SENT_SUCCESS' :
88
104
case 'MESSAGE_SENT_PENDING' : {
89
105
scrollToBottom ( false ) ;
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ const GroupChannelThreadMessageList = (props: GroupChannelThreadProps['MessageLi
69
69
} ) ;
70
70
71
71
useEffect ( ( ) => {
72
- return subscribe ( ( { type } ) => {
72
+ return subscribe ( ( { type, data } ) => {
73
73
switch ( type ) {
74
74
case 'TYPING_BUBBLE_RENDERED' :
75
75
case 'MESSAGES_RECEIVED' : {
@@ -78,6 +78,21 @@ const GroupChannelThreadMessageList = (props: GroupChannelThreadProps['MessageLi
78
78
}
79
79
break ;
80
80
}
81
+ case 'MESSAGES_UPDATED' : {
82
+ const lastMessage = props . channel . lastMessage ;
83
+ const [ updatedMessage ] = data . messages ;
84
+
85
+ const lastMessageUpdated =
86
+ updatedMessage && lastMessage && lastMessage . messageId === updatedMessage . messageId ;
87
+ const isMaybeStreaming = props . channel . hasAiBot && lastMessageUpdated ;
88
+
89
+ if ( isMaybeStreaming ) {
90
+ scrollToBottom ( false ) ;
91
+ } else if ( ! props . scrolledAwayFromBottom && lastMessageUpdated ) {
92
+ scrollToBottom ( true ) ;
93
+ }
94
+ break ;
95
+ }
81
96
case 'MESSAGE_SENT_SUCCESS' :
82
97
case 'MESSAGE_SENT_PENDING' : {
83
98
scrollToBottom ( false ) ;
Original file line number Diff line number Diff line change 39
39
"access" : " public"
40
40
},
41
41
"devDependencies" : {
42
- "@sendbird/chat" : " ^4.12.9 " ,
42
+ "@sendbird/chat" : " ^4.13.3 " ,
43
43
"@sendbird/uikit-utils" : " 3.7.4" ,
44
44
"@types/jest" : " ^29.4.0" ,
45
45
"@types/react" : " *" ,
Original file line number Diff line number Diff line change 56
56
"typescript" : " 5.2.2"
57
57
},
58
58
"peerDependencies" : {
59
- "@sendbird/chat" : " ^4.12.9 " ,
59
+ "@sendbird/chat" : " ^4.13.3 " ,
60
60
"date-fns" : " >=2.28.0" ,
61
61
"react" : " >=17.0.2" ,
62
62
"react-native" : " >=0.65.0"
Original file line number Diff line number Diff line change 28
28
"@react-navigation/bottom-tabs" : " ^6.6.0" ,
29
29
"@react-navigation/native" : " ^6.1.17" ,
30
30
"@react-navigation/native-stack" : " ^6.10.0" ,
31
- "@sendbird/chat" : " ^4.12.9 " ,
31
+ "@sendbird/chat" : " ^4.13.3 " ,
32
32
"@storybook/addon-actions" : " ^6.4.19" ,
33
33
"@storybook/addon-controls" : " ^6.4.19" ,
34
34
"@storybook/addon-ondevice-actions" : " ^6.0.1-alpha.7" ,
Original file line number Diff line number Diff line change 4703
4703
mkdirp "^1.0.4"
4704
4704
rimraf "^3.0.2"
4705
4705
4706
- "@sendbird/chat@4.12.9 ", "@sendbird/chat@^4.12.9 ":
4707
- version "4.12.9 "
4708
- resolved "https://registry.yarnpkg.com/@sendbird/chat/-/chat-4.12.9 .tgz#7f1b8f70f647c35dd9e8729a9f772868593dc739 "
4709
- integrity sha512-vHU18zfCmxxU65vNVz0URH/MUh+0nfz13uUaXOTrbw9ABw2KqiYko27O9c+ptc9Z9E+LhlhAhJIxB7LIdh+YCQ ==
4706
+ "@sendbird/chat@4.13.3 ", "@sendbird/chat@^4.13.3 ":
4707
+ version "4.13.3 "
4708
+ resolved "https://registry.yarnpkg.com/@sendbird/chat/-/chat-4.13.3 .tgz#d8cc7b58ea0562e3661303d73bc1a0722bae37d9 "
4709
+ integrity sha512-JRlhmyEMrHxoLNZIl+C94I9TzXOFVnWVz0NErcv8L/JD9ryzcgq6pJi0z8kOYCJZKs/YTpCISV9wHEUo6dI8xw ==
4710
4710
4711
4711
"@sendbird/uikit-tools@0.0.1-alpha.77":
4712
4712
version "0.0.1-alpha.77"
You can’t perform that action at this time.
0 commit comments