Skip to content
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

Add support for React Native #131

Closed
wants to merge 1 commit into from
Closed

Add support for React Native #131

wants to merge 1 commit into from

Conversation

arturi
Copy link
Contributor

@arturi arturi commented Nov 15, 2018

This PR adds support for React Native environment (both Expo and regular React Native).

When in React Native environment, and a file object with a uri property is passed to tus.Upload, instead of a Blob that tus normally expects, we first fetch the blob from a local uri using XMLHttpRequest.

Hopefully fixes #96.

This is a draft PR, I realize things might need to be moved around or maybe reworked entirely. But it seems to be working fine locally for me, when passing tus.Upload({ url: 'file://...' }).

if (isReactNative &&
typeof file === 'object' &&
file !== null) {
console.log('IT’S FUCKING WORKING!!!!!!')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets keep this 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been rapidly learning how to undo this for the past 30 minutes.

@arturi arturi closed this Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does this work with React Native
2 participants