NathanWalker / nativescript-fancyalert

Fancy alerts for NativeScript.
Other
147 stars 38 forks source link

Android : wont work and no error #48

Closed kefahB closed 6 years ago

kefahB commented 6 years ago

Hello,

TNS version : 4.0.0 API : 23

The plugin work fine with ios but is not work with android and no error in console ?

Thank you

Dr0drigues commented 6 years ago

Hello,

You should use a callback whenever you call a TNSFancyAlert (at least that's what I did to make it work).

/**
   * Callback called each time I want to create a FancyAlert
   * Will check on which OS we are
   *
   * - If isIOS, will just call the TNSFancyAlert implementation as it is 
   * - If isANDROID, will execute the promise sent by TNSFancyAlert
   *
   * @param {Promise<any>} alert - TNSFancyAlert implementation (I.E. TNSFancyAlert.showError(title, message, buttonValue))
   **/
   checkOSCallback(alert: Promise<any>): void {
        if (platform.isIOS) {
            alert;
        } else if (platform.isAndroid) {
            alert.then((success) => {
                console.log(success);
            }, (error) => {
                console.log(error);
            });
        }
    }
kefahB commented 6 years ago

Thank you is work after i remove and reinstall android