shiv19 / nativescript-cfalert-dialog

CFAlertDialog Wrapper for NativeScript
Apache License 2.0
42 stars 21 forks source link

Page can't show notification again after reactivated (navigate to new page then goback) #9

Open gogoout opened 6 years ago

gogoout commented 6 years ago

Make sure to check the demo app(s) for sample usage

Yes

Make sure to check the existing issues in this repository

Yes

If the demo apps cannot help and there is no issue for your problem, tell us about it

See detail

Which platform(s) does your issue occur on?

IOS emulator(haven't tested on Android)

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

Also, I'm using Nativescript + Angular. Though I doubt it's related.

Is there any code involved?

shiv19 commented 6 years ago

Hi @gogoout Can you explain the way you are using this plugin? Are you calling it inside any lifecycle hook?

gogoout commented 6 years ago

Hi @shiv19 , Thanks for the quick response. I'm using Nativescript + Angular. I will paste some code sample below.

Page2: On page2 there is a button, which contain a WIP function , so once the user click the button I just show a Error message. html

     <Button class = "btn btn-danger btn-outline btn-cancel" text = "Cancel Order" (tap) = "wip();"></Button>

controller.js

    wip() {
        showErrorNotification('Sorry, function coming soon.');
    }

showErrorNotification is just a simple wrapper function to call the CFAlert

   export function showErrorNotification(error: string): void {
    if (!error) {
        return;
    }
    let dialog = new CFAlertDialog();
    dialog.show({
        dialogStyle: CFAlertStyle.NOTIFICATION,
        title: 'Oops',
        message: error
    });
}

And on Page2 there is also a typical link which is like this:

  <GridLayout row = "1" colSpan = "2" rows = "*,auto,auto" columns = "auto,*,40"
              [nsRouterLink] = "['/products',purchase.product.id]">
     .......
  </GridLayout>

So there is really nothing fancy here. Please let me know if you need any further information. Thanks.

zurie commented 5 years ago

Having the exact same problem... App works 100%, forward, back, click links, new pages, etc etc.. the second I popup a notification, the issue starts. from that moment on, if i leave that page and navigate forward, as long as i use the sidebar i can continue to navigate around... but the second I navigate back in history my app stops working. The sidebar continues to open, but the homepage never clicks anymore, the sidebar never navigates anymore (it clicks the links and highlights the links but they never navigate), its like the notification is blocking the router? so strange.. if i never use the plugin the app never breaks, no matter where I put the dialog to popup (regardless of the compoenent location) the app stops working after the dialog pops up. Super simple dialog, click to confirm basics...

I would do tns create test and make a angular app, then drop in your dialog and see if you can route forward and back (the demo app should have a list view with details, so that should be pretty easy to setup)

rhurup commented 5 years ago

Same issue here ...

1 try:

_buttons.push({
            text: translate.T('Edit place'), // title
            buttonStyle: CFAlertActionStyle.POSITIVE,
            buttonAlignment: CFAlertActionAlignment.JUSTIFIED,
            textColor: "#FFFFFF",
            backgroundColor: "#d8a107",
            onClick: function (response) {
                frameModule.topmost().navigate({
                    moduleName: "my/editplace-page",
                    context: { id: fields.id },
                    transition: {
                        name: "fade"
                    }
                });
            },
        });

2 try - Moving the navigation to the onDismiss callback:

dialogStyle: CFAlertStyle.BOTTOM_SHEET,
        title: '',
        message: translate.T('Please share our app! :)'),
        backgroundBlur: true,
        cancellable: true,
        onDismiss: function(){
            if(redirect){
                redirect = false;
                frameModule.topmost().navigate({
                    moduleName: redirect_path,
                    context: redirect_context,
                    transition: {
                        name: "fade"
                    }
                });
            }
            return false;
        },

All giving this error: Warning: Attempt to present <CFAlertViewController.CFAlertViewController: 0x11e0f7200> on <UIViewControllerImpl: 0x1221707e0> whose view is not in the window hierarchy! Warning: Attempt to present <CFAlertViewController.CFAlertViewController: 0x11e806200> on <UIViewControllerImpl: 0x1221707e0> whose view is not in the window hierarchy! Warning: Attempt to present <CFAlertViewController.CFAlertViewController: 0x11e15c400> on <UIViewControllerImpl: 0x1221707e0> whose view is not in the window hierarchy! Warning: Attempt to present <CFAlertViewController.CFAlertViewController: 0x11e97c200> on <UIViewControllerImpl: 0x1221707e0> whose view is not in the window hierarchy! Warning: Attempt to present <CFAlertViewController.CFAlertViewController: 0x11e1f6400> on <UIViewControllerImpl: 0x1221707e0> whose view is not in the window hierarchy!

shiv19 commented 5 years ago

@davecoffin Any thoughts about this issue? 🤔

GuilhermeAB commented 4 years ago

Sorry for reviving an old post ... But does anyone have a solution?

AgustinV08 commented 4 years ago

Did anyone found a solution?

mrzanirato commented 3 years ago

Hello, any news? Thanks