nativescript-cfalert-dialog icon indicating copy to clipboard operation
nativescript-cfalert-dialog copied to clipboard

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

Open gogoout opened this issue 6 years ago • 8 comments

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:

  • CLI: (run tns --version to fetch it) tns --version 4.0.0

  • Cross-platform modules: (check the 'version' attribute in the node_modules/tns-core-modules/package.json file in your project) [email protected]

  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the package.json file of your project) tns-ios 4.0.1

  • Plugin(s): (look for the version numbers in the package.json file of your project and paste your dependencies and devDependencies here) "nativescript-cfalert-dialog": "^1.0.6",

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

Describe the steps to reproduce it.

  • the process is like: page1 ->go page2 ->go page3, and in page2, a notification will show.
  • if goes like page1->go page2, show notification, close notification -> go back to page1 -> go page2. Everything works as expected
  • if goes like page1->go page2, show notification, close notification -> go page3 -> go back to page2. Page2 can't show notification again, and in this situation, if go back to page1, you can't go to page2 again

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

Is there any code involved?

  • provide a code example to recreate the problem
  • (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.

gogoout avatar Jul 22 '18 04:07 gogoout

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

shiv19 avatar Jul 22 '18 04:07 shiv19

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.

gogoout avatar Jul 22 '18 05:07 gogoout

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)

zurie avatar Feb 14 '19 16:02 zurie

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!

rhurup avatar Mar 16 '19 09:03 rhurup

@davecoffin Any thoughts about this issue? 🤔

shiv19 avatar Mar 16 '19 10:03 shiv19

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

GuilhermeAB avatar Apr 21 '20 14:04 GuilhermeAB

Did anyone found a solution?

AgustinV08 avatar Oct 01 '20 17:10 AgustinV08

Hello, any news? Thanks

mrzanirato avatar Mar 17 '21 15:03 mrzanirato