Page MenuHomePhabricator

D9050.diff
No OneTemporary

D9050.diff

diff --git a/native/chat/timestamp.react.js b/native/chat/timestamp.react.js
--- a/native/chat/timestamp.react.js
+++ b/native/chat/timestamp.react.js
@@ -15,11 +15,25 @@
};
function Timestamp(props: Props): React.Node {
const styles = useStyles(unboundStyles);
- const style = [styles.timestamp];
- if (props.display === 'modal') {
- style.push(styles.modal);
- }
- return <SingleLine style={style}>{longAbsoluteDate(props.time)}</SingleLine>;
+ const style = React.useMemo(
+ () =>
+ props.display === 'modal'
+ ? [styles.timestamp, styles.modal]
+ : [styles.timestamp],
+ [props.display, styles.modal, styles.timestamp],
+ );
+
+ const absoluteDate = React.useMemo(
+ () => longAbsoluteDate(props.time),
+ [props.time],
+ );
+
+ const timestamp = React.useMemo(
+ () => <SingleLine style={style}>{absoluteDate}</SingleLine>,
+ [absoluteDate, style],
+ );
+
+ return timestamp;
}
const timestampHeight = 26;

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 11:00 AM (18 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2570315
Default Alt Text
D9050.diff (971 B)

Event Timeline