Skip to content

Possible to open a child modal component inside a parent modal component? #1427

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

Closed
suparnavg opened this issue Jul 13, 2018 · 2 comments
Closed

Comments

@suparnavg
Copy link

suparnavg commented Jul 13, 2018

Sort of a make-or-break feature. Trying to implement this as a workaround since there's no way I could figure out to send context with the routerExtensions.back() method - so now instead of routing to another page, I'm 'disguising' the page as a full-screen modal. Thing is my full-screen modal requires a couple of other modals inside it, depending on user input.

This should technically be possible as the datePicker & timePicker dialogs are opening fine even when launched inside a modal. But I'm unable to launch a custom child modal inside a custom parent modal!

Make sure to check the existing issues in this repository

Checked.

If there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital
letter.
I'm trying to open a 'fullScreen: false' modal inside a 'fullScreen: true' modal (which 'mimics' a page in my app). On trying to launch the child modal, I get this error:

 ERROR Error: Uncaught (in promise): Error: java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.FragmentTransaction android.app.FragmentTransaction.add(android.app.Fragment, java.lang.String)' on a null object reference
JS:     android.app.DialogFragment.show(DialogFragment.java:254)
JS:     com.tns.Runtime.callJSMethodNative(Native Method)
JS:     com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)
JS:     com.tns.Runtime.callJSMethodImpl(Runtime.java:983)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:970)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:954)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:946)
JS:     com.tns.gen.java.lang.Runnable.run(Runnable.java:15)
JS:     android.os.Handler.handleCallback(Handler.java:754)
JS:     android.os.Handler.dispatchMessage(Handler.java:95)
JS:     android.os.Looper.loop(Looper.java:163)
JS:     android.app.ActivityThread.main(ActivityThread.java:6342)
JS:     java.lang.reflect.Method.invoke(Native Method)
JS:     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Z...

Which platform(s) does your issue occur on?

Android device, Mi Redmi Note 4. Not tested on iOS.

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

  • CLI: 4.1.0
  • Cross-platform modules: 4.2.0-2018-06-29-01
  • Runtime(s): android: 4.1.3, iOS: NA

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

Create a modal in any page of the app. Launch this modal. Then try to launch a child modal from within the parent modal.

Is there any code involved?

Yes. Playground project attached
NSPlayground (1).zip

@tsonevn
Copy link
Contributor

tsonevn commented Jul 13, 2018

HI @suparnavg,
Thank you for the attached sample project.
I checked the example, however, it seems that you are using the old technique for opening the module page.
To enable the navigation inside a module, you should define a second page-router-outlet, which should be used for the navigation in the module. You can check the documentation and the demo.

@suparnavg
Copy link
Author

Thanks @tsonevn, implemented this, works like a charm. I don't suppose showing a fullScreen: false modal is possible using this approach?

For future readers, to solve the last bit of this puzzle (passing context to the modals and getting a response object back), I used a service to hold the updated version of the object and used a navigation router event check to update my views with the latest object.

@ghost ghost removed the question label Jul 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants