Skip to content

Commit 1502a58

Browse files
committed
feat: export PortalContext
1 parent b86af97 commit 1502a58

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/StickPortal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function StickPortal(
122122
)
123123
}
124124

125-
const PortalContext = createContext<?Node>(null)
125+
export const PortalContext = createContext<?Node>(document.body)
126126

127127
export default forwardRef<StickPortalPropsT, ?HTMLElement>(StickPortal)
128128

@@ -131,7 +131,7 @@ function useHost(transportTo) {
131131

132132
const portalHost = useContext(PortalContext)
133133

134-
const hostParent = transportTo || portalHost || document.body
134+
const hostParent = transportTo || portalHost
135135

136136
invariant(hostParent, 'Could not determine a parent for the host node.')
137137

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// @flow
22
export { default } from './Stick'
3+
export { PortalContext } from './StickPortal'

0 commit comments

Comments
 (0)