You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
It would be useful to provide a component that allows consumers of the library to choose where Portals are rendered instead of as a sibling to the children prop of the PortalProvider. It is useful because the way "portals" are being implemented here changes where the component being portalled renders in the React tree. This has implications for Context. Below if we try to render a NativeBaseModal (which uses PortalProvider), ContextProviderA and ContextProviderB are not accessible from within the Modal component since it is ultimately rendered directly under the NativeBaseProvider.
<NativeBaseProvider> // NativeBaseProvider provides theme context and PortalProvider is consumed by NativeBase
<ContextProviderA><ContextProviderB><App/><ContextProviderB><ContextProviderA>
// Portals created by ContextProviderA, ContextProviderB, and App are all rendered here! Outside of the context providers!
</NativeBaseProvider>
I have already created a patch for my own project to add this and can put up a PR if it would be desirable.
Ultimately I just created a PortalRenderer component below:
This is obviously a breaking change since Portals are no longer automatically rendered and would require users to consume the PortalRenderer component somewhere in order to actually render their portals.
The text was updated successfully, but these errors were encountered:
Hello!
It would be useful to provide a component that allows consumers of the library to choose where Portals are rendered instead of as a sibling to the children prop of the PortalProvider. It is useful because the way "portals" are being implemented here changes where the component being portalled renders in the React tree. This has implications for Context. Below if we try to render a NativeBaseModal (which uses PortalProvider),
ContextProviderA
andContextProviderB
are not accessible from within the Modal component since it is ultimately rendered directly under the NativeBaseProvider.I have already created a patch for my own project to add this and can put up a PR if it would be desirable.
Ultimately I just created a
PortalRenderer
component below:I also deleted:
react-native-aria/packages/overlays/src/Portal.tsx
Lines 59 to 62 in ec14df0
This is obviously a breaking change since Portals are no longer automatically rendered and would require users to consume the PortalRenderer component somewhere in order to actually render their portals.
The text was updated successfully, but these errors were encountered: