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

Feedback not showing on fullscreen MODAL page on Android #11

Open
terreb opened this issue Oct 10, 2017 · 24 comments · May be fixed by #62
Open

Feedback not showing on fullscreen MODAL page on Android #11

terreb opened this issue Oct 10, 2017 · 24 comments · May be fixed by #62

Comments

@terreb
Copy link

terreb commented Oct 10, 2017

Feedback doesn't show up on fullscreen modal page on Android.

nativescript CLI 3.2.1
tns-core-modules 3.2.0
tns-android 3.2.0
nativescript-feedback 1.0.6

Android 7.1

@EddyVerbruggen
Copy link
Owner

I don't think we can do anything about that as it's likely to be internal to the library we're wrapping here. Just to be sure: can you share a project that reproduces the issue?

@terreb
Copy link
Author

terreb commented Oct 11, 2017

Hi @EddyVerbruggen, here is the sample project:
https://github.com/terreb/feedback

Feedback shows up on the modal page on iOS but doesn't on Android where it's basically hidden behind the page. Does it do something with elevation on Android?

@terreb
Copy link
Author

terreb commented Oct 11, 2017

How do I get the feedback's nativeView?

@EddyVerbruggen
Copy link
Owner

Thanks for the sample, I can confirm the modal blocks the view.

The LoC responsible for adding the alert to the view is this one.

@terreb
Copy link
Author

terreb commented Oct 11, 2017

Ok, thanks, seems it's possible to get access to the native view by the reference
feedback.lastAlert, but only if it's already shown at least once. Setting elevation doesn't help. I'm not an Android developer, but another thing to try could be getting it's parent and then do bringChildToFront. I'm not sure whether the modal page and alerter are children of the same parent though. Would something like that work?

@EddyVerbruggen
Copy link
Owner

It's worth a shot.

@mhmo91
Copy link

mhmo91 commented Mar 6, 2018

Any updates here @EddyVerbruggen ?

@EddyVerbruggen
Copy link
Owner

No.

@petekanev
Copy link

Hey @EddyVerbruggen any idea if the plugin still works with the tns-core-modules changes after 4.0? No toasts seem to show, and I haven't had time to troubleshoot it.

@EddyVerbruggen
Copy link
Owner

@Pip3r4o I’m using it in this app which has all the latest bits: https://github.com/EddyVerbruggen/nativescript-pluginshowcase

Or are you referring to using it in a modal? I’ve never tried that.

@mhmo91
Copy link

mhmo91 commented Jun 17, 2018

@EddyVerbruggen if a modal is active n then the feedback is called, it shows behind the modal, so for me i had to close the modal to show the user the feedback, which is annoying..

@petekanev
Copy link

@mhmo91 that will supposedly be the native behavior too.

@webleaf
Copy link

webleaf commented Nov 18, 2018

need this too

@EddyVerbruggen
Copy link
Owner

I can't find a way to make it work. Leaving this open for others to take a stab.

@sanved77
Copy link

sanved77 commented Jun 11, 2019

When the modal works, it displays something like -
DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@9d71eda[NativeScriptActivity]
It fails to log this on a fullscreen activity.
I believe this might just be because of the Modal isn't given the permission to draw on the top of the root view.

@sanved77
Copy link

Just some food for thought, I personally had it not working too, until I realized that I am opening up the modal in an async await making it run in a background thread instead of the UI thread, thus making it impossible for it draw on the UI thread.
And when it tries to draw it on the background thread, the DecorView doesn't get the View to draw on and throws an exception which is being caught by the JS.
You can try and set this to false under package.json to experiment - discardUncaughtJsExceptions

@jerbob92
Copy link

@sanved77 all the Javascript in NS runs on the UI thread. Only things running in a worker don't run in on the UI thread.
I'll try to get this to work tomorrow.

@jerbob92 jerbob92 linked a pull request Mar 18, 2020 that will close this issue
@jerbob92
Copy link

I made a fix to at least be able to make the notification appear when in a dialog.
The solution is not pretty, it's in #62 . It might be useful for some. I will try to see if I can fix the issues.

@FlawaCLV
Copy link

FlawaCLV commented May 5, 2020

@jerbob92 I've tried your solution on my project but still not working... It looks like the android: { addToView: ... } is not taken into account.

EDIT: ok my bad, I've looked at your commit and the plugin has to be updated first. Thanks.

@MrSnoozles
Copy link

@EddyVerbruggen @jerbob92
https://github.com/Tapadoo/Alerter/releases/tag/7.0.0 was released 17 days ago. The changelog says "Added dialog support".
Would this fix this issue?

@jerbob92
Copy link

@EddyVerbruggen @jerbob92
https://github.com/Tapadoo/Alerter/releases/tag/7.0.0 was released 17 days ago. The changelog says "Added dialog support".
Would this fix this issue?

Yes, that does sound like it will fix it. You could try it out :)

@MrSnoozles
Copy link

I could and would like to, but I don't know how to write NativeScript plugins that use native components 😢

@jerbob92
Copy link

@MrSnoozles I don't think you have to develop anything. You can probably add something to your app gradle file to force the new version of the native component:

  configurations.all {
    resolutionStrategy.force "com.tapadoo.android:alerter:7.0.1"
  }

@jerbob92
Copy link

@MrSnoozles After looking at the changes of the project we might need to make some changes to support showing in a dialog indeed. We probably still need to detect whether we are in a modal like I put in this MR:
#62

We then need to pass the dialog into the constructor of the Alerter.

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

Successfully merging a pull request may close this issue.

9 participants