Skip to content

Commit b0ad96b

Browse files
authored
Merge pull request #209 from sendbird/fix/this-binding-issues
fix: resolve this binding issues
2 parents 9547065 + 079a363 commit b0ad96b

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

packages/uikit-chat-hooks/src/common/useUserList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const useUserList = <
119119
});
120120

121121
const next = useFreshCallback(async () => {
122-
if (query.current && query.current?.hasNext) {
122+
if (query.current && query.current?.hasNext && !query.current.isLoading) {
123123
const nextUsers = await query.current.next().catch((e) => {
124124
Logger.error(e);
125125
if (e.code === SBErrorCode.UNAUTHORIZED_REQUEST) Logger.warn(SBErrorMessage.ACL);

packages/uikit-react-native/src/components/ChannelInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const useTypingTrigger = (text: string, channel: SendbirdBaseChannel) => {
192192
() => {
193193
function triggerTyping() {
194194
if (channel.isGroupChannel()) {
195-
const action = text.length === 0 ? channel.endTyping : channel.startTyping;
195+
const action = () => (text.length === 0 ? channel.endTyping() : channel.startTyping());
196196
action().catch((error) => {
197197
Logger.debug('ChannelInput: Failed to trigger typing', error);
198198
});

packages/uikit-react-native/src/components/ReactionAddons/BottomSheetReactionAddon.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ const BottomSheetReactionAddon = ({ onClose, message, channel }: Props) => {
4747
const reacted = currentUserIdx > -1;
4848

4949
const onPress = async () => {
50-
const action = reacted ? channel.deleteReaction : channel.addReaction;
50+
const action = (message: BaseMessage, key: string) => {
51+
return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);
52+
};
53+
5154
await action(message, key)
5255
.catch((error) => {
5356
Logger.warn('Failed to reaction', error);

packages/uikit-react-native/src/components/ReactionBottomSheets/ReactionListBottomSheet.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { FlatList, Pressable, View, useWindowDimensions } from 'react-native';
33
import { useSafeAreaInsets } from 'react-native-safe-area-context';
44

5+
import type { BaseMessage } from '@sendbird/chat/message';
56
import { Image, Modal, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
67
import { Logger } from '@sendbird/uikit-utils';
78

@@ -56,7 +57,10 @@ const ReactionListBottomSheet = ({ visible, onClose, onDismiss, reactionCtx, cha
5657
key={key}
5758
onPress={async () => {
5859
if (message && channel) {
59-
const action = reacted ? channel.deleteReaction : channel.addReaction;
60+
const action = (message: BaseMessage, key: string) => {
61+
return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);
62+
};
63+
6064
action(message, key).catch((error) => {
6165
Logger.warn('Failed to reaction', error);
6266
});

packages/uikit-react-native/src/hooks/usePushTokenRegistration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const usePushTokenRegistration = () => {
2121
default: (token: string) => sdk.unregisterFCMPushTokenForCurrentUser(token),
2222
}),
2323
Platform.select({
24-
ios: notificationService.getAPNSToken,
25-
default: notificationService.getFCMToken,
24+
ios: () => notificationService.getAPNSToken(),
25+
default: () => notificationService.getFCMToken(),
2626
}),
2727
];
2828
});

0 commit comments

Comments
 (0)