Skip to content

Commit

Permalink
[Mobile] - Slash inserter - Don't show disabled items (#32452)
Browse files Browse the repository at this point in the history
* Mobile - Slash inserter - Don't show disabled items

* Mobile - Slash inserter - Remove useMemo since it was just preventing an issue rather than performance.
  • Loading branch information
Gerardo Pacheco authored Jun 15, 2021
1 parent d35484d commit eaa1be0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function getAutoCompleterUI( autocompleter ) {
reset,
} ) {
const [ items ] = useItems( filterValue );
const filteredItems = items.filter( ( item ) => ! item.isDisabled );
const scrollViewRef = useRef();
const animationValue = useRef( new Animated.Value( 0 ) ).current;
const [ isVisible, setIsVisible ] = useState( false );
Expand Down Expand Up @@ -127,7 +128,7 @@ export function getAutoCompleterUI( autocompleter ) {
],
};

if ( ! items.length > 0 || ! isVisible ) {
if ( ! filteredItems.length > 0 || ! isVisible ) {
return null;
}

Expand All @@ -149,7 +150,7 @@ export function getAutoCompleterUI( autocompleter ) {
__( 'Slash inserter results' )
}
>
{ items.map( ( option, index ) => {
{ filteredItems.map( ( option, index ) => {
const isActive = index === selectedIndex;
const itemStyle = stylesCompose(
styles[
Expand Down

0 comments on commit eaa1be0

Please sign in to comment.