diff --git a/native/chat/thread-settings-button.react.js b/native/chat/thread-settings-button.react.js index 32f631f63..b0c7950dd 100644 --- a/native/chat/thread-settings-button.react.js +++ b/native/chat/thread-settings-button.react.js @@ -1,57 +1,54 @@ // @flow -import PropTypes from 'prop-types'; import * as React from 'react'; import Icon from 'react-native-vector-icons/Ionicons'; -import { type ThreadInfo, threadInfoPropType } from 'lib/types/thread-types'; -import { connect } from 'lib/utils/redux-utils'; +import { type ThreadInfo } from 'lib/types/thread-types'; import Button from '../components/button.react'; import { ThreadSettingsRouteName } from '../navigation/route-names'; -import type { AppState } from '../redux/redux-setup'; -import { styleSelector } from '../themes/colors'; +import { useStyles } from '../themes/colors'; import type { ChatNavigationProp } from './chat.react'; +type BaseProps = {| + +threadInfo: ThreadInfo, + +navigate: $PropertyType, 'navigate'>, +|}; type Props = {| - threadInfo: ThreadInfo, - navigate: $PropertyType, 'navigate'>, - // Redux state - styles: typeof styles, + ...BaseProps, + +styles: typeof unboundStyles, |}; -class ThreadSettingsButton extends React.PureComponent { - static propTypes = { - threadInfo: threadInfoPropType.isRequired, - navigate: PropTypes.func.isRequired, - styles: PropTypes.objectOf(PropTypes.object).isRequired, - }; +class ThreadSettingsButton extends React.PureComponent { render() { return ( ); } onPress = () => { const threadInfo = this.props.threadInfo; this.props.navigate({ name: ThreadSettingsRouteName, params: { threadInfo }, key: `${ThreadSettingsRouteName}${threadInfo.id}`, }); }; } -const styles = { +const unboundStyles = { button: { color: 'link', paddingHorizontal: 10, }, }; -const stylesSelector = styleSelector(styles); -export default connect((state: AppState) => ({ - styles: stylesSelector(state), -}))(ThreadSettingsButton); +export default React.memo(function ConnectedThreadSettingsButton( + props: BaseProps, +) { + const styles = useStyles(unboundStyles); + + return ; +});