Closed cjohn001 closed 3 years ago
Hi @cjohn001, I'm not sure what the import should be for the rc version because I didn't make it.
Maybe import * as firebase from "@nativescript/firebase"
?
Hello @EddyVerbruggen, thanks for the reply. I have this import syntax from
https://nativescript.org/blog/nativescript-7-compatible-plugins/#comment-5072910013
which says
Breaking changes: import { firebase } from @nativescript/firebase vs. import * as firebase from @nativescript/firebase Let us know if you have any firebase issues and once confirmed clear for majority we'll publish a final.
Can you tell me who did the rc version? I will then try to contact him.
@EddyVerbruggen so i am having the same issue. and in NS7 the import needs to be as mentioned by cjohn001. the analytics are working with firebase.analytics but there is naturally a warning (below) because there is no analytics object in the firebase.d.ts
error TS2339: Property 'analytics' does not exist on type 'typeof firebase'.
132 firebase.analytics.logEvent({
@RealZimboGuy if you find out how to use analytics object with NS7, please document it here. I have not found the time yet to resolve this issue as I am still having a hard time to get my App running with NS7 in general.
@cjohn001 got it ..... (insert party time) trial and error to be honest to find it.
import { firebase } from "@nativescript/firebase" import { analytics } from "@nativescript/firebase/analytics"
then pretty much everything works as you expect eg, analytics.logEvent({ key:"page_view", parameters: [{ key:"page_id", value: event.urlAfterRedirects }] });
This comment is just to try help any future people with google searches
Cannot read property 'logEvent' of undefined
@RealZimboGuy great, thanks a lot for documenting it here. I will then close the issue.
Best regards, Christoph
Hello @EddyVerbruggen, I am currently trying to get the rc version of this plugin running with NS7. I run into some issues that I assume changed with the updated plugin.
If I import as follows
import { firebase } from '@nativescript/firebase';
firebase.analytics seem to be unknown now. Is it nor supported anymore or do I need to search under a different namespace?
Second question, I changed the registration to the following code. The registration for me does not seem to be related to the analytics namespace, however, might this be the source of error?
registerElement( 'MLKitBarcodeScanner', () => require('@nativescript/firebase/mlkit/barcodescanning').MLKitBarcodeScanner );