Skip to content

Commit 5b4133e

Browse files
gnpricechrisbobbe
authored andcommitted
StreamItem [nfc]: Memoize style for stream name, too
1 parent f5bdded commit 5b4133e

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/streams/StreamItem.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,18 @@ export default function StreamItem(props: Props): Node {
131131
backgroundColor,
132132
opacity: isMuted ? 0.5 : 1,
133133
},
134-
description: {
135-
opacity: 0.75,
136-
fontSize: 12,
137-
},
138134
text: {
139135
flex: 1,
140136
paddingLeft: 8,
141137
paddingRight: 8,
142138
},
139+
name: {
140+
color: textColor,
141+
},
142+
description: {
143+
opacity: 0.75,
144+
fontSize: 12,
145+
},
143146
collapseIcon: {
144147
marginRight: 8,
145148
},
@@ -153,7 +156,7 @@ export default function StreamItem(props: Props): Node {
153156
paddingRight: 0,
154157
},
155158
}),
156-
[backgroundColor, handleExpandCollapse, isMuted],
159+
[backgroundColor, handleExpandCollapse, isMuted, textColor],
157160
);
158161

159162
return (
@@ -186,12 +189,7 @@ export default function StreamItem(props: Props): Node {
186189
isWebPublic={isWebPublic}
187190
/>
188191
<View style={styles.text}>
189-
<ZulipText
190-
numberOfLines={1}
191-
style={{ color: textColor }}
192-
text={name}
193-
ellipsizeMode="tail"
194-
/>
192+
<ZulipText numberOfLines={1} style={styles.name} text={name} ellipsizeMode="tail" />
195193
{description !== undefined && description !== '' && (
196194
<ZulipText
197195
numberOfLines={1}

0 commit comments

Comments
 (0)