Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'underscore';
import React from 'react';
import PropTypes from 'prop-types';
import {TouchableOpacity, View, StyleSheet} from 'react-native';
import {View, StyleSheet} from 'react-native';
import * as optionRowStyles from '../../styles/optionRowStyles';
import styles from '../../styles/styles';
import * as StyleUtils from '../../styles/StyleUtils';
Expand All @@ -19,6 +19,7 @@ import themeColors from '../../styles/themes/default';
import SidebarUtils from '../../libs/SidebarUtils';
import TextPill from '../TextPill';
import OfflineWithFeedback from '../OfflineWithFeedback';
import PressableWithFeedback from '../Pressable/PressableWithFeedback';

const propTypes = {
/** Style for hovered state */
Expand Down Expand Up @@ -83,6 +84,8 @@ const OptionRowLHN = (props) => {
// If the item is a thread within a workspace, we will show the subtitle as the second line instead of in a pill
const alternativeText = optionItem.isThread && optionItem.subtitle ? optionItem.subtitle : optionItem.alternateText;

const hoverStyle = !props.isFocused && props.hoverStyle;

return (
<OfflineWithFeedback
pendingAction={optionItem.pendingAction}
Expand All @@ -91,7 +94,7 @@ const OptionRowLHN = (props) => {
>
<Hoverable>
{(hovered) => (
<TouchableOpacity
<PressableWithFeedback
ref={(el) => (touchableRef = el)}
onPress={(e) => {
if (e) {
Expand All @@ -100,7 +103,6 @@ const OptionRowLHN = (props) => {

props.onSelectRow(optionItem, touchableRef);
}}
activeOpacity={0.8}
style={[
styles.flexRow,
styles.alignItemsCenter,
Expand All @@ -109,8 +111,12 @@ const OptionRowLHN = (props) => {
styles.sidebarLinkInner,
StyleUtils.getBackgroundColorStyle(themeColors.sidebar),
props.isFocused ? styles.sidebarLinkActive : null,
hovered && !props.isFocused ? props.hoverStyle : null,
]}
accessibilityLabel={optionItem.text}
accessibilityRole="button"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not in propTypes. should we add it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think no because we just added specifying required values for PressableWithFeedback and defining that OptionRowLHN will always be a button and have the label optionItem.text

hoverDimmingValue={1}
hoverStyle={hoverStyle}
focusStyle={hoverStyle}
>
<View
accessibilityHint={props.translate('accessibilityHints.navigatesToChat')}
Expand Down Expand Up @@ -213,7 +219,7 @@ const OptionRowLHN = (props) => {
</View>
)}
</View>
</TouchableOpacity>
</PressableWithFeedback>
)}
</Hoverable>
</OfflineWithFeedback>
Expand Down