import ReactNative from "react-native" ; param { string } titleCaption param { string } question param { string } cancelButtonCaption param { string } proceedButtonCaption returns { Promise . < boolean > } export async function ShowConfirmation ( titleCaption ? , question ? , cancelButtonCaption ? , proceedButtonCaption ? ) { if ( ! question ) { return Promise . reject ( new Error ( "Input parameter 'Question' is required" ) ) ; } const cancel = cancelButtonCaption || "Cancel" ; const proceed = proceedButtonCaption || "OK" ; const title = titleCaption || "Confirmation" ; if ( navigator && navigator . product === "ReactNative" ) { const Alert = require ( "react-native" ) . Alert ; return new Promise ( resolve => { Alert . alert ( title , question , [ { text : cancel , onPress : ( ) => resolve ( false ) , style : "cancel" } , { text : proceed , onPress : ( ) => resolve ( true ) } ] ) ; } ) ; } return new Promise ( resolve => { mx . ui . confirmation ( { content : question , proceed , cancel , handler : ( ) => resolve ( true ) , onCancel : ( ) => resolve ( false ) } as any ) ; } ) ; }