From 1c225f0dd7caaffa9501f9a86a1e1f9937b36f56 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 23 Apr 2021 16:09:58 -0400 Subject: fixed slowness --- src/components/messages/ChannelPreview.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/components/messages/ChannelPreview.tsx') diff --git a/src/components/messages/ChannelPreview.tsx b/src/components/messages/ChannelPreview.tsx index 4a0cee0b..87b94179 100644 --- a/src/components/messages/ChannelPreview.tsx +++ b/src/components/messages/ChannelPreview.tsx @@ -1,5 +1,5 @@ import {useNavigation} from '@react-navigation/core'; -import React, {useContext} from 'react'; +import React, {useContext, useState} from 'react'; import {Image, StyleSheet, Text, View} from 'react-native'; import { RectButton, @@ -41,7 +41,7 @@ const ChannelPreview: React.FC< const member = getMember(channel, state); const online = isOnline(member?.user?.last_active); const unread = channel.state.unreadCount > 0; - const isMuted = channel.muteStatus().muted; + const [isMuted, setIsMuted] = useState(channel.muteStatus().muted); const mutedImage = isMuted ? require('../../assets/images/unmute.png') : require('../../assets/images/mute.png'); @@ -60,6 +60,7 @@ const ChannelPreview: React.FC< } else { channel.mute(); } + setIsMuted(!isMuted); }}> {isMuted ? 'Unmute' : 'Mute'} -- cgit v1.2.3-70-g09d2