socketio-file-upload icon indicating copy to clipboard operation
socketio-file-upload copied to clipboard

This package is good for React Native ?

Open thanhhuy12th opened this issue 7 years ago • 5 comments

Hi,

I'm working with Node js (Server) and React Native (client), this package is good for React Native?

thanhhuy12th avatar Mar 24 '18 02:03 thanhhuy12th

I have not tried this with React Native. As long as React Native is compatible with the ECMAScript standard, particularly the part regarding FileList and FileReader, then this package should work fine.

Do you mind updating us on your progress if you decide to implement it? :smile:

sffc avatar Mar 27 '18 07:03 sffc

@sffc It seems like this package does not work with react-native since you've used document which is not defined in the React-Native world:

ReferenceError: Can't find variable: document _dispatch _baseFileSelectCallback

PatrissolJuns avatar Feb 07 '21 07:02 PatrissolJuns

This package only uses document when dealing with events, such as document.createEvent. This was written before CustomEvent was standardized; I imagine React Native probably supports CustomEvent but not document.createEvent.

I'm happy to review a PR migrating document.createEvent to CustomEvent. CustomEvent is available on 98% of browsers.

sffc avatar Feb 07 '21 07:02 sffc

@sffc So finally what do you say about react-native compatibility? Because I've tried it but I got this error while trying to upload through submitFiles:

ReferenceError: Can't find variable: document _dispatch _baseFileSelectCallback

PatrissolJuns avatar Feb 07 '21 10:02 PatrissolJuns

According to your error message, it seems this module doesn't support React Native. I'm happy to review a PR migrating from document.createEvent to CustomEvent if that fixes the compatibility issue.

sffc avatar Feb 08 '21 19:02 sffc