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 1414 "@react-native-firebase/messaging" : " ^14.7.0" ,
1515 "@react-navigation/native" : " ^6.1.17" ,
1616 "@react-navigation/native-stack" : " ^6.10.0" ,
17- "@sendbird/chat" : " ^4.12.9 " ,
17+ "@sendbird/chat" : " ^4.13.3 " ,
1818 "date-fns" : " ^4.1.0" ,
1919 "react" : " 18.2.0" ,
2020 "react-native" : " 0.74.3" ,
Original file line number Diff line number Diff line change 9898 ]
9999 },
100100 "resolutions" : {
101- "@sendbird/chat" : " 4.12.9 " ,
101+ "@sendbird/chat" : " 4.13.3 " ,
102102 "@types/react" : " ^18"
103103 }
104104}
Original file line number Diff line number Diff line change 5555 "typescript" : " 5.2.2"
5656 },
5757 "peerDependencies" : {
58- "@sendbird/chat" : " ^4.12.9 " ,
58+ "@sendbird/chat" : " ^4.13.3 " ,
5959 "react" : " >=16.13.1"
6060 },
6161 "react-native-builder-bob" : {
Original file line number Diff line number Diff line change 109109 "@react-native-clipboard/clipboard" : " >=1.8.5" ,
110110 "@react-native-community/netinfo" : " >=9.3.0" ,
111111 "@react-native-firebase/messaging" : " >=14.4.0" ,
112- "@sendbird/chat" : " ^4.12.9 " ,
112+ "@sendbird/chat" : " ^4.13.3 " ,
113113 "@sendbird/react-native-scrollview-enhancer" : " *" ,
114114 "date-fns" : " >=2.28.0" ,
115115 "expo-av" : " >=12.0.4" ,
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
7575 } ) ;
7676
7777 useEffect ( ( ) => {
78- return subscribe ( ( { type } ) => {
78+ return subscribe ( ( { type, data } ) => {
7979 switch ( type ) {
8080 case 'TYPING_BUBBLE_RENDERED' :
8181 case 'MESSAGES_RECEIVED' : {
@@ -84,6 +84,22 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
8484 }
8585 break ;
8686 }
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+ }
87103 case 'MESSAGE_SENT_SUCCESS' :
88104 case 'MESSAGE_SENT_PENDING' : {
89105 scrollToBottom ( false ) ;
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ const GroupChannelThreadMessageList = (props: GroupChannelThreadProps['MessageLi
6969 } ) ;
7070
7171 useEffect ( ( ) => {
72- return subscribe ( ( { type } ) => {
72+ return subscribe ( ( { type, data } ) => {
7373 switch ( type ) {
7474 case 'TYPING_BUBBLE_RENDERED' :
7575 case 'MESSAGES_RECEIVED' : {
@@ -78,6 +78,21 @@ const GroupChannelThreadMessageList = (props: GroupChannelThreadProps['MessageLi
7878 }
7979 break ;
8080 }
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+ }
8196 case 'MESSAGE_SENT_SUCCESS' :
8297 case 'MESSAGE_SENT_PENDING' : {
8398 scrollToBottom ( false ) ;
Original file line number Diff line number Diff line change 3939 "access" : " public"
4040 },
4141 "devDependencies" : {
42- "@sendbird/chat" : " ^4.12.9 " ,
42+ "@sendbird/chat" : " ^4.13.3 " ,
4343 "@sendbird/uikit-utils" : " 3.7.4" ,
4444 "@types/jest" : " ^29.4.0" ,
4545 "@types/react" : " *" ,
Original file line number Diff line number Diff line change 5656 "typescript" : " 5.2.2"
5757 },
5858 "peerDependencies" : {
59- "@sendbird/chat" : " ^4.12.9 " ,
59+ "@sendbird/chat" : " ^4.13.3 " ,
6060 "date-fns" : " >=2.28.0" ,
6161 "react" : " >=17.0.2" ,
6262 "react-native" : " >=0.65.0"
Original file line number Diff line number Diff line change 2828 "@react-navigation/bottom-tabs" : " ^6.6.0" ,
2929 "@react-navigation/native" : " ^6.1.17" ,
3030 "@react-navigation/native-stack" : " ^6.10.0" ,
31- "@sendbird/chat" : " ^4.12.9 " ,
31+ "@sendbird/chat" : " ^4.13.3 " ,
3232 "@storybook/addon-actions" : " ^6.4.19" ,
3333 "@storybook/addon-controls" : " ^6.4.19" ,
3434 "@storybook/addon-ondevice-actions" : " ^6.0.1-alpha.7" ,
Original file line number Diff line number Diff line change 47034703 mkdirp "^1.0.4"
47044704 rimraf "^3.0.2"
47054705
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 ==
47104710
4711471147124712 version "0.0.1-alpha.77"
You can’t perform that action at this time.
0 commit comments