-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
"method is deprecated and will be removed" Solution: migrate to modular style APIs. There is a guide #8282
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
getApp()
instead
Maintainer here 👋 This message will trigger for every API you use that is deprecated, so basically every single time you use any of the non-modular / chained APIs directly off one of the firebase modules - they are easy enough to search for in each file. You will need to move to the new non-modular APIs.I will really underline to everyone: This sounds painful. When I first looked into it in my projects I thought "oh no..." The API move is purely mechanical though. It is really just changing syntax. It is not difficult, it just changes a lot of files. The migration is not to be feared.We just posted up a migration document but this isn't a bug or an issue or anything. The migration is straightforward thankfully - see here for how you migrate, or - once you accept that you know react-native-firebase v22 will drop all the APIs that are warning you - you can defer your maintenance as long as you like and disable the messages https://rnfirebase.io/migrating-to-v22 (note, the feature of disabling the messages is present in react-native-firebase 21.7.3+) Frequent QuestionsThings I'm noting as I read comments here, we will add to the migration guide as we see people's concerns: -" is it that critical?" the APIs will be removed in react-native-firebase v22 so you will not be able to upgrade until you complete the migration. How critical is it for you to maintain a path to upgrade such that you maintain the ability to receive bugfixes, new ios/android system support, etc? Every project has a different timeline and answer for that
Indeed there are still some typing issues at the moment, for typescript users. We are treating those as high priority bugs and fixing them as quickly as possible
Cheers |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@fobos531 I would just use |
@mikehardy are we supposed to use it like this: import {getAuth} from '@react-native-firebase/auth';
const auth = getAuth();
const user = auth.currentUser;
auth.createUserWithEmailAndPassword(email, password);
await user.updateProfile({
displayName: 'John Smith',
photoURL: "https://example.com/jane-q-user/profile.jpg",
}); OR import {createUserWithEmailAndPassword, getAuth, updateProfile} from '@react-native-firebase/auth';
const auth = getAuth();
const user = auth.currentUser;
createUserWithEmailAndPassword(auth, email, password);
await updateProfile(user, {
displayName: 'John Smith',
photoURL: "https://example.com/jane-q-user/profile.jpg",
}); I tried looking at the documentation but it doesn't seem to be updated yet. The migration documentation links firebase which suggests: import { getAuth, updateProfile } from "firebase/auth";
const auth = getAuth();
updateProfile(auth.currentUser, {
displayName: "Jane Q. User", photoURL: "https://example.com/jane-q-user/profile.jpg"
}) I'm confused as to whether there is a difference between using one over the other? Also should I be calling function AuthProvider({children}) {
const auth = getAuth(); |
@KrisLau in general, you should follow all the guides for using the modular API that are available in the upstream firebase-js-sdk documentation: https://firebase.google.com/docs/auth/web/password-auth When in doubt, assume the upstream modular documentation style should be followed and that our local documentation on rnfirebase.io has not caught up yet It should work and when in doubt, assume that if using the modular API the way firebase.google.com shows does not work here, that we have a bug here. The goal is always for react-native-firebase to be a drop-in / works-the-same replacement for firebase-js-sdk so that upstream docs are correct and we function the same |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Having the same warning coming from AppCheck, but for some reason I can't get it working with the new syntax. I'm following this documentation: https://rnfirebase.io/app-check/usage Firebase Version: This is my current code raising the warning: import appCheck from "@react-native-firebase/app-check";
const rnfbProvider = appCheck().newReactNativeFirebaseAppCheckProvider();
rnfbProvider.configure({
// My Configuration
});
// initialize AppCheck with the modular approach
appCheck().initializeAppCheck({
provider: rnfbProvider,
isTokenAutoRefreshEnabled: true,
}); And this is what i'm implementing: import { ReactNativeFirebaseAppCheckProvider, initializeAppCheck } from `@react-native-firebase/app-check`;
rnfbProvider = new ReactNativeFirebaseAppCheckProvider();
rnfbProvider.configure({
// My Configuration
});
// initialize AppCheck with the modular approach
initializeAppCheck({
provider: rnfbProvider,
isTokenAutoRefreshEnabled: true,
}); But ReactNativeFirebaseAppCheckProvider isn't found in the module and is throwing this error: |
This comment has been minimized.
This comment has been minimized.
there is no documentation on how to inititalize |
@omerts this is the best example now - it is what I arrived it in my last namespace -> modular sweep: react-native-firebase/packages/app-check/e2e/appcheck.e2e.js Lines 371 to 404 in d709f76
|
This comment has been minimized.
This comment has been minimized.
Hey @andrastoth-ws
Yes - I had the same need for precision when I was migrating our e2e codebase to not have these warnings, so I added the ability to throw a stack trace when it happens, via a toggle that turns on "strict mode". It is documented in the migration guide you linked: https://rnfirebase.io/migrating-to-v22#enabling-deprecation-strict-modes |
This comment has been minimized.
This comment has been minimized.
@Rakshitg600 sorry for this - those AuthProviders weren't exported correctly yet in the modular API, PR #8323 fixes this - it just finished review and final CI checks and is releasing now You should be able to use it as a named export and have it work, though you do not want to chain method calls of import { GoogleAuthProvider, getAuth, signInWithCredential } from '@react-native-firebase/auth';
const googleCredential = GoogleAuthProvider.credential(idToken);
const userCredential = await signInWithCredential(getAuth(), googleCredential); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@mikehardy , import React, { useState, useEffect } from 'react'; const NotificationController = ({ navigation }) => { useEffect(() => {
}, []); return (
); export default NotificationController; |
Please change these lines- import messaging from '@react-native-firebase/messaging'; replace with - import { getMessaging, onMessage, getToken, onNotificationOpenedApp, getInitialNotification } from '@react-native-firebase/messaging'; useEffect(() => {
}, []); replace with - useEffect(() => {
}, []); |
Hey @mikehardy , thanks for the amazing support. I've just finished my project's migration and I have a couple of questions that you might be able to help me with.
I did not run into this method during the migration. Types and code seem to still be working as if it is a property.
I had to manually type it using |
Hey @cbdeveloper - 1- I peeled that DocumentSnapshot.exists item off to a new issue, that'll need a fix |
[Maintainer edit 👋 - We are resolving comments as people note things and we implement changes - but we really appreciate any feedback. If you convert to modular namespace and still see deprecation messages, or have other feedback, please leave a comment. Thanks]
Got Warning
This v8 method is deprecated and will be removed in the next major release as part of move to match Firebase Web modular v9 SDK API. Please use
getApp()
instead.on both Android and IOS
The text was updated successfully, but these errors were encountered: