nativescript-community / ui-drawer

NativeScript plugin that allows you to easily add a side drawer (side menu) to your projects.
https://nativescript-community.github.io/ui-drawer/
Apache License 2.0
24 stars 12 forks source link

Error on Android with Angular and APP_INITIALIZER #5

Closed jamescodesthings closed 3 years ago

jamescodesthings commented 3 years ago

Which platform(s) does your issue occur on?

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.

When using the plugin in a nativescript angular project with an async APP_INITIALIZER the app dies due to the early call to installGestures() here: https://github.com/nativescript-community/ui-drawer/blob/master/src/index.ts#L14

Proposed solution is to remove this call as it is called in the install() function exported by this plugin.

To reproduce: 1) Create a blank ns-angular app. 2) Add the plugin 3) Add an async APP_INITIALIZER & launch screen as described here: https://blog.nativescript.org/angular-launch-animations/ 4) Run on Android emulator/device.

Error is that a view/frame doesn't exist when installGestures() is called, causes app death.

Workaround for me for now has been to back off to the RadSideDrawer plugin.

Is there any code involved?

Will create demo and get it in here.

jamescodesthings commented 3 years ago

Exact error is: JS: ERROR Error: a page is needed to attach a gesture

Demo is here: https://github.com/jamescodesthings/demo-ui-drawer-issue-5

farfromrefug commented 3 years ago

@jamescodesthings your error seems to come from somewhere else. I mean i think you need to call installGestures again. The error you extracted means the install method has NOT been called. Why is the drawer plugin required from the launch screen? makes no sense and i think should not happen.

jamescodesthings commented 3 years ago

Closing. Cheers @farfromrefug

The issue for me was a bit of a strange one but I think one of the problems here was I'd oversimplified my demo repo.

I've updated the demo repo with it working as expected now. Cheers.