Skip to content

Added portal above content area#1

Open
ajp wants to merge 1 commit intoripeworks:mainfrom
ajp:feature/0.0.9-portal
Open

Added portal above content area#1
ajp wants to merge 1 commit intoripeworks:mainfrom
ajp:feature/0.0.9-portal

Conversation

@ajp
Copy link

@ajp ajp commented Feb 25, 2026

Added a content div portal for toasts above our modals.

Comment on lines +82 to +86
if (portalEl) {
return createPortal(content, portalEl);
}

return content;
Copy link
Member

Choose a reason for hiding this comment

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

if we don't have the portal, we should return null.

children,
}: Props) {
const [slide, setSlide] = useState(false);
const [portalEl, setPortalEl] = useState<HTMLDivElement | null>(null);
Copy link
Member

Choose a reason for hiding this comment

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

this should be a ref, not state

Comment on lines +25 to +26
el.style.zIndex = "10000";
el.style.position = "relative";
Copy link
Member

Choose a reason for hiding this comment

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

are these necessary? they might be, look down at my styles you'll notice similar zIndex stuff, but this needs to be as vanilla as possible so I don't want to add these unless we need to

@tamagokun
Copy link
Member

@ajp here's a good example of setting up a portal on web, close to what you have but a little more efficient:
https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/Modal/ModalPortal.js

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

Successfully merging this pull request may close these issues.

2 participants