-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prepare for new search modal (#11033)
* feat: add new search modal * wip * feat: add home search input button * feat: add global search input modal * feat: add search input modal to search tab * feat: make header sticky * chore: use screen instead of modal * chore: update palette and explict install of collapstible-tab-view * feat: add search modal screen test * fix: yarn.lock issues * feat: use portal instead of modal/screen * chore: cleanup * chore: ignore bottom tabs * chore: add comment about pointer events * fix: broken tests
- Loading branch information
1 parent
45bfb60
commit 8600330
Showing
11 changed files
with
206 additions
and
29 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,10 @@ | ||
import { GlobalSearchInput } from "app/Components/GlobalSearchInput" | ||
import { renderWithWrappers } from "app/utils/tests/renderWithWrappers" | ||
|
||
describe("GlobalSearchInput", () => { | ||
it("renders the search label properly", () => { | ||
renderWithWrappers(<GlobalSearchInput />) | ||
|
||
expect(/Search artists, artworks, etc/).toBeTruthy() | ||
}) | ||
}) |
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,34 @@ | ||
import { Flex, RoundSearchInput, Touchable } from "@artsy/palette-mobile" | ||
import { GlobalSearchInputOverlay } from "app/Components/GlobalSearchInputOverlay" | ||
import { SEARCH_INPUT_PLACEHOLDER } from "app/Scenes/Search/Search" | ||
import { Fragment, useState } from "react" | ||
|
||
export const GlobalSearchInput: React.FC<{}> = () => { | ||
const [isVisible, setIsVisible] = useState(false) | ||
|
||
return ( | ||
<Fragment> | ||
<Touchable | ||
onPress={() => { | ||
setIsVisible(true) | ||
}} | ||
> | ||
{/* In order to make the search input behave like a button here, we wrapped it with a | ||
Touchable and set pointerEvents to none. This will prevent the input from receiving | ||
touch events and make sure they are being handled by the Touchable. | ||
*/} | ||
<Flex pointerEvents="none"> | ||
<RoundSearchInput | ||
placeholder={SEARCH_INPUT_PLACEHOLDER} | ||
accessibilityHint="Search artists, artworks, galleries etc." | ||
accessibilityLabel="Search artists, artworks, galleries etc." | ||
maxLength={55} | ||
numberOfLines={1} | ||
multiline={false} | ||
/> | ||
</Flex> | ||
</Touchable> | ||
<GlobalSearchInputOverlay visible={isVisible} hideModal={() => setIsVisible(false)} /> | ||
</Fragment> | ||
) | ||
} |
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,43 @@ | ||
import { Flex, RoundSearchInput, Spacer } from "@artsy/palette-mobile" | ||
import { Portal } from "@gorhom/portal" | ||
import { FadeIn } from "app/Components/FadeIn" | ||
import { SEARCH_INPUT_PLACEHOLDER } from "app/Scenes/Search/Search" | ||
import { StyleSheet } from "react-native" | ||
import { SafeAreaView } from "react-native-safe-area-context" | ||
|
||
export const GlobalSearchInputOverlay: React.FC<{ visible: boolean; hideModal: () => void }> = ({ | ||
visible, | ||
hideModal, | ||
}) => { | ||
if (!visible) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Portal hostName="SearchOverlay"> | ||
<FadeIn style={StyleSheet.absoluteFillObject} slide={false}> | ||
<SafeAreaView | ||
style={{ flex: 1, backgroundColor: "white" }} | ||
edges={["top", "left", "right"]} | ||
> | ||
<Flex px={2} pt={2}> | ||
<RoundSearchInput | ||
placeholder={SEARCH_INPUT_PLACEHOLDER} | ||
accessibilityHint="Search artists, artworks, galleries etc." | ||
accessibilityLabel="Search artists, artworks, galleries etc." | ||
maxLength={55} | ||
numberOfLines={1} | ||
autoFocus | ||
multiline={false} | ||
onLeftIconPress={() => { | ||
hideModal() | ||
}} | ||
/> | ||
</Flex> | ||
<Spacer y={2} /> | ||
<Flex flex={1} backgroundColor="black10" /> | ||
</SafeAreaView> | ||
</FadeIn> | ||
</Portal> | ||
) | ||
} |
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
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.