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

ReactNative upload file #302

Closed
6youss opened this issue Nov 12, 2021 · 4 comments
Closed

ReactNative upload file #302

6youss opened this issue Nov 12, 2021 · 4 comments

Comments

@6youss
Copy link

6youss commented Nov 12, 2021

I see that the docs mention Upload in Browser and Node.

Does graphql-request support uploading files in react-native ?

@6youss
Copy link
Author

6youss commented Nov 12, 2021

i just figured it out, yes it supports it and it goes like this :

import { ReactNativeFile } from 'extract-files';

const mutation = gql`
  mutation uploadFile($file: Upload) {
    uploadFile(file: $file)
  }
`;

graphQLClient.request(mutation, {
      file: new ReactNativeFile({ uri, type, name }),
});

@zdnk
Copy link

zdnk commented Apr 3, 2023

This does not seem to work for me

@jasonkuhrt
Copy link
Member

#500

@zdnk
Copy link

zdnk commented Apr 5, 2023

I see, we had to switch to apollo due to this :(

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

No branches or pull requests

3 participants