diff --git a/native/components/thread-list-thread.react.js b/native/components/thread-list-thread.react.js index 8c9afaac6..84fd6fb59 100644 --- a/native/components/thread-list-thread.react.js +++ b/native/components/thread-list-thread.react.js @@ -1,72 +1,86 @@ // @flow import * as React from 'react'; -import { type ThreadInfo } from 'lib/types/thread-types'; +import type { ThreadInfo, ResolvedThreadInfo } from 'lib/types/thread-types'; +import { useResolvedThreadInfo } from 'lib/utils/entity-helpers'; import { type Colors, useStyles, useColors } from '../themes/colors'; import type { ViewStyle, TextStyle } from '../types/styles'; import Button from './button.react'; import ColorSplotch from './color-splotch.react'; import { SingleLine } from './single-line.react'; -type BaseProps = { - +threadInfo: ThreadInfo, +type SharedProps = { +onSelect: (threadID: string) => void, +style?: ViewStyle, +textStyle?: TextStyle, }; +type BaseProps = { + ...SharedProps, + +threadInfo: ThreadInfo, +}; type Props = { - ...BaseProps, + ...SharedProps, + +threadInfo: ResolvedThreadInfo, +colors: Colors, +styles: typeof unboundStyles, }; class ThreadListThread extends React.PureComponent { render() { const { modalIosHighlightUnderlay: underlayColor } = this.props.colors; return ( ); } onSelect = () => { this.props.onSelect(this.props.threadInfo.id); }; } const unboundStyles = { button: { alignItems: 'center', flexDirection: 'row', paddingLeft: 13, }, text: { color: 'modalForegroundLabel', fontSize: 16, paddingLeft: 9, paddingRight: 12, paddingVertical: 6, }, }; const ConnectedThreadListThread: React.ComponentType = React.memo( function ConnectedThreadListThread(props: BaseProps) { + const { threadInfo, ...rest } = props; const styles = useStyles(unboundStyles); const colors = useColors(); + const resolvedThreadInfo = useResolvedThreadInfo(threadInfo); - return ; + return ( + + ); }, ); export default ConnectedThreadListThread;