diff --git a/native/chat/chat-thread-list-sidebar.react.js b/native/chat/chat-thread-list-sidebar.react.js
index 775f18692..646531d83 100644
--- a/native/chat/chat-thread-list-sidebar.react.js
+++ b/native/chat/chat-thread-list-sidebar.react.js
@@ -1,117 +1,151 @@
// @flow
import * as React from 'react';
import { View } from 'react-native';
import type { ThreadInfo, SidebarInfo } from 'lib/types/thread-types.js';
import { SidebarItem, sidebarHeight } from './sidebar-item.react.js';
import SwipeableThread from './swipeable-thread.react.js';
import Button from '../components/button.react.js';
import UnreadDot from '../components/unread-dot.react.js';
import { useColors, useStyles } from '../themes/colors.js';
import ExtendedArrow from '../vectors/arrow-extended.react.js';
import Arrow from '../vectors/arrow.react.js';
type Props = {
+sidebarInfo: SidebarInfo,
+onPressItem: (threadInfo: ThreadInfo) => void,
+onSwipeableWillOpen: (threadInfo: ThreadInfo) => void,
+currentlyOpenedSwipeableId: string,
+extendArrow: boolean,
};
function ChatThreadListSidebar(props: Props): React.Node {
const colors = useColors();
const styles = useStyles(unboundStyles);
const {
sidebarInfo,
onSwipeableWillOpen,
currentlyOpenedSwipeableId,
onPressItem,
extendArrow = false,
} = props;
- let arrow;
- if (extendArrow) {
- arrow = (
-
-
-
- );
- } else {
- arrow = (
-
-
-
- );
- }
-
const { threadInfo } = sidebarInfo;
const onPress = React.useCallback(
() => onPressItem(threadInfo),
[threadInfo, onPressItem],
);
- return (
-
+ ),
+ [
+ currentlyOpenedSwipeableId,
+ onSwipeableWillOpen,
+ sidebarInfo,
+ styles.swipeableThreadContainer,
+ ],
+ );
+
+ const chatThreadListSidebar = React.useMemo(
+ () => (
+
+ ),
+ [
+ arrow,
+ colors.listIosHighlightUnderlay,
+ onPress,
+ styles.sidebar,
+ swipeableThread,
+ unreadIndicator,
+ ],
);
+
+ return chatThreadListSidebar;
}
const unboundStyles = {
arrow: {
left: 28,
position: 'absolute',
top: -12,
},
extendedArrow: {
left: 28,
position: 'absolute',
top: -6,
},
sidebar: {
alignItems: 'center',
flexDirection: 'row',
width: '100%',
height: sidebarHeight,
paddingLeft: 6,
paddingRight: 18,
backgroundColor: 'listBackground',
},
swipeableThreadContainer: {
flex: 1,
height: '100%',
},
unreadIndicatorContainer: {
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'flex-start',
paddingLeft: 6,
width: 56,
},
};
export default ChatThreadListSidebar;