React-native-firebase: React 0.56 support

Created on 7 Jul 2018  ยท  22Comments  ยท  Source: invertase/react-native-firebase

Issue


Updating to react native v0.56.0 requires flow bin update to ^0.75.0 which results in following errors

Error โ”ˆโ”ˆโ”ˆโ”ˆโ”ˆ node_modules/react-native-firebase/dist/modules/firestore/Query.js.flow:417:20

Property fieldpath is missing in NativeFieldPath [1].

 [1]  46โ”‚   fieldPath: NativeFieldPath,
        :
     414โ”‚           fieldOrder.fieldPath.string
     415โ”‚         ) {
     416โ”‚           values.push(docSnapshot.get(fieldOrder.fieldPath.string));
     417โ”‚         } else if (fieldOrder.fieldPath.fieldpath) {
     418โ”‚           const fieldPath = new FieldPath(...fieldOrder.fieldPath.fieldpath);
     419โ”‚           values.push(docSnapshot.get(fieldPath));
     420โ”‚         }


Error โ”ˆโ”ˆโ”ˆโ”ˆ node_modules/react-native-firebase/dist/modules/storage/reference.js.flow:77:12

Cannot return new StorageTask(...) because StorageTask [1] is incompatible with
Promise [2].

     74โ”‚    * @return {Promise}
     75โ”‚    */
 [2] 76โ”‚   downloadFile(filePath: string): Promise<Object> {
 [1] 77โ”‚     return new StorageTask(
     78โ”‚       DOWNLOAD_TASK,
     79โ”‚       getNativeModule(this._storage).downloadFile(this.path, filePath),
     80โ”‚       this
     81โ”‚     );
     82โ”‚   }
     83โ”‚
     84โ”‚   /**


Error โ”ˆโ”ˆโ”ˆ node_modules/react-native-firebase/dist/modules/storage/reference.js.flow:100:12

Cannot return new StorageTask(...) because StorageTask [1] is incompatible with
Promise [2].

      97โ”‚    */
 [2]  98โ”‚   putFile(filePath: Object, metadata: Object = {}): Promise<Object> {
      99โ”‚     const _filePath = filePath.replace('file://', '');
 [1] 100โ”‚     return new StorageTask(
     101โ”‚       UPLOAD_TASK,
     102โ”‚       getNativeModule(this._storage).putFile(this.path, _filePath, metadata),
     103โ”‚       this
     104โ”‚     );
     105โ”‚   }
     106โ”‚ }
     107โ”‚

Environment

  1. Application Target Platform: iOS
  1. Development Operating System: macOS High Sierra
  1. Build Tools: Not needed
  1. React Native version: 0.56.0
  1. React Native Firebase Version: 4.2.0
  1. Firebase Module: firestore, storage
  1. Are you using typescript? no

Loving react-native-firebase? Please consider supporting them with any of the below:

General Build Error Fixed React Native Waiting for User Response

Most helpful comment

@smkhalsa hey; we're aiming for a release on the 7th. Thanks

All 22 comments

@IljaDaderko rn 56 has backwards compatible breaking changes so support for it will only land in v5.0.0, we have started work on it in this branch already: https://github.com/invertase/react-native-firebase/tree/react-native-56

Thanks for the heads up!


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

We already upgraded our project to React Native v0.56. Should I use the current version (v4.3.6) or wait for v5? Is there anything known to break in v4 other than flow errors (which we can ignore)?

@leethree there's this issue and all the ones linked above your comment e.g. there are issues with importing and using react-native-firebase in JS land due to breaking changes in the way the module is compiled with Babel; as it has been upgraded to v7:

image

Support will land in v5 in the next week or two hopefully.


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

@Salakar got it! we'll probably wait for v5 if it's coming soon.

@Salakar any idea when v5 will land?

@smkhalsa hey; we're aiming for a release on the 7th. Thanks

@IljaDaderko @leethree @smkhalsa and anyone else - React Native ^0.56.0 support is on master for anyone feeling daring.

Would be helpful if anyone could try it - 0.56 broke our testing infra so it's going to take me a couple of days to re-write it all again ๐Ÿ˜ญ - I have manually tested builds etc and all seems fine - including the flow issues above posted by @IljaDaderko being resolved.

If you're on v4.3.x currently then your only update step (for now - v5 still WIP) is updating to RN 0.56.0 and all your babel versions as described in the RN 56 release notes.

See https://github.com/invertase/react-native-firebase/blob/master/bridge/package.json for an example app running the latest versions.


Testing infra is going to delay v5 release - but I can publish a next tagged release that works with RN 56 once confirmed all ok - so you can live on the bleeding edge while v5 is worked on.


Update:

npm i react-native-firebase@next

Hi @Salakar , can you make a RC release? I tried to use master branch for testing but the files is not bundled and I need to manually build it.

@timwangdev as requested;

image

npm i react-native-firebase@next

As always please report any issues you find, additionally can you tag them [next] on your GitHub issue titles so I can pick them up easier.

Thanks ๐Ÿ‘

I just tried upgrading my project to the RC and im stuck getting the error:

unable to resolve module '../crash' from `/Users/alexic/react-native/sesh/node_modules/react-native-firebase/dist/modules/core/firebase.js`: The module `../crash` could not be found from `/Users/alexic/react-native/sesh/node_modules/react-native-firebase/dist/modules/core/firebase.js`. Indeed, none of these files exist:

but it looks like firebase.js isn't requiring such a module. I tried reinstalling the package with no luck.

@alexichristakis can you try reset your rn packager cache, start it with --reset-cache

@Salakar still no luck

Can you try npm i [email protected] - specifying the version specifically?

rolling back to an old branch and reinstalling now. maybe something got messed up the first time...

Ok, am on discord as well if you still continue to have issues ping me on there and I can take a look

Confirmed working on npm i [email protected]. Closing this issue pending the full release of v5.


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

@Salakar
Hi, I managed to get it working (I mean the unable to resolve module problem) by doing this:

watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean --force && npm install && npm start -- --reset-cache

It was indeed a problem of cache, expecially because the new metro bundler on react native 0.57 is strange when installing/updating packages when it's already running.

If I have a RN v0.56 app and currently using RNFilrebase v4.2.0, should I upgrade the latest v4.3.x or wait until the v5.0 is released?

@gianpaj You could use @next release. It works fine on our project.
@Salakar It's better to see 5.0.0 release coming soon, of cause.

@Salakar I will be playing with my side project this weekend can try out latest v5 rc, should it be compatible, is it by any chance compatible with rn 0.57.x, so I can try both? Also which versions of firebase ios sdk should be used?

@IljaDaderko it is fully compatible with 0.56 & 0.57 now - our tests app runs on 0.57, see react-native-firebase/tests if you'd like - as a reference to which versions of RN/React/Firebase etc to use ๐Ÿ‘

I'll be about most of the weekend on Discord so feel free to drop me a DM if you have any issues or need an assist.

See the pinned messages on Discord in the #pre-releases channel for RC release notes - latest is RC4 from yesterday.

We are going to be updating our project from 0.55.4 -> 0.57 in the coming weeks. We are currently on RNFirebase v4.3.8, the latest one is v5.1.x.

Should we update from v4.3.8 -> v5.0.0 then from v5.0.0 -> v5.1.0? or can we just make the jump from v4.3.8 -> v5.1.0?

I looked at the docs and wasn't sure if that's possible.

https://rnfirebase.io/docs/v5.x.x/release-notes#React-Native

Was this page helpful?
0 / 5 - 0 ratings