Skip to content

Angular BottomNavigationBar showBadge fix #139

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

Merged
merged 1 commit into from
Apr 29, 2020

Conversation

james-criscuolo
Copy link
Contributor

The code was trying to call showBadge on this: https://developer.android.com/reference/com/google/android/material/bottomnavigation/BottomNavigationView

Overwriting this from outside the library with getOrCreateBadge works as expected.

…igationView, replace with getOrCreateBadge
@farfromrefug farfromrefug merged commit 3b2989f into nativescript-community:master Apr 29, 2020
@farfromrefug
Copy link
Member

thanks @james-criscuolo !!
Do you want a release or can you wait for the next one?

@james-criscuolo
Copy link
Contributor Author

It can wait, i have the overwrite in my code for now. Thanks for the quick take though!

My other investigation on this library is making it work with angular 9. I am using your bottom nav bar because our project was using nativescript's deprecated bottom nav, which didn't work with [what is expected to be the stable nativescript-angular for angular 9](NativeScript/nativescript-angular#2124. The new bottom nav also seems to have some issues, and doesn't have badges, so I found your project and managed to get it up and running with angular 9, with ivy disabled.

Enabling ivy, this library breaks the build. Is this something you are investigating, or would you be open to me taking a stab at it? It may be as simple as updating the dependencies, I am not sure yet, but I figure it's worth asking before making the attempt.

@farfromrefug
Copy link
Member

@james-criscuolo what is ivy? Sorry i am not using angular dev.
If it is angular related i would prefer for you to have a go and i can help :D
If it is something else let me know

@james-criscuolo
Copy link
Contributor Author

Angular replaced their compiler, the old one was called ViewEngine, the new one is called Ivy. Ivy was experimental in version 8, but is now default in version 9, and comes with a bunch of improvements. In version 10, ViewEngine will be gone.

I believe in the current situation, libraries don't have to change to support angular 9 w/ ivy, they were waiting for 10 to change build artifacts, but maybe how nativescript-angular is implementing it, this will not be true for nativescript. It is very possible this will be a breaking change, but I will be sure to test with 8, 9 w/ ivy, and 9 w/0 ivy, assuming I get far enough to test.

@farfromrefug
Copy link
Member

@james-criscuolo ok didn't know. Maybe it fails because i generate angular metadata with ngc which are not compatible with ivy. Would need to talk to other plugin devs to see if can get rid of ngc build.

@james-criscuolo
Copy link
Contributor Author

That is almost certainly the root of the issue. I will definitely mess around, but if you have other plugin developers you can ask, I'm sure they will know more.

@james-criscuolo
Copy link
Contributor Author

Just wanted to update, I gave this a go, and I think it's going to take a bit deeper understanding. I was able to update dependencies and package something that looked correct, but my app will not take it. I also ran into issues attempting to run the angular demo in this repo, otherwise that would've been the better place to test against. The normal demo had a handful of typescript errors that did not stop compilation after the typescript update (not sure about before), but seemed to work (with the exception of the top choice (button I think?), which crashes the app. It looked like a nativescript error, so I thought that probably exists on master too.

I may put a pull request together to fix the demos, but I'm not sure I'll be able to get to it quickly.

@farfromrefug
Copy link
Member

@james-criscuolo let's continue that discussion on slack. Might be better . there you can show me the errors you get with the demo. I might be able to help.

@kmmccafferty96
Copy link
Contributor

kmmccafferty96 commented Jun 3, 2020

UPDATE: I went ahead and submitted this as an issue for visibility: #141

Is there any update on supporting angular 9/ivy with nativescript-material-components? I’m also getting errors saying it’s not compatible. It works fine with ivy turned off.

Just for reference, here are the errors I'm getting while trying to build with Ivy enabled:

This likely means that the library (nativescript-material-button/angular) which declares NativeScriptMaterialButtonModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

3 export declare class NativeScriptMaterialButtonModule {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/nativescript-material-cardview/angular/index.d.ts:3:22 - error NG6003: Appears in the NgModule.exports of AppCommonModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.

This likely means that the library (nativescript-material-cardview/angular) which declares NativeScriptMaterialCardViewModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

3 export declare class NativeScriptMaterialCardViewModule {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/nativescript-image/angular/nativescript-image.module.d.ts:1:22 - error NG6003: Appears in the NgModule.exports of AppCommonModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.

This likely means that the library (nativescript-image/angular) which declares TNSImageModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

1 export declare class TNSImageModule {

I could make this a separate issue in your repo if you'd like. Let me know, thanks!

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

Successfully merging this pull request may close these issues.

3 participants