react-native-firebase
react-native-firebase copied to clipboard
🔥🔥 [🐛] Storage image upload progress not updating correctly on IOS
Issue
Hello, I am trying to get a progress of an image upload to storage but the only updates i get are 0% and 100% here is the code i am using
const reference = firebase.app().storage('storage_bucket_id').ref('unique_reference.png');
const uploadTask = reference.putFile(imageUrl);
const unsubscribe = uploadTask.on('state_changed', snapshot => {
console.log('snapshot : ', snapshot);
const progress = Math.round(snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log('progress : ', progress + ' %');
setImageProgress(progress);
});
Describe your issue here
like i mentioned on that console log i am only getting 0% and 100%, here is a screenshot of the console.log as you can see i am only getting an update at the 120 mark and the full file size mark

Project Files
Javascript
Click To Expand
package.json:
```
"@react-native-firebase/analytics": "^14.7.0", "@react-native-firebase/app": "^14.5.1", "@react-native-firebase/auth": "^14.5.1", "@react-native-firebase/crashlytics": "^14.7.0", "@react-native-firebase/firestore": "^14.5.1", "@react-native-firebase/messaging": "^14.7.0", "@react-native-firebase/remote-config": "^14.9.1", "@react-native-firebase/storage": "^14.7.0",
```json
# N/A
firebase.json for react-native-firebase v6:
# N/A
iOS
Click To Expand
ios/Podfile:
- [ ] I'm not using Pods
- [x] I'm using Pods and my Podfile looks like:
# N/A
AppDelegate.m:
// N/A
Android
Click To Expand
Have you converted to AndroidX?
- [ ] my application is an AndroidX application?
- [ ] I am using
android/gradle.settingsjetifier=truefor Android compatibility? - [ ] I am using the NPM package
jetifierfor react-native compatibility?
android/build.gradle:
// N/A
android/app/build.gradle:
// N/A
android/settings.gradle:
// N/A
MainApplication.java:
// N/A
AndroidManifest.xml:
<!-- N/A -->
Environment
Click To Expand
react-native info output:
System:
OS: macOS 12.0.1
CPU: (8) x64 Apple M1
Memory: 44.73 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 8.3.1 - /usr/local/bin/npm
Watchman: 2022.01.31.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 28, 29, 30, 31
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3
System Images: android-29 | ARM 64 v8a, android-29 | Google Play ARM 64 v8a, android-30 | Google APIs Intel x86 Atom, android-S | Google APIs ARM 64 v8a, android-S | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8092744
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
Languages:
Java: 11.0.13 - /Library/Java/JavaVirtualMachines/jdk-11.0.13.jdk/Contents/Home/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.2 => 0.67.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
- Platform that you're experiencing the issue on:
- [x] iOS
- [ ] Android
- [ ] iOS but have not tested behavior on Android
- [ ] Android but have not tested behavior on iOS
- [ ] Both
react-native-firebaseversion you're using that has this issue:-
"@react-native-firebase/analytics": "^14.7.0", "@react-native-firebase/app": "^14.5.1", "@react-native-firebase/auth": "^14.5.1", "@react-native-firebase/crashlytics": "^14.7.0", "@react-native-firebase/firestore": "^14.5.1", "@react-native-firebase/messaging": "^14.7.0", "@react-native-firebase/remote-config": "^14.9.1", "@react-native-firebase/storage": "^14.7.0",
- **`Firebase` module(s) you're using that has the issue:**
- `e.g. Instance ID`
- **Are you using `TypeScript`?**
- `YES` & `Version 4.4.4`
</p>
</details>
<!-- Thanks for reading this far down ❤️ -->
<!-- High quality, detailed issues are much easier to triage for maintainers -->
<!-- For bonus points, if you put a 🔥 (:fire:) emojii at the start of the issue title we'll know -->
<!-- that you took the time to fill this out correctly, or, at least read this far -->
---
- 👉 Check out [`React Native Firebase`](https://twitter.com/rnfirebase) and [`Invertase`](https://twitter.com/invertaseio) on Twitter for updates on the library.
Hi there! Definitely do not mix and match versions:
"@react-native-firebase/analytics": "^14.7.0",
"@react-native-firebase/app": "^14.5.1",
"@react-native-firebase/auth": "^14.5.1",
"@react-native-firebase/crashlytics": "^14.7.0",
"@react-native-firebase/firestore": "^14.5.1",
"@react-native-firebase/messaging": "^14.7.0",
"@react-native-firebase/remote-config": "^14.9.1",
"@react-native-firebase/storage": "^14.7.0",
update to current, and make sure they are the same - https://invertase.io/blog/react-native-firebase-versioning - I understand by the magic of semantic versioning and your use of the '^' that you should actually resolve all to the same version, but still, dangerous practice
That said, I don't think that will have an effect here. I think progress is not implemented in android at least.
You don't specify your execution / reproduction environment so I'm not sure if this is happening on all platforms or just one. It's difficult to read your images, it would be better if they were text and specified size units, I guess those are bytes?
I suspect it might just be that progress is not emitted that rapidly, and in this case the file is transferred quickly enough (is it just 33 kilobytes?) that progress is not reported before upload is complete. Have you tried this with really large files?
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.