-
Notifications
You must be signed in to change notification settings - Fork 45
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
Firebase version 9 #62
Comments
I wrote a dirty patch that allowed me to use with v9
import { ref, uploadBytesResumable } from "firebase/storage"
const refForUploader = ref(storage, "images")
refForUploader["child"] = function (filename: string) {
const newRef = ref(this, filename)
newRef["put"] = function (file: any, metadata: any) {
return uploadBytesResumable(newRef, file, metadata)
}
return newRef
} |
I was able to upload images by loading importing the Firebase 9 libraries in compatibility mode, like so: import firebase from "firebase/compat/app";
import "firebase/compat/auth";
import "firebase/compat/database";
import "firebase/compat/storage"; The format of the data returned to the {
"_delegate": {
"bytesTransferred": 6828,
"totalBytes": 6828,
"metadata": {
"type": "file", A few other, somewhat arbitrary, changes that I've seen:
These changes were enough to get it working for my purposes. I'll consider a PR if anybody is still maintaining this component, but it doesn't look as if they are. I've copied the code directly into my own project and modified it there for now. |
@fringley Thanks a lot! 👍 With TS you will get some errors, so this is what I ended up using: // @ts-expect-error firebase v9 hack for react-firebase-file-uploader
refForUploader.child = function (filename: string) {
const newRef = ref(this, filename);
// @ts-expect-error firebase v9 hack for react-firebase-file-uploader
newRef.put = function (file: any, metadata: any) {
return uploadBytesResumable(newRef, file, metadata);
};
return newRef;
}; |
@0x80 oh that's handy - i didn't know about that typescript flag! thank you :) |
Do you have a plan to support firebase v9 modular?
https://firebase.google.com/docs/web/modular-upgrade
I can contribute for using v9
The text was updated successfully, but these errors were encountered: