-
Notifications
You must be signed in to change notification settings - Fork 463
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
RFC: react native file upload support #3535
Comments
This is more of a documentation task to be honest. For example, to make streamed responses work on React Native some polyfills are needed to replace some broken/missing functionality in In fact, with the latter providing So, all in all, all we can do is support the web platform and lean either on React Native aligning closer with web standards or lean on polyfills. Hence, it's more a matter of collecting research then creating documentation. |
Interestingly, using I get this error when I try to use the recommended
Side note: The Also, thank you for all the work you do in maintaining this package. |
Quickly checking out the differences between
Would you mind checking whether your |
If I had to guess, this rather sounds like the import order is an issue here. We do some feature detection in |
Thank you very much for your assistance. Based on @JoviDeCroock's suggestion, I added a interface ReactNativeFileOptions {
uri: string;
name: string;
type: string;
}
export class ReactNativeFile {
public uri: string;
public name: string;
public type: string;
constructor({ uri, name, type }: ReactNativeFileOptions) {
this.uri = uri;
this.name = name;
this.type = type;
}
toJSON() {
return { uri: this.uri, name: this.name, type: this.type };
}
} The error message looked exactly the same:
As for @kitten's suggestion, do you have a recommended way of testing the race condition, or an easy way to hardcode the polyfill within my app, so it loads before the mutation? Thanks again! |
That makes sense though, if you wrap the File datatype in a new class then we can't infer that it's a file, because it's neither a File nor Blob - to fix that add |
Yeah, we might need to add a block about only |
Same problem here. @koredefashokun and @JoviDeCroock 's discussion thread SAVED me. I just noticed this issue is still on hold, why? Isn't file uploading a very basic use case? |
P.s : I tried to fetch the image blob but it upload the file with 0kb
Summary
Suggesting the addition of file upload support within urql mutations, particularly focusing on compatibility with the Expo platform. By implementing this feature, developers using urql will have the ability to seamlessly handle file uploads in their GraphQL mutations, enhancing the platform's versatility and accommodating diverse application requirements.
Proposed Solution
To address this need, it's recommended to extend urql's mutation capabilities to facilitate file uploads, with special consideration for Expo compatibility. This could involve integrating Expo's file handling APIs or leveraging compatible JavaScript libraries tailored for React Native environments. The implementation should prioritize simplicity and clarity, ensuring that developers can easily incorporate file upload functionality into their urql mutations. Additionally, comprehensive documentation and practical examples will be essential to assist developers in effectively utilizing this feature.
Requirements
The text was updated successfully, but these errors were encountered: