invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.6k stars 2.19k forks source link

✨ v6.0.0 ✨ #2025

Closed Salakar closed 4 years ago

Salakar commented 5 years ago

Hey everybody πŸ’›

Super excited to announce that we're just over halfway through our v5 -> v6 migration + overhaul, and; there are so many great things there already for you to try out. We say this every time but really; this is our 'largest release yet' xπŸ’―

So please πŸ™ check out the changelog and if all the Firebase services that you use are already listed there then you are good to migrate to the new individual npm packages. They are only released as patch versions for now until all packages are ready - at which point they'll be published as v6.0.0 - I'd recommend locking your package versions until this time.

Instructions can be found on the changelog. Please bare with us well we work towards v6, you have not been forgotten.

I will update this issue with currently being worked on modules and modules next in line, so subscribe to be notified of that and other announcements.

Blog posts about v6.0.0


React Native Firebase is built and maintained with πŸ’› by Invertase.


Salakar commented 5 years ago

Hey all; 0.0.26 is up.




Small note: I've switched to publishing all the new packages to the latest tag now on NPM but only as patch versions still, won't be v6.0.0 until they're all ready.

I've done this as publishing a new package to NPM even if tagged will still create a latest release - and some people end up using the latest ones (which in most cases are just a placeholder) instead of the tagged alpha ones which are up to date.

So as of this message, the latest version you want to be installing is 0.0.26, I'd recommend also locking your package versions so as not to get surprise patch updates when npm installing.

New packages:

 - @react-native-firebase/app-types@0.0.26
 - @react-native-firebase/app@0.0.26
 - @react-native-firebase/auth@0.0.26
 - @react-native-firebase/common@0.0.26
 - @react-native-firebase/config@0.0.26
 - @react-native-firebase/crashlytics@0.0.26
 - @react-native-firebase/database@0.0.26
 - @react-native-firebase/fiam@0.0.26
 - @react-native-firebase/firestore@0.0.26
 - @react-native-firebase/iid@0.0.26
 - @react-native-firebase/indexing@0.0.26
 - @react-native-firebase/invites@0.0.26
 - @react-native-firebase/links@0.0.26
 - @react-native-firebase/ml-natural-language@0.0.26
 - @react-native-firebase/perf@0.0.26
 - @react-native-firebase/storage@0.0.26
 - @react-native-firebase/template@0.0.26
 - @react-native-firebase/utils@0.0.26
Salakar commented 5 years ago

πŸ‘‹ the following modules are now in progress and quite far along:


As for Notifications notifications() - I'd like to start some discussion on this and the feature sets that should land in v6 and future releases. If you're using notifications heavily and have the time to join in the discussions please do so on the #notifications channel on this Discord server: https://discord.gg/rHjpxts

Salakar commented 5 years ago

v6 Firestore PR is now up: https://github.com/invertase/react-native-firebase/pull/2319 by @Ehesp 🌟

Only a few small things left to do on it, specifically types & transactions.

If you're curious on what's changed, check out the changelog for it: [changelog]

cjadhav commented 5 years ago

Hi Guys,

Thanks for comments it helped to solve the issues to implement V6 in my application. The main purpose of using firebase is for analytics only. I am able to implement V6 with new RN 0.60 on iOS with cocoa pods. but facing weird problem for android. The error is coming as soon as app opens, (no compile time errors) RNFBAnalyticsModule tried to override ReactNativeFirebaseAnalyticsModule

I have updated my system to latest and configuration as as follows,

System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 824.24 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.3 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.0 => 0.60.0 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-create-library: 3.1.2
    react-native-git-upgrade: 0.2.7

And package.json is

"dependencies": {
    "@react-native-community/async-storage": "^1.5.0",
    "@react-native-community/eslint-config": "^0.0.5",
    "@react-native-community/netinfo": "^4.0.0-alpha.1",
    "@react-native-firebase/analytics": "^0.0.26",
    "@react-native-firebase/app": "^0.0.26",
    "bugsnag-react-native": "2.21.1",
    "dateformat": "3.0.3",
    "eslint": "^6.0.1",
    "i18n-js": "^3.3.0",
    "lodash": "4.17.11",
    "moment": "2.24.0",
    "react": "16.8.6",
    "react-native": "0.60.0",
    "react-native-dates": "2.0.4",
    "react-native-device-info": "2.1.2",
    "react-native-loading-spinner-overlay": "1.0.1",
    "react-native-maps": "^0.24.2",
    "react-native-responsive-ui": "2.1.1",
    "react-native-router-flux": "4.0.6",
    "react-native-scrollable-tab-view2": "0.8.2",
    "react-native-splash-screen": "3.2.0",
    "react-native-statusbar-alert": "0.4.0",
    "react-native-webview": "6.3.1",
    "schedule": "0.5.0"
  },
  "devDependencies": {
    "@babel/core": "^7.4.5",
    "@babel/runtime": "^7.4.5",
    "babel-jest": "24.8.0",
    "jest": "24.8.0",
    "metro-react-native-babel-preset": "0.54.1",
    "react-test-renderer": "16.8.6"
  },

In android, (Gradle 5.4.1) <project>/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

subprojects {
    afterEvaluate { project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion        // version of compile sdk used for project
                buildToolsVersion rootProject.ext.buildToolsVersion    // version of build tool used for project

                lintOptions {
                    abortOnError false
                }
            }
        }
    }
}

<project>/app/build.gradle


dependencies {
    implementation project(':@react-native-firebase_analytics')
//    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation project(':@react-native-firebase_app')
    implementation project(':@react-native-community_netinfo')
    implementation project(':@react-native-community_async-storage')
    implementation project(':react-native-webview')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-device-info')
    implementation project(':bugsnag-react-native')
    implementation project(':react-native-maps')
    implementation(project(':react-native-maps')) {
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    implementation ('com.google.android.gms:play-services-gcm:15.0.1') {
        force = true;
    }
    implementation 'com.google.android.gms:play-services-base:+'
    implementation 'com.google.android.gms:play-services-maps:+'
    implementation 'com.google.android.gms:play-services-location:+'
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules

    // JSC from node_modules
    if (useIntlJsc) {
        implementation 'org.webkit:android-jsc-intl:+'
    } else {
        implementation 'org.webkit:android-jsc:+'
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

apply plugin: 'com.google.gms.google-services'

also updated MainApplication.java as per RN0.60

@Override
    protected List<ReactPackage> getPackages() {
        @SuppressWarnings("UnnecessaryLocalVariable")
        List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      // packages.add(new MainReactPackage());
        packages.add(new ReactNativeFirebaseAnalyticsPackage());
        packages.add(new ReactNativeFirebaseAppPackage());
        packages.add(new NetInfoPackage());
        packages.add(new AsyncStoragePackage());
        packages.add(new RNCWebViewPackage());
        packages.add(new SplashScreenReactPackage());
        packages.add(new MapsPackage());
        packages.add(new RNDeviceInfo());
        packages.add(BugsnagReactNative.getPackage());
      return packages;
    }

I am not sure is this right place to share the issue but hoping to get some guidance.

Thanks!

Salakar commented 5 years ago

@cjadhav RN 0.60 has auto-linking which RNFB v6 supports - you don't need to add these to your gradle files anymore, I'd remove the following from your android project:

MainApplication.java:

        packages.add(new ReactNativeFirebaseAnalyticsPackage());
        packages.add(new ReactNativeFirebaseAppPackage());

app/build.gradle:

    implementation project(':@react-native-firebase_analytics')
//    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation project(':@react-native-firebase_app')

(also remove them from settings.gradle if you've added them there too)

You'll probably need to do this for the other modules that you have manually linked as well, afaik AsyncStorage, WebView, NetInfo, DeviceInfo etc all support auto-linking

Salakar commented 5 years ago

Howdy πŸ‘‹

The Messaging PR is now up, there are still a few things left to do though; for those interested changes can be seen here:

πŸ‘€

andrewhartwig commented 5 years ago

Hey guys, I know the documentation is incomplete, and so I seem to be missing a key step somewhere. I've followed all the v6 set up guides, but it seems like something is still an issue.

    "@react-native-firebase/app": "^0.0.26",
    "@react-native-firebase/crashlytics": "^0.0.26",

import crashlytics from '@react-native-firebase/crashlytics';

const App = () => {
  crashlytics.crash();

Based on the documentation this should work, but I'm getting two separate errors:

Android: No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp(). I tried doing that but I'm missing parameters and don't see any documentation on how to initalize firebase.

iOS: _crashlytics.default.crash is not a function

andrewhartwig commented 5 years ago

Will the v5.x.x versions of RNFB work with the latest 0.60 RN?

mikehardy commented 5 years ago

@andrewhartwig v5xx is supposed to work with RN0.60, but you will need the jetifier packager (which you will likely need for other libraries as well). I'm currently converting my main project to RN60 and although it is painful, I'm not currently blocked by react-native-firebase

ghost commented 5 years ago

@mikehardy will i have to use jettifier for v6 too?

mikehardy commented 5 years ago

@bakaa99 I can't say for certain because I don't know what dependencies you have, but you won't need jetify for react-native-firebase v6 (as it is AndroidX already) or RN0.60 (already AndroidX) but I anticipate there will be a large number of libraries that don't update for a while (maintainers on vacation or whatever) so you will likely need to jetify for a little while during the transition. If you're not sure, you can delete node_modules, re-install all your modules, then try it clean or try the ./gradlew :app:dependencies to check. Or alternatively, if you try react-native-firebase v6 but you are stuck on older react-native (maybe because Expo), then you'll need jetify -r to maintain support library alignment.

Salakar commented 5 years ago

Friday surprise πŸŽ‰

The following have landed on master;

Still a few bits left to do on them before we can publish an alpha though.

Side note; Merging those three above brings us well over 1,000 tests 😱

image


Think the work we're doing for v6.0.0 is great? Please consider supporting the project with any of the below, thank you.

paolospag commented 5 years ago

@Salakar amazing news!

Are there any news regarding notifications? What is the ETA?

marcomarasco commented 5 years ago

@Salakar good job! how i can test this new release on master? is already available on NPM?

congnguyen91 commented 5 years ago

Hi, is the messaging package released on master? :) I tried to install by yarn but it occurred error

yarn add @react-native-firebase/messaging --force
yarn add v1.17.3
warning ../package.json: No license field
[1/4] πŸ”  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@react-native-firebase%2fmessaging: Not found".
info If you think this is a bug, please open a bug report with the information provided in ..
Psiiirus commented 5 years ago

Can somebody please tell me which version of the Firebase iOS SDK I have to install if I want to use version 6 ?

mikehardy commented 5 years ago

@Psiiirus I believe it will work tiwh 5.20.x or later but I also believe it works well with "current", so I would install the most current. https://firebase.google.com/support/release-notes/ios says that's 6.5.0 right now

Salakar commented 5 years ago

@Psiiirus I believe it will work tiwh 5.20.x or later but I also believe it works well with "current", so I would install the most current. firebase.google.com/support/release-notes/ios says that's 6.5.0 right now

Correct, master is also on 6.5.0, but it was on 5.20.x previously.

Psiiirus commented 5 years ago

@mikehardy @Salakar thanks your reply...I downgraded back to rnf 5.5 with SDK 6.5 which worked fine on android and iOS ...think i'll have to upgrade my iOS to Pods usage to be state of the art and avoid unnecessary errors ^^

AilsonFreire commented 5 years ago

I'm facing the same problem as @congnguyen91: Resolving packages... error An unexpected error occurred: "https://registry.yarnpkg.com/@react-native-firebase%2fmessaging: Not found".

rgommezz commented 5 years ago

@Salakar what's the approx ETA for an alpha release on Cloud Firestore? πŸ€–

Ehesp commented 5 years ago

@rgommezz We just have iOS transactions left, so should be released by the end of the month!

All of the tests are there & work for Android. If anyone feels up to it, finishing off the iOS code and sending a PR would be awesome.

rgommezz commented 5 years ago

Thanks very much for the update @Ehesp, looking forward!

Awesome work guys! πŸ₯‡

bosung90 commented 5 years ago

Is @react-native-firebase/firestore supposed to work for Android? I was getting some compile errors after I did react-native link @react-native-firebase/firestore

sudomann commented 5 years ago

Many of the manual native installation steps for Android & iOS have been removed / internally automated and most modules can now be used just by linking it (e.g. react-native link @react-native-firebase/analytics).

Now that React Native 0.60.x is doing away with linking of native packages, how would one go about using your packages?

Ehesp commented 5 years ago

Is @react-native-firebase/firestore supposed to work for Android? I was getting some compile errors after I did react-native link @react-native-firebase/firestore

See message above, it's not released yet.

fungilation commented 5 years ago

Many of the manual native installation steps for Android & iOS have been removed / internally automated and most modules can now be used just by linking it (e.g. react-native link @react-native-firebase/analytics).

Now that React Native 0.60.x is doing away with linking of native packages, how would one go about using your packages?

Ya, I can't get 5.5.5 to work on RN 0.60.4 on Android. iOS works. Anyone else have trouble on android? https://github.com/invertase/react-native-firebase/issues/2411

chamaldesilva commented 5 years ago

v5.2.1 also have issue. any solution or version for this issue?

mikehardy commented 5 years ago

@dzilva - sorry - I can't support anything that old - my main focus is on getting v5 working correctly with the current versions of the rest of the ecosystem (up to date Firebase SDKs, up to date react-native) so I won't offer support for that.

I do have react-native 0.59 working great for Android and iOS on v5.5.5 plus 2 PRs (#2415 #2414) examine https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-rn59.sh

@fungilation I have react-native 0.60 working fine on Android (doesn't need #2415 - works with v5.5.5 stock) examine https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

None of this has anything to do with v6.0.0 of react-native-firebase though, so I'm going to minimize all these comments.

chamaldesilva commented 5 years ago

I'm getting this error,

RNfirebase core module was not found natively on android

Can you help me to fix? I already tried clean and rebuild, version downgrading. not working.. I'm using Expo + RN

mikehardy commented 5 years ago

Expo, not ExpoKit? That will never work with native modules. Fundamental property of Expo. It's in the docs

chamaldesilva commented 5 years ago

Much appreciate your comment. I'm a beginner so sorry. Can I fix it? still I'm getting same error. I'm running Expo and two physical devices (iPhone and android) How can I connect to firebase for phone auth?

creative-git commented 5 years ago

is database working well with V6 ? I followed the documentation , but ios building fails after installing database RN: 0.60 RNFB: v6

Ehesp commented 5 years ago

@creative-git please create an issue following the issue template.

Salakar commented 5 years ago

Hey all πŸ‘‹

Just published a new "v6" release. Quite a lot changed on this one so I minor versioned it at 0.1.0 for each package (not semver until v6 release).

Notable Changes

Other Changes

See the commit history for other changes.

Known Issues

Salakar commented 5 years ago

Another release up, small changes;

Version: 0.1.2


If anyone wants to help bring the final v6 release along quicker, please check out the remaining items on the project board; and, if you can help with any of them and send PRs please do πŸ’›

[v6 Release - Project Board]

congnguyen91 commented 5 years ago

Hi, Please help me where I can set "firebase-bom"?

implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}")
Salakar commented 5 years ago

@congnguyen91 hi, do you mean you need to customise the version or is something erroring saying its missing?

congnguyen91 commented 5 years ago

@Salakar At the moment I am working with both of AndroidX & Non-AndroidX project. So I want to test or downgrade firebase-version to avoid build error for non-androidx.

maxbeech commented 5 years ago

Hi there,

How do we upgrade from v5 please? I can't find info on it anywhere. Ive tried these so far but no luck (I'm using npm not yarn)

npm install react-native-firebase@6.0.0 npm install @react-native-firebase/app@alpha npm install @react-native-firebase/app@6.0.0-alpha

(I assume we will need to do the same with the individual ones? Something like this perhaps?) npm install @react-native-firebase/crashlytics@alpha

Thanks a ton!

Salakar commented 5 years ago

@congnguyen91 ah, yes you can, add the following to your app/build.gradle to customise the BoM version;

project.ext {
  set('react-native', [
    versions: [
      firebase: [
        bom: "21.1.0", // change me
      ],
    ],
  ])
}
Ehesp commented 5 years ago

Version 0.1.3 released:

holgersindbaek commented 5 years ago

@maxbeech Did you figure this out? I need to use v6 because of this issue (https://github.com/invertase/react-native-firebase/issues/2305), but I can't find any guides on how to use v6.

Ehesp commented 5 years ago

@holgersindbaek have you looked at https://invertase.io/oss/react-native-firebase/

maxbeech commented 5 years ago

@holgersindbaek sadly not, sorry. I just downgraded :(

kevindoole commented 5 years ago

Hey folks,

Great work, love the project. I'm considering upgrading because i want to use Firestore's collectionGroup which appears to require react-native-firebase 6. It seems unlikely i could upgrade only firestore and continue using the rest of the rnf5 modules my code relies on. Can i pick and choose which modules i upgrade? Or i need to do a wholesale upgrade to 6?

mikehardy commented 5 years ago

wholesale upgrade only. I think it's down to just notifications not on v6 though, so it's rapidly becoming possible for most, and soon all people to move to it. (for people completely dependent on admob revenue - that one is active development, so be careful to test things and don't go broke...)

Ehesp commented 5 years ago

Version 0.2.3 released (breaking changes):

Testing AdMob using your own AdMob account would be very much appreciated. We will be releasing Banner and Native (pending review) ads in the coming weeks.

ACoolmanBigHealth commented 5 years ago

~I have an existing android/ios app that uses the GA analytics. I'm only only need Analytics, and maybe Performance. From quick look over the project, these pieces look pretty solid in v6 and I'm tempted to skip v5 . Is that overly optimistic?~

Currently on react-native 59.1, and using fastlane for CI

thanks

EDIT: Whoops, only supports for RN 60

mikehardy commented 5 years ago

@AshleyColemanBigHealth might still pay off to go to RN60 and then use RNFB6 ? the effort to move from RNFB5 to RNFB6 later might about the same as RN59->RN60 now, so maybe one work chunk vs 2 total