diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-23 16:09:58 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-04-23 16:09:58 -0400 |
commit | 1c225f0dd7caaffa9501f9a86a1e1f9937b36f56 (patch) | |
tree | 62f55fd3a5c3047eca413fd53734fb80c455ddd5 | |
parent | 80237632843c123253b572f571bb6c336a4fad4e (diff) |
fixed slowness
-rw-r--r-- | src/components/messages/ChannelPreview.tsx | 5 |
1 files changed, 3 insertions, 2 deletions
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); }}> <Image source={mutedImage} style={styles.icon} /> <Text style={styles.actionText}>{isMuted ? 'Unmute' : 'Mute'}</Text> |