Skip to content

Commit eeb5b5d

Browse files
isekovanicStream-SDK-BotStream Bot
authored
Next Release (#3607)
## 🎯 Goal <!-- Describe why we are making this change --> ## πŸ›  Implementation details <!-- Provide a description of the implementation --> ## 🎨 UI Changes <!-- Add relevant screenshots --> <details> <summary>iOS</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <details> <summary>Android</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> ## πŸ§ͺ Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## β˜‘οΈ Checklist - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [ ] PR targets the `develop` branch - [ ] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [ ] Expo iOS and Android --------- Co-authored-by: Stream SDK Bot <60655709+Stream-SDK-Bot@users.noreply.github.com> Co-authored-by: Stream Bot <runner@runnervmrw5os.iok0aac14kyebbpycwio1tqtlb.gx.internal.cloudapp.net>
2 parents b978fe5 + 0b7977a commit eeb5b5d

24 files changed

Lines changed: 111 additions & 189 deletions

File tree

β€Ž.gitignoreβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ index.android.bundle
2424
*.DSYM.zip
2525
**/metrics/
2626
package/shared-native/.sync-state/
27+
28+
.claude/worktrees

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native)
1111
[![Build Status](https://github.com/GetStream/stream-chat-react-native/actions/workflows/release.yml/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions)
1212
[![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative)
13-
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-360%20KB-blue)
13+
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-368%20KB-blue)
1414

1515
<img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/iphone_chat_art@3x.png?auto=format,enhance" width="50%" />
1616

β€Žexamples/ExpoMessaging/app/channel/[cid]/index.tsxβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export default function ChannelScreen() {
7373
channel={channel}
7474
onPressMessage={onPressMessage}
7575
keyboardVerticalOffset={headerHeight}
76+
topInset={headerHeight}
7677
thread={thread}
7778
>
7879
<MessageList

β€Žexamples/ExpoMessaging/app/channel/[cid]/thread/[cid]/index.tsxβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default function ThreadScreen() {
1919
audioRecordingEnabled={true}
2020
channel={channel}
2121
keyboardVerticalOffset={Platform.OS === 'ios' ? headerHeight : undefined}
22+
topInset={headerHeight}
2223
thread={thread}
2324
threadList
2425
>

β€Žexamples/ExpoMessaging/package.jsonβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@
4747
"react-dom": "19.2.0",
4848
"react-native": "0.83.2",
4949
"react-native-gesture-handler": "~2.30.0",
50+
"react-native-keyboard-controller": "1.20.7",
5051
"react-native-maps": "1.26.20",
5152
"react-native-reanimated": "4.2.1",
5253
"react-native-safe-area-context": "~5.6.2",
5354
"react-native-screens": "~4.23.0",
5455
"react-native-svg": "15.15.3",
55-
"react-native-web": "^0.21.0",
5656
"react-native-teleport": "^1.0.2",
57+
"react-native-web": "^0.21.0",
5758
"react-native-worklets": "0.7.2",
5859
"stream-chat-expo": "link:../../package/expo-package",
5960
"stream-chat-react-native-core": "link:../../package"

β€Žexamples/ExpoMessaging/yarn.lockβ€Ž

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5526,6 +5526,13 @@ react-native-is-edge-to-edge@1.2.1, react-native-is-edge-to-edge@^1.2.1:
55265526
resolved "https://registry.yarnpkg.com/react-native-is-edge-to-edge/-/react-native-is-edge-to-edge-1.2.1.tgz#64e10851abd9d176cbf2b40562f751622bde3358"
55275527
integrity sha512-FLbPWl/MyYQWz+KwqOZsSyj2JmLKglHatd3xLZWskXOpRaio4LfEDEz8E/A6uD8QoTHW6Aobw1jbEwK7KMgR7Q==
55285528

5529+
react-native-keyboard-controller@1.20.7:
5530+
version "1.20.7"
5531+
resolved "https://registry.yarnpkg.com/react-native-keyboard-controller/-/react-native-keyboard-controller-1.20.7.tgz#e1be1c15a5eb10b96a40a0812d8472e6e4bd8f29"
5532+
integrity sha512-G8S5jz1FufPrcL1vPtReATx+jJhT/j+sTqxMIb30b1z7cYEfMlkIzOCyaHgf6IMB2KA9uBmnA5M6ve2A9Ou4kw==
5533+
dependencies:
5534+
react-native-is-edge-to-edge "^1.2.1"
5535+
55295536
react-native-lightbox@^0.7.0:
55305537
version "0.7.0"
55315538
resolved "https://registry.yarnpkg.com/react-native-lightbox/-/react-native-lightbox-0.7.0.tgz#e52b4d7fcc141f59d7b23f0180de535e35b20ec9"
@@ -6073,10 +6080,10 @@ stream-chat-react-native-core@8.1.0:
60736080
version "0.0.0"
60746081
uid ""
60756082

6076-
stream-chat@^9.42.1:
6077-
version "9.42.1"
6078-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.42.1.tgz#8b6aa4e3e73a39ed07bb2a4f2a6829ba9354567a"
6079-
integrity sha512-o+9wQO4Ruu1A48T0IrX9ZH8+9F5xPgGLPvflaswaPeLyIZXcy8bsQdcT/HSrPmT7gs0WGD3qcbXaAJU5lMQezQ==
6083+
stream-chat@^9.44.2:
6084+
version "9.44.2"
6085+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.44.2.tgz#97d23ae4ac356b352bb0f20a31a29dc63d3ea6f5"
6086+
integrity sha512-TXALWeHyWnSn1KlGYEF0sltEHB26vFd26l5m1qlE9Q1XHo9RPPSyLb5mfXqTEY8b2FAv57Ei3hrT8nSXVWacDQ==
60806087
dependencies:
60816088
"@types/jsonwebtoken" "^9.0.8"
60826089
"@types/ws" "^8.5.14"

β€Žpackage/package.jsonβ€Ž

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
"emoji-mart": ">=5.4.0",
9595
"react-native": ">=0.73.0",
9696
"react-native-gesture-handler": ">=2.18.0",
97-
"react-native-keyboard-controller": ">=1.20.2",
9897
"react-native-reanimated": ">=3.16.0",
9998
"react-native-safe-area-context": ">=5.4.1",
10099
"react-native-svg": ">=15.8.0",
@@ -112,9 +111,6 @@
112111
},
113112
"@emoji-mart/data": {
114113
"optional": true
115-
},
116-
"react-native-keyboard-controller": {
117-
"optional": true
118114
}
119115
},
120116
"devDependencies": {
@@ -163,7 +159,6 @@
163159
"react-native": "0.80.2",
164160
"react-native-builder-bob": "0.40.11",
165161
"react-native-gesture-handler": "^2.26.0",
166-
"react-native-keyboard-controller": "^1.20.2",
167162
"react-native-reanimated": "3.18.0",
168163
"react-native-safe-area-context": "^5.6.1",
169164
"react-native-svg": "15.12.0",

β€Žpackage/src/components/AttachmentPicker/AttachmentPicker.tsxβ€Ž

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect, useMemo, useRef, useState } from 'react';
22
import {
33
BackHandler,
4-
EmitterSubscription,
54
Keyboard,
65
Platform,
76
View,
@@ -21,7 +20,6 @@ import { useComponentsContext } from '../../contexts/componentsContext/Component
2120
import { useTheme } from '../../contexts/themeContext/ThemeContext';
2221
import { useStableCallback } from '../../hooks';
2322
import { BottomSheet } from '../BottomSheetCompatibility/BottomSheet';
24-
import { KeyboardControllerPackage } from '../KeyboardCompatibleView/KeyboardControllerAvoidingView';
2523

2624
dayjs.extend(duration);
2725

@@ -41,6 +39,7 @@ export const AttachmentPicker = () => {
4139
attachmentPickerBottomSheetHeight,
4240
bottomSheetRef: ref,
4341
bottomInset,
42+
topInset,
4443
disableAttachmentPicker,
4544
} = useAttachmentPickerContext();
4645
const { AttachmentPickerContent, AttachmentPickerSelectionBar } = useComponentsContext();
@@ -78,18 +77,10 @@ export const AttachmentPicker = () => {
7877
}
7978
closePicker();
8079
};
81-
let keyboardSubscription: EmitterSubscription | null = null;
82-
if (KeyboardControllerPackage?.KeyboardEvents) {
83-
keyboardSubscription = KeyboardControllerPackage.KeyboardEvents.addListener(
84-
'keyboardWillShow',
85-
onKeyboardOpenHandler,
86-
);
87-
} else {
88-
const keyboardShowEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
89-
keyboardSubscription = Keyboard.addListener(keyboardShowEvent, onKeyboardOpenHandler);
90-
}
80+
const keyboardShowEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
81+
const keyboardSubscription = Keyboard.addListener(keyboardShowEvent, onKeyboardOpenHandler);
9182
return () => {
92-
keyboardSubscription?.remove();
83+
keyboardSubscription.remove();
9384
};
9485
}, [attachmentPickerStore, closePicker]);
9586

@@ -104,7 +95,7 @@ export const AttachmentPicker = () => {
10495
const initialSnapPoint = attachmentPickerBottomSheetHeight;
10596
const pickerTopInset = Math.max(
10697
0,
107-
windowHeight - attachmentPickerBottomSheetHeight - bottomInset,
98+
windowHeight - topInset - attachmentPickerBottomSheetHeight - bottomInset,
10899
);
109100

110101
/**

β€Žpackage/src/components/Channel/Channel.tsxβ€Ž

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ import {
114114
} from '../../utils/utils';
115115
import { NotificationAnnouncer } from '../Accessibility/NotificationAnnouncer';
116116
import { AttachmentPicker } from '../AttachmentPicker/AttachmentPicker';
117-
import type { KeyboardCompatibleViewProps } from '../KeyboardCompatibleView/KeyboardControllerAvoidingView';
117+
import type { KeyboardCompatibleViewProps } from '../KeyboardCompatibleView/KeyboardCompatibleView';
118118
import { Emoji } from '../MessageMenu/EmojiPickerList';
119119
import { emojis } from '../MessageMenu/emojis';
120120
import { toUnicodeScalarString } from '../MessageMenu/utils/toUnicodeScalarString';
@@ -496,7 +496,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
496496
thread: threadFromProps,
497497
threadList,
498498
threadMessages,
499-
topInset,
499+
topInset = 0,
500500
isOnline,
501501
maximumMessageLimit,
502502
initializeOnMount = true,
@@ -567,6 +567,18 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
567567
channel,
568568
});
569569

570+
const shouldLoadInitialChannelAtFirstUnreadMessage = useStableCallback((unreadCount?: number) => {
571+
if (messageId || !initialScrollToFirstUnreadMessage || !client.user) {
572+
return false;
573+
}
574+
575+
return (unreadCount ?? channel.countUnread()) > scrollToFirstUnreadThreshold;
576+
});
577+
578+
const hasPendingInitialTargetLoad = useStableCallback(() => {
579+
return !!messageId || shouldLoadInitialChannelAtFirstUnreadMessage();
580+
});
581+
570582
const { setMessages: copyMessagesStateFromChannel, viewabilityChangedCallback } =
571583
usePrunableMessageList({ maximumMessageLimit, setMessages: rawCopyMessagesStateFromChannel });
572584

@@ -693,6 +705,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
693705
const initChannel = async () => {
694706
setLastRead(new Date());
695707
const unreadCount = channel.countUnread();
708+
const shouldLoadAtFirstUnread = shouldLoadInitialChannelAtFirstUnreadMessage(unreadCount);
696709
if (!channel || !shouldSyncChannel) {
697710
return;
698711
}
@@ -722,13 +735,14 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
722735

723736
if (messageId) {
724737
await loadChannelAroundMessage({ messageId, setTargetedMessage });
725-
} else if (
726-
initialScrollToFirstUnreadMessage &&
727-
client.user &&
728-
unreadCount > scrollToFirstUnreadThreshold
729-
) {
738+
} else if (shouldLoadAtFirstUnread) {
739+
const clientUserId = client.user?.id;
740+
if (!clientUserId) {
741+
return;
742+
}
743+
730744
// eslint-disable-next-line @typescript-eslint/no-unused-vars
731-
const { user, ...ownReadState } = channel.state.read[client.user.id];
745+
const { user, ...ownReadState } = channel.state.read[clientUserId];
732746

733747
await loadChannelAtFirstUnreadMessage({
734748
channelUnreadState: ownReadState,
@@ -1578,6 +1592,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
15781592
setChannelUnreadState,
15791593
setLastRead,
15801594
setTargetedMessage,
1595+
hasPendingInitialTargetLoad,
15811596
targetedMessage,
15821597
threadList,
15831598
uploadAbortControllerRef,

β€Žpackage/src/components/Channel/hooks/useCreateChannelContext.tsβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const useCreateChannelContext = ({
2727
setChannelUnreadState,
2828
setLastRead,
2929
setTargetedMessage,
30+
hasPendingInitialTargetLoad,
3031
targetedMessage,
3132
threadList,
3233
uploadAbortControllerRef,
@@ -69,6 +70,7 @@ export const useCreateChannelContext = ({
6970
setChannelUnreadState,
7071
setLastRead,
7172
setTargetedMessage,
73+
hasPendingInitialTargetLoad,
7274
targetedMessage,
7375
threadList,
7476
uploadAbortControllerRef,

0 commit comments

Comments
Β (0)