Skip to content

Commit

Permalink
code review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TMisiukiewicz committed Jan 22, 2024
1 parent e8d35df commit 773787f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/hooks/useArrowKeyFocusManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default function useArrowKeyFocusManager({
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ARROW_DOWN, arrowDownCallback, arrowConfig);

const arrowLeftCallback = useCallback(() => {
if (maxIndex < 0) {
if (maxIndex < 0 || !allowHorizontalArrowKeys) {
return;
}

Expand All @@ -151,11 +151,11 @@ export default function useArrowKeyFocusManager({
}
return newFocusedIndex;
});
}, [disableCyclicTraversal, disabledIndexes, maxIndex]);
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ARROW_LEFT, allowHorizontalArrowKeys ? arrowLeftCallback : () => {}, arrowConfig);
}, [allowHorizontalArrowKeys, disableCyclicTraversal, disabledIndexes, maxIndex]);
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ARROW_LEFT, arrowLeftCallback, arrowConfig);

const arrowRightCallback = useCallback(() => {
if (maxIndex < 0) {
if (maxIndex < 0 || !allowHorizontalArrowKeys) {
return;
}

Expand All @@ -177,8 +177,8 @@ export default function useArrowKeyFocusManager({
}
return newFocusedIndex;
});
}, [disableCyclicTraversal, disabledIndexes, maxIndex]);
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ARROW_RIGHT, allowHorizontalArrowKeys ? arrowRightCallback : () => {}, arrowConfig);
}, [allowHorizontalArrowKeys, disableCyclicTraversal, disabledIndexes, maxIndex]);
useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ARROW_RIGHT, arrowRightCallback, arrowConfig);

// Note: you don't need to manually manage focusedIndex in the parent. setFocusedIndex is only exposed in case you want to reset focusedIndex or focus a specific item
return [focusedIndex, setFocusedIndex];
Expand Down
2 changes: 1 addition & 1 deletion src/libs/EmojiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ const getEmojiReactionDetails = (emojiName: string, reaction: ReportActionReacti
function getSpacersIndexes(allEmojis: EmojiPickerList): number[] {
const spacersIndexes: number[] = [];
allEmojis.forEach((emoji, index) => {
if (!('spacer' in emoji)) {
if (!(CONST.EMOJI_PICKER_ITEM_TYPES.SPACER in emoji)) {
return;
}

Expand Down

0 comments on commit 773787f

Please sign in to comment.