-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39201 from software-mansion-labs/fix/sync-arrows-…
…and-tab-navigation Sync keyboard navigation in SelectionList and PopoverMenu
- Loading branch information
Showing
14 changed files
with
232 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, {useRef} from 'react'; | ||
import type {View} from 'react-native'; | ||
import useSyncFocus from '@hooks/useSyncFocus'; | ||
import type {MenuItemProps} from './MenuItem'; | ||
import MenuItem from './MenuItem'; | ||
|
||
function FocusableMenuItem(props: MenuItemProps) { | ||
const ref = useRef<HTMLDivElement | View>(null); | ||
|
||
// Sync focus on an item | ||
useSyncFocus(ref, Boolean(props.focused)); | ||
|
||
return ( | ||
<MenuItem | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
ref={ref} | ||
/> | ||
); | ||
} | ||
|
||
FocusableMenuItem.displayName = 'FocusableMenuItem'; | ||
|
||
export default FocusableMenuItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.