-
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 #50143 from software-mansion-labs/@szymczak/fix-se…
…arch-router-performance Fix performance of SearchRouter
- Loading branch information
Showing
4 changed files
with
61 additions
and
43 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
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,30 @@ | ||
import React from 'react'; | ||
import FocusTrapForModal from '@components/FocusTrap/FocusTrapForModal'; | ||
import Modal from '@components/Modal'; | ||
import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
import CONST from '@src/CONST'; | ||
import SearchRouter from './SearchRouter'; | ||
import {useSearchRouterContext} from './SearchRouterContext'; | ||
|
||
function SearchRouterModal() { | ||
const {isSmallScreenWidth} = useResponsiveLayout(); | ||
const {isSearchRouterDisplayed, closeSearchRouter} = useSearchRouterContext(); | ||
|
||
const modalType = isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE : CONST.MODAL.MODAL_TYPE.POPOVER; | ||
|
||
return ( | ||
<Modal | ||
type={modalType} | ||
fullscreen | ||
isVisible={isSearchRouterDisplayed} | ||
popoverAnchorPosition={{right: 20, top: 20}} | ||
onClose={closeSearchRouter} | ||
> | ||
<FocusTrapForModal active={isSearchRouterDisplayed}>{isSearchRouterDisplayed && <SearchRouter />}</FocusTrapForModal> | ||
</Modal> | ||
); | ||
} | ||
|
||
SearchRouterModal.displayName = 'SearchRouterModal'; | ||
|
||
export default SearchRouterModal; |
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