diff --git a/types/react-native-popup-dialog/index.d.ts b/types/react-native-popup-dialog/index.d.ts index c295a21ca2..5ddb40e0b2 100644 --- a/types/react-native-popup-dialog/index.d.ts +++ b/types/react-native-popup-dialog/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for react-native-popup-dialog 0.9 +// Type definitions for react-native-popup-dialog 1.0 // Project: https://github.com/jacklam718/react-native-popup-dialog/blob/master/README.md // Definitions by: Paito Anderson // connectdotz +// Michele Bombardi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -83,4 +84,7 @@ export class SlideAnimation { export class DialogButton extends React.Component { } export class DialogTitle extends React.Component { } export class Overlay extends React.Component { } -export default class PopupDialog extends React.Component { } +export default class PopupDialog extends React.Component { + show(onShown?: () => void): void; + dismiss(onDismissed?: () => void): void; +} diff --git a/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx b/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx index fdc53cfb88..379d4fd788 100644 --- a/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx +++ b/types/react-native-popup-dialog/react-native-popup-dialog-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { StyleSheet, View } from 'react-native'; +import { StyleSheet, View, Button } from 'react-native'; import PopupDialog, { DialogTitle, DialogButton, @@ -13,26 +13,52 @@ const scaleAnimation = new ScaleAnimation(); const fadeAnimation = new FadeAnimation({ animationDuration: 150 }); class Test extends React.Component { + fadingPopupDialog: PopupDialog | null; + scalingPopupDialog: PopupDialog | null; + slidingPopupDialog: PopupDialog | null; + + showPopupDialog(popupDialog: PopupDialog | null) { + if (popupDialog !== null) { + popupDialog.show(() => console.log('show callback')); + } + } + + dismissPopupDialog(popupDialog: PopupDialog | null) { + if (popupDialog !== null) { + popupDialog.dismiss(() => console.log('dismiss callback')); + } + } + render() { return ( - this.showPopupDialog(this.fadingPopupDialog)} + title="Show Fading Dialog" /> +