Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve this binding issues #209

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/uikit-chat-hooks/src/common/useUserList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const useUserList = <
});

const next = useFreshCallback(async () => {
if (query.current && query.current?.hasNext) {
if (query.current && query.current?.hasNext && !query.current.isLoading) {
const nextUsers = await query.current.next().catch((e) => {
Logger.error(e);
if (e.code === SBErrorCode.UNAUTHORIZED_REQUEST) Logger.warn(SBErrorMessage.ACL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const useTypingTrigger = (text: string, channel: SendbirdBaseChannel) => {
() => {
function triggerTyping() {
if (channel.isGroupChannel()) {
const action = text.length === 0 ? channel.endTyping : channel.startTyping;
const action = () => (text.length === 0 ? channel.endTyping() : channel.startTyping());
action().catch((error) => {
Logger.debug('ChannelInput: Failed to trigger typing', error);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ const BottomSheetReactionAddon = ({ onClose, message, channel }: Props) => {
const reacted = currentUserIdx > -1;

const onPress = async () => {
const action = reacted ? channel.deleteReaction : channel.addReaction;
const action = (message: BaseMessage, key: string) => {
return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);
};

await action(message, key)
.catch((error) => {
Logger.warn('Failed to reaction', error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { FlatList, Pressable, View, useWindowDimensions } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

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

Expand Down Expand Up @@ -56,7 +57,10 @@ const ReactionListBottomSheet = ({ visible, onClose, onDismiss, reactionCtx, cha
key={key}
onPress={async () => {
if (message && channel) {
const action = reacted ? channel.deleteReaction : channel.addReaction;
const action = (message: BaseMessage, key: string) => {
return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);
};

action(message, key).catch((error) => {
Logger.warn('Failed to reaction', error);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const usePushTokenRegistration = () => {
default: (token: string) => sdk.unregisterFCMPushTokenForCurrentUser(token),
}),
Platform.select({
ios: notificationService.getAPNSToken,
default: notificationService.getFCMToken,
ios: () => notificationService.getAPNSToken(),
default: () => notificationService.getFCMToken(),
}),
];
});
Expand Down