Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gogoout opened this issue Jul 22, 2018 · 8 comments

Comments

@gogoout
Copy link

gogoout commented Jul 22, 2018

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.
@shiv19
Copy link
Owner

shiv19 commented Jul 22, 2018

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

@gogoout
Copy link
Author

gogoout commented Jul 22, 2018

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
Copy link

zurie commented Feb 14, 2019

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
Copy link

rhurup commented Mar 16, 2019

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
Copy link
Owner

shiv19 commented Mar 16, 2019

@davecoffin
Any thoughts about this issue? 🤔

@GuilhermeAB
Copy link

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

@AgustinV08
Copy link

Did anyone found a solution?

@mrzanirato
Copy link

Hello,
any news?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants