mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #19041 from eirikurn/fix-callbacks
Fix callbacks in react-portal and react-sidebar
This commit is contained in:
Vendored
+5
-5
@@ -7,7 +7,7 @@
|
||||
import * as React from "react";
|
||||
|
||||
interface CallBackProps extends React.Props<any> {
|
||||
closePortal(): {};
|
||||
closePortal(): void;
|
||||
}
|
||||
|
||||
interface ReactPortalProps {
|
||||
@@ -15,10 +15,10 @@ interface ReactPortalProps {
|
||||
openByClickOn?: React.ReactElement<CallBackProps>;
|
||||
closeOnEsc?: boolean;
|
||||
closeOnOutsideClick?: boolean;
|
||||
onOpen?(node: HTMLDivElement): {};
|
||||
beforeClose?(node: HTMLDivElement, resetPortalState: () => void): {};
|
||||
onClose?(): {};
|
||||
onUpdate?(): {};
|
||||
onOpen?(node: HTMLDivElement): void;
|
||||
beforeClose?(node: HTMLDivElement, resetPortalState: () => void): void;
|
||||
onClose?(): void;
|
||||
onUpdate?(): void;
|
||||
}
|
||||
|
||||
declare const ReactPortal: React.ComponentClass<ReactPortalProps>;
|
||||
|
||||
@@ -8,17 +8,29 @@ export default class App extends React.Component {
|
||||
const button1 = <button>Open portal with pseudo modal</button>;
|
||||
|
||||
return (
|
||||
<Portal closeOnEsc closeOnOutsideClick openByClickOn={button1}>
|
||||
<PseudoModal>
|
||||
<h2>Pseudo Modal</h2>
|
||||
<p>This react component is appended to the document body.</p>
|
||||
</PseudoModal>
|
||||
</Portal>
|
||||
<div>
|
||||
<Portal
|
||||
isOpened={false}
|
||||
openByClickOn={button1}
|
||||
closeOnEsc
|
||||
closeOnOutsideClick
|
||||
onOpen={(node: HTMLDivElement) => {}}
|
||||
beforeClose={(node: HTMLDivElement, resetPortalState) => resetPortalState()}
|
||||
onClose={() => {}}
|
||||
onUpdate={() => {}}
|
||||
>
|
||||
<PseudoModal>
|
||||
<h2>Pseudo Modal</h2>
|
||||
<p>This react component is appended to the document body.</p>
|
||||
</PseudoModal>
|
||||
</Portal>
|
||||
<Portal />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class PseudoModal extends React.Component<{ closePortal?(): {} }> {
|
||||
export class PseudoModal extends React.Component<{ closePortal?(): void }> {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ export interface SidebarProps {
|
||||
contentClassName?: string;
|
||||
docked?: boolean;
|
||||
dragToggleDistance?: number;
|
||||
onSetOpen?(): {};
|
||||
onSetOpen?(): void;
|
||||
open?: boolean;
|
||||
overlayClassName?: string;
|
||||
pullRight?: boolean;
|
||||
|
||||
@@ -7,6 +7,14 @@ const sidebarStyle: SidebarStyles = {
|
||||
content: { width: "300px" }
|
||||
};
|
||||
|
||||
const sidebar1 = <Sidebar docked={true} open={true} sidebar={sidebar} styles={sidebarStyle}>
|
||||
<h1>Content</h1>
|
||||
</Sidebar>;
|
||||
const sidebar1 = (
|
||||
<Sidebar
|
||||
docked={true}
|
||||
open={true}
|
||||
sidebar={sidebar}
|
||||
styles={sidebarStyle}
|
||||
onSetOpen={() => {}}
|
||||
>
|
||||
<h1>Content</h1>
|
||||
</Sidebar>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user