diff --git a/samples/react-native-group-chat/screens/ordinary/chat/Chat.tsx b/samples/react-native-group-chat/screens/ordinary/chat/Chat.tsx index b37037a..b66ecd9 100644 --- a/samples/react-native-group-chat/screens/ordinary/chat/Chat.tsx +++ b/samples/react-native-group-chat/screens/ordinary/chat/Chat.tsx @@ -25,7 +25,7 @@ export function ChatScreen({}: StackScreenProps) { useContext(ChatContext) const navigation = useNavigation() const [isMoreMessages, setIsMoreMessages] = useState(true) - const [isLoadingMoreMessages, setIsLoadingMoreMessages] = useState(false) + const [isLoadingMoreMessages, setIsLoadingMoreMessages] = useState(true) const [giftedChatMappedMessages, setGiftedChatMappedMessages] = useState([]) const [typingData, setTypingData] = useState([]) const [messageDraft, setMessageDraft] = useState(null) @@ -155,6 +155,7 @@ export function ChatScreen({}: StackScreenProps) { if (!currentChannel) { return } + setIsLoadingMoreMessages(true) setGiftedChatMappedMessages([]) const historicalMessagesObject = await currentChannel.getHistory({ count: 5 }) @@ -194,6 +195,8 @@ export function ChatScreen({}: StackScreenProps) { .reverse() ) ) + + setIsLoadingMoreMessages(false) } switchChannelImplementation()