Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prepare for new search modal #11033

Merged
merged 15 commits into from
Nov 18, 2024
Merged

Conversation

MounirDhahri
Copy link
Member

@MounirDhahri MounirDhahri commented Oct 29, 2024

This PR resolves ONYX-1369 ONYX-1368

Description

This PR adds a search button and input to the home view and search tabs.

Screen.Recording.2024-11-12.at.15.35.40.mov

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

  • add new search modal wrappers - mounir

iOS user-facing changes

Android user-facing changes

Dev changes

Need help with something? Have a look at our docs, or get in touch with us.

src/app/Components/GlobalSearchInput.tsx Outdated Show resolved Hide resolved
navigate("search/modal")
}}
>
<Flex pointerEvents="none">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity: why do we need pointerEvents="none" here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here, this was my solution to avoid building a search input button that looks like the input. So I made the input clickable, but to avoid focusing inside it, I wrapped it with a flex so it doesn't send touch events to its children. And voila, a search input button that's clickable but not focusable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea! 🌟

A short comment in the code to explain what this Flex container does could be good..

/>
</Flex>
</Touchable>
<GlobalSearchInputModal visible={isVisible} hideModal={() => setIsVisible(false)} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand why there is a GlobalSearchInputModal and a SearchModalScreen 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point - I am actually still trying to figure out the best way to present this modal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overlay, modal or a modally presented screen.

  • The overlay would be nice but it would have to be injected on the HomeView as an absolute positioned view covering everything
  • The modal would be perfect, but navigating to an item would require dismissing the modal then, navigating and the transition won't look nice
  • having this as a modally presented screen would be idea in this case, however, since it's a modally presented screen, the transition didn't look nice to me

I am checking all options currently again and I am leaning towards the first solution. I know it's what we spoke about during the refinement but I wanted to also explore other approaches

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for explaining 🙏

Intuitively, the first solution sounds like the best solution to me as well.

If using an absolute positioned view covering the home screen does not work, an alternative could be to hide the screen content (e.g., by setting its height to 0).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a way, I did exactly that but without needing to add a store value to show/hide the overlay view on both search and home views. And also without need for prop drilling.
I noticed that we are using react-native-portalas a peer dependency in yarn.lock but we were not importing it anywhere. So I specified that and used it. The API is so straightforward and it worked great

@@ -114,6 +114,7 @@
"@braze/react-native-sdk": "11.0.0",
"@expo/react-native-action-sheet": "4.0.1",
"@gorhom/bottom-sheet": "5.0.5",
"@gorhom/portal": "1.0.14",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was already available within yarn.lock. I just specified it here to avoid regressions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you can see, adding it didn't lead to any yarn.lock updates

@MounirDhahri MounirDhahri marked this pull request as ready for review November 13, 2024 15:19
@MounirDhahri
Copy link
Member Author

Please don't review yet - I noticed some weird behaviour

@MounirDhahri MounirDhahri marked this pull request as draft November 13, 2024 15:35
@MounirDhahri MounirDhahri marked this pull request as ready for review November 15, 2024 11:13
@ArtsyOpenSource
Copy link
Contributor

ArtsyOpenSource commented Nov 15, 2024

This PR contains the following changes:

  • Cross-platform user-facing changes (add new search modal wrappers - mounir - MounirDhahri)

Generated by 🚫 dangerJS against 1d8414b

@MounirDhahri
Copy link
Member Author

I am going to merge this if no one minds - I am glad to address your comments in a separate PR

@MounirDhahri MounirDhahri merged commit 8600330 into main Nov 18, 2024
7 checks passed
@MounirDhahri MounirDhahri deleted the feat/add-new-search-modal branch November 18, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants