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

Modal prompts on iOS overlay the toast #494

Open
Kief5555 opened this issue Oct 28, 2023 · 13 comments
Open

Modal prompts on iOS overlay the toast #494

Kief5555 opened this issue Oct 28, 2023 · 13 comments

Comments

@Kief5555
Copy link

Kief5555 commented Oct 28, 2023

Describe the bug
When a modal is prompted on ios calling Toast.show makes the toast appear UNDER the modal resulting in a 50% view of the toast (because of the modal that is blocking it)

Steps to reproduce
Steps to reproduce the behavior:

<Stack>
<Stack.Screen name="(tabs)"  options={{headerShown: false,     headerBackTitle: ''}} />
	<Stack.Screen
	 name="example"
	 options={{
	 title: example,
	 presentation: 'modal',
	}}/>
   </Stack>
</ThemeProvider>
<Toast config={toastConfig} />

Open the modal on iOS call toast.show
Expected behavior
For it to overlay/go above the modal
Screenshots
image

Above the modal, I have a custom toast configuration that's partially visible.
Code sample
Using react-nativgation and expo router (default tabs template with expo)

Environment (please complete the following information):

  • OS: iOS
  • react-native-toast-message version: latest
  • react-native version SDK 49
@hackerhgl
Copy link

@Kief5555 Were you able to figure out a solution?

@Kief5555
Copy link
Author

Kief5555 commented Nov 1, 2023

@Kief5555 Were you able to figure out a solution?

No, I might try to import the toast in the modal and try to display it there.

@devoren
Copy link

devoren commented Nov 1, 2023

same issue

@jmcartlamy
Copy link

jmcartlamy commented Nov 2, 2023

@devoren
Copy link

devoren commented Nov 2, 2023

@jmcartlamy Hey! I'm using an Expo router so if I use it this way I get a warning. Also i saw this comment #195 (comment) so i will try containedModal

@QuixThe2nd
Copy link

Im getting the same issue too.

@alanschwarz
Copy link

alanschwarz commented Dec 4, 2023

Any news on this? Using 'containedModal' as suggested in #195 is not a sustainable solution.
The user looses the ability to swipe down the modal on iOS, therefore compromising intuitive behaviour of the app.

@hichemfantar
Copy link

hichemfantar commented Dec 5, 2023

On IOS you have create a new toast element inside each modal, refs are auto handled
https://github.com/calintamas/react-native-toast-message/blob/main/docs/modal-usage.md#notes-regarding-react-native-modal-or-nativestacknavigator

@Kief5555
Copy link
Author

Kief5555 commented Dec 9, 2023

On IOS you have create a new toast element inside each modal, refs are auto handled

https://github.com/calintamas/react-native-toast-message/blob/main/docs/modal-usage.md#notes-regarding-react-native-modal-or-nativestacknavigator

This is a different type of modal, I think. Shown in the screenshot is the native Modal Component (not view)

@hichemfantar
Copy link

On IOS you have create a new toast element inside each modal, refs are auto handled
https://github.com/calintamas/react-native-toast-message/blob/main/docs/modal-usage.md#notes-regarding-react-native-modal-or-nativestacknavigator

This is a different type of modal, I think. Shown in the screenshot is the native Modal Component (not view)

It's the same for both stack modals and the RN Modal component.

@moritzlang
Copy link

Rendering content on top of native views (presentation="modal") is a bit tricky. What works for me is rendering the Toast component again in the Screen using @gorhom/portal as following:

<Portal hostName="toast">
  <FullWindowOverlay>
    <Toast />
  </FullWindowOverlay>
</Portal>

Be aware that this solution does not work when running the app on the simulator. It somehow only works on the final build.
See React Native Screens Integration docs for more details.

@calummoore
Copy link

For me, it worked when I added the Toast to the modal view, but the Toast has to be the last component.

export function ModalView({ children }: ModalViewProps) {
  return (
    <>
      {children}
      <Toast />
    </>
  )
}

@alexandrius
Copy link

Use FullWindowOverlay from react-native-screens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants