-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Portal): Support creating portals for multiple nested UIViews
- Change API for creation/cleanup of portals for child UIView to `portalView.createPortalToChildUIView` and `portalView.removePortalToChildUIView` - Reference child react uiviews in PortalView by $id - Rename debug to debugLog
- Loading branch information
1 parent
a2483ec
commit ab4edcb
Showing
5 changed files
with
73 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
import * as React from 'react'; | ||
import { UIRouterConsumer, UIView, UIViewConsumer } from '@uirouter/react'; | ||
import { UIRouterConsumer, UIView, UIViewConsumer, UIViewProps } from '@uirouter/react'; | ||
import { UIRouterContextComponent } from './UIRouterReactContext'; | ||
import { debug as debugLog } from '../debug'; | ||
import { debugLog } from '../debug'; | ||
|
||
const InternalUIView = UIView.__internalViewComponent; | ||
|
||
const ReactUIView = ({ refFn, ...props }) => { | ||
export interface IReactUIViewProps extends UIViewProps { | ||
refFn: (ref: HTMLElement) => void; | ||
} | ||
|
||
export const ReactUIView = ({ refFn, ...props }: IReactUIViewProps) => { | ||
debugLog('react', 'ReactUIView', `?/${props['name']}`, '.render()', ''); | ||
|
||
return ( | ||
<UIRouterContextComponent parentContextLevel="3" inherited={false}> | ||
<UIRouterConsumer> | ||
{router => ( | ||
<UIViewConsumer> | ||
{parentUiView => <InternalUIView {...props} ref={refFn} parentUIView={parentUiView} router={router} />} | ||
{parentUiView => ( | ||
<InternalUIView {...props} ref={refFn as any} parentUIView={parentUiView} router={router} /> | ||
)} | ||
</UIViewConsumer> | ||
)} | ||
</UIRouterConsumer> | ||
</UIRouterContextComponent> | ||
); | ||
}; | ||
|
||
export default ReactUIView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters