Comments (18)
Ah interesting you're handling it with a model like that...
But ANYWAY, the latest version only works on iOS and I just pushed a fix for the bug you're seeing. That's because you're not passing an object (even an empty object) in to the constructor of Firestack. Try it again with the latest master branch, if you would.
from react-native-firestack.
@auser Hi thanks for the response! The previous problem has been resolved but there is a new one.
from react-native-firestack.
Ah! The docs need to be updated. If you pass a storageBucket
in the config of the Firestack()
constructor, this happens automatically. I can update it to pass the setStorageUrl()
on the firestack object.
Right now it's exposed through a different "object" and you can call setStorageUrl()
like this:
firestack.storage.setStorageUrl()`
Do you think it makes sense to expose the setStorageUrl()
function through on firestack
as well?
from react-native-firestack.
Hi, thank you for the clarification. I figured that all functions related to storage should have a .storage
preceedingly (ie uploadFile). I think it makes sense to have setStorageUrl()
inside storage
, since there is already the firestack constructor to take in the storage URL.
Right now when i try to pass the storage Url to firestack.storage.setStorageUrl()
it keeps throwing this error something weird happened
, but it works fine if I pass the config to the constructor instead.
Nevertheless, the uploadFile function throws an err
There was an error uploading the file, {} Cannot read property 'call' of undefined TypeError: Cannot read property 'call' of undefined
My storage permission has been set to public, and I'm fetching the image path by using the module react-native-image-picker
with showImagePicker()
function.
Any idea on this?
from react-native-firestack.
Ah... I don't think that is your error. Actually, this is a bug in the Firestack.Storage
iOS class.
Give me a few minutes to update the class.
from react-native-firestack.
Okay, can you try now from the master
branch?
You can call setStorageUrl()
or pass the storageBucket in the configuration and it should just work.
from react-native-firestack.
Hi,
firestack.storage.setStorageUrl(someUrl).then(()=>{})
doesn't seem to work (keep throwing this error cannot read property then of undefined
. I check the source code and see it no longer returns prosimify (..) and the way I did was i removed all the then
in all storage
functions so it doesnt throw an error on start up. Without the then(function)
, the simulator runs without any error but the uploading doesn't seem to work (ie file is not uploaded onto firebase storage)
Just in case May I double check if firestack does upload image from path? According to this, react native doesn't support file or blob types, so uploading images might not be straightforward yet.
from react-native-firestack.
Yep, I just tested it here... want to try one more time? (I just pushed one more update)
Also, if you're interested, I'm in the gutter room https://gitter.im/fullstackreact/react-native-firestack
from react-native-firestack.
may I see your example please?
from react-native-firestack.
Of course.
// The takePicture function
takePicture() {
this.camera.capture()
.then(({path}) => {
const filename = 'photo.jpg'
firestack.uploadFile(`photos/${filename}`, path, {
contentType: 'image/jpeg',
contentEncoding: 'base64',
})
.then((res) => {
console.log('result from upload file: ', res);
})
.catch((err) => {
console.log('error happened with uploadFile', err);
})
})
.catch(err => console.error(err));
}
and the render view
<Camera
ref={(cam) => {
this.camera = cam;
}}
captureTarget={Camera.constants.CaptureTarget.temp}
style={styles.preview}
aspect={Camera.constants.Aspect.fill}>
<Text style={styles.capture} onPress={this.takePicture.bind(this)}>[CAPTURE]</Text>
</Camera>
from react-native-firestack.
Thank you! I will try again later and tell you the result.
from react-native-firestack.
Great. I also updated the README with the example.
from react-native-firestack.
Hi, I try the example and it throws
ExceptionsManager.js:76 Exception '*** setObjectForKey: key cannot be nil' was thrown while invoking uploadFile on target FirestackStorage with params ( "gs://someURL", "photos/${filename}", "/Users/G/Library/Developer/CoreSimulator/Devices/6AF0B403-BEAE-43B0-8B6B-A369B4384691/data/Containers/Data/Application/C8FB519B-4C67-4685-BB91-CD9DCE8DCE36/tmp/194308E8-4B18-4CD1-98FB-A8B6C3B5D8EE-32599-0003BFB508C9085F.jpg", { contentEncoding = base64; contentType = "image/jpeg"; }, 39 )
I think it's the issue with facebook fetching function.
from react-native-firestack.
Hm... did your file get uploaded? Do you see anything in the Xcode console?
I'm in the gittr room if you want more real-time discussion.
from react-native-firestack.
Hi, I'm in the middle of an lecture now so I'm afraid I can't talk rn.
The file didn't get uploaded but I will try rm rf, re-install the module and get back to you with the results later when i get home. Thank you for the help!
from react-native-firestack.
(Ah, well... gittr is a text-based chat room if you change your mind). I'm working on the Java side right now anyway... Perhaps you can gist me the Xcode logs stack, when you get a chance. I'd love to see what we can figure out.
from react-native-firestack.
Yup I will create a gist of Xcode logs if the problem still persists after re-installing.
from react-native-firestack.
@auser Hi, thank you very much for your help. I believe it's my silly mistake to not config firebase properly (ie adding firebase to the project). Please mark the issue as resolved.
With that said, this is such an awesome module! Can't wait to try it on android when full support comes out.
from react-native-firestack.
Related Issues (20)
- After installation, React/RCTBundleURLProvider.h file is no longer found
- How to delete file from storage? HOT 1
- Why is FirestackCloudMessaging module commented? HOT 1
- Authentication: Is there a method linkWithCredential HOT 2
- Android Verifier rejected due to bad method HOT 1
- avoid dependency conflict between play-services and firebase HOT 2
- Is the project stable & maintained for production use ? HOT 4
- Push Notifications - Here yet? HOT 1
- Docs: "Android requires the Google Play services to installed for authentication to function."
- setUserProperty implemented? HOT 2
- firestack storage not respond anything HOT 1
- Failed to upload file An unknown error occurred, please check the HTTP...
- signInWithCustomToken not running on android....Pls help
- Build error after linking firestack
- I am making a android chat app .Please give the solution
- Error:Execution failed for task ':app:transformClassesWithDexForDebug'. Give the Solution
- Getting the error βError:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. β when attempting to execute the project
- Native module cannot be null. HOT 1
- FirestackMessagingService.java:29: error: no suitable method found for putExtra(String,RemoteMessage)
- firebase
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-firestack.