Skip to content

Commit

Permalink
Merge pull request #53940 from FitseTLT/fix-tag-picker-word-break-sty…
Browse files Browse the repository at this point in the history
…le-issue
  • Loading branch information
blimpich authored Dec 18, 2024
2 parents 8b9bd0e + 9ec22ff commit e3d7afd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function BaseSelectionList<TItem extends ListItem>(
shouldPreventActiveCellVirtualization = false,
shouldScrollToFocusedIndex = true,
onContentSizeChange,
listItemTitleStyles,
}: BaseSelectionListProps<TItem>,
ref: ForwardedRef<SelectionListHandle>,
) {
Expand Down Expand Up @@ -524,6 +525,7 @@ function BaseSelectionList<TItem extends ListItem>(
normalizedIndex={normalizedIndex}
shouldSyncFocus={!isTextInputFocusedRef.current}
wrapperStyle={listItemWrapperStyle}
titleStyles={listItemTitleStyles}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
singleExecution={singleExecution}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import type {StyleProp, TextStyle} from 'react-native';
import type useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager';
import type useSingleExecution from '@hooks/useSingleExecution';
import * as SearchUIUtils from '@libs/SearchUIUtils';
Expand All @@ -11,6 +12,7 @@ type BaseSelectionListItemRendererProps<TItem extends ListItem> = Omit<BaseListI
setFocusedIndex: ReturnType<typeof useArrowKeyFocusManager>[1];
normalizedIndex: number;
singleExecution: ReturnType<typeof useSingleExecution>['singleExecution'];
titleStyles?: StyleProp<TextStyle>;
};

function BaseSelectionListItemRenderer<TItem extends ListItem>({
Expand All @@ -37,6 +39,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
shouldSyncFocus,
shouldHighlightSelectedItem,
wrapperStyle,
titleStyles,
singleExecution,
}: BaseSelectionListItemRendererProps<TItem>) {
const handleOnCheckboxPress = () => {
Expand Down Expand Up @@ -82,6 +85,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
shouldSyncFocus={shouldSyncFocus}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
wrapperStyle={wrapperStyle}
titleStyles={titleStyles}
/>
{item.footerContent && item.footerContent}
</>
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionList/RadioListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function RadioListItem<TItem extends ListItem>({
onFocus,
shouldSyncFocus,
wrapperStyle,
titleStyles,
}: RadioListItemProps<TItem>) {
const styles = useThemeStyles();
const fullTitle = isMultilineSupported ? item.text?.trimStart() : item.text;
Expand Down Expand Up @@ -59,6 +60,7 @@ function RadioListItem<TItem extends ListItem>({
item.alternateText ? styles.mb1 : null,
isDisabled && styles.colorMuted,
isMultilineSupported ? {paddingLeft} : null,
titleStyles,
]}
numberOfLines={isMultilineSupported ? 2 : 1}
/>
Expand Down
6 changes: 6 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ type ListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {

/** Whether we highlight all the selected items */
shouldHighlightSelectedItem?: boolean;

/** Styles applied for the title */
titleStyles?: StyleProp<TextStyle>;
};

type BaseListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {
Expand Down Expand Up @@ -563,6 +566,9 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {
/** Styles for the section title */
sectionTitleStyles?: StyleProp<ViewStyle>;

/** Styles applid for the title of the list item */
listItemTitleStyles?: StyleProp<TextStyle>;

/** This may improve scroll performance for large lists */
removeClippedSubviews?: boolean;

Expand Down
1 change: 1 addition & 0 deletions src/components/TagPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function TagPicker({selectedTag, tagListName, policyID, tagListIndex, shouldShow
<SelectionList
ListItem={RadioListItem}
sectionTitleStyles={styles.mt5}
listItemTitleStyles={styles.breakAll}
sections={sections}
textInputValue={searchValue}
headerMessage={headerMessage}
Expand Down

0 comments on commit e3d7afd

Please sign in to comment.