Giter Site home page Giter Site logo

Comments (18)

auser avatar auser commented on May 17, 2024

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.

heiseish avatar heiseish commented on May 17, 2024

@auser Hi thanks for the response! The previous problem has been resolved but there is a new one.
screen shot 2016-08-28 at 5 49 57 pm

from react-native-firestack.

auser avatar auser commented on May 17, 2024

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.

heiseish avatar heiseish commented on May 17, 2024

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.

auser avatar auser commented on May 17, 2024

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.

auser avatar auser commented on May 17, 2024

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.

heiseish avatar heiseish commented on May 17, 2024

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.

auser avatar auser commented on May 17, 2024

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.

heiseish avatar heiseish commented on May 17, 2024

may I see your example please?

from react-native-firestack.

auser avatar auser commented on May 17, 2024

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.

heiseish avatar heiseish commented on May 17, 2024

Thank you! I will try again later and tell you the result.

from react-native-firestack.

auser avatar auser commented on May 17, 2024

Great. I also updated the README with the example.

from react-native-firestack.

heiseish avatar heiseish commented on May 17, 2024

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.

auser avatar auser commented on May 17, 2024

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.

heiseish avatar heiseish commented on May 17, 2024

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.

auser avatar auser commented on May 17, 2024

(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.

heiseish avatar heiseish commented on May 17, 2024

Yup I will create a gist of Xcode logs if the problem still persists after re-installing.

from react-native-firestack.

heiseish avatar heiseish commented on May 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.