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

chore: Fix toast overlay in modals #103

Merged
merged 7 commits into from
Nov 7, 2024
Merged

chore: Fix toast overlay in modals #103

merged 7 commits into from
Nov 7, 2024

Conversation

cyanChill
Copy link
Member

@cyanChill cyanChill commented Nov 7, 2024

Why

When we swap over to using react-native-actions-sheet for our models, we encountered an issue where the toasts would appear underneath the modal. react-native-actions-sheet suggests using the ExtraOverlayComponent prop and put the toast element there. The problem is that the notification provider we're using, react-native-toast-notifications doesn't support this pattern as it exposes a provider instead of a component. @backpackapp-io/react-native-toast does export a component so we swapped to using this.

This also gives us the opportunity to add in the translated messages into the toasts.

How

There were somethings in the @backpackapp-io/react-native-toast package that we had to patch as it didn't expose ways to configure those specific behaviors:

  • We added pointerEvents="box-none" as we want to be able to interact with the content in the "transparent" area next to the toast to be clickable.
  • There was some unnecessary offset that we had to remove as it bumped the toast up more than we needed it to.

One downside is that there's no way to set a global default (ie: we'll have to provide the "global" options to every toast() calls we do).

Note

We noticed some performance issues when repetitively opening/closing the filter list modal with some entries in it. I'm not sure if its related to this change or just something else.

Test Plan

The main goal is to have the toast messages display over the modal when called and for them to be translated if we're using a different language.

Checklist

  • Documentation is up to date to reflect these changes (ie: CHANGELOG.md & README.md).
  • Add new dependencies into THIRD_PARTY.md.
  • This diff will work correctly for pnpm android:prod.

- Provides the ability of updating toasts & having multiple providers (so we can put one inside the sheets that need it)
- Removed some unnecessary offset
- Allow us to press normally around the toast
- Defined proper minimum toast height (default was 50)
- We no longer need a toast for removing a track from a playlist
- Now dismiss keyboard when we attempt to add a new path filter (so toast can be seen if displayed)
- Narrowed down an elevation that's effective also in dark mode, but doens't look too off-putting in light mode
@cyanChill cyanChill added the Bug: UI Issue with visual aspect of app. label Nov 7, 2024
@cyanChill cyanChill merged commit 5a609fb into dev Nov 7, 2024
@cyanChill cyanChill deleted the fix/modal-toasts branch November 7, 2024 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: UI Issue with visual aspect of app.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant