diff --git a/src/index.tsx b/src/index.tsx index 28937633..1639655f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -505,7 +505,7 @@ export class Modalize extends React.C } }; - private onBackPress = async (): Promise => { + private onBackPress = (): boolean => { const { onBackButtonPress, alwaysOpen } = this.props; if (alwaysOpen) { @@ -513,7 +513,7 @@ export class Modalize extends React.C } if (onBackButtonPress) { - onBackButtonPress(); + return onBackButtonPress(); } else { this.close(); } diff --git a/src/options.ts b/src/options.ts index 4f76e9b6..76ffbbec 100644 --- a/src/options.ts +++ b/src/options.ts @@ -217,7 +217,7 @@ export interface IProps { * Android or the menu button on Apple TV. You can any function you want, * but you will have to close the modal by yourself. */ - onBackButtonPress?: () => void; + onBackButtonPress?: () => boolean; /** * Callback function which determines if the modal has reached the top