Coder Social home page Coder Social logo

react-native-tips's People

Contributors

g6ling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-tips's Issues

opts is not defined

Hi
is this correct? where does opts come from?

const photos = [photo1, photo2, ...]
photos.forEach((photo) => {
    data.append('photo', {
    uri: photo.uri,
    type: 'image/jpeg', // or photo.type
    name: photos.name
  });  
});
fetch(url, opts);

should it be data?
thanks

exif is removed with ios

i use this exact same code

const data = new FormData(); data.append('name', 'testName'); // you can append anyone. data.append('photo', { uri: photo.uri, type: 'image/jpeg', // or photo.type name: 'testPhotoName' }); fetch(url, { method: 'post', body: data }).then(res => { console.log(res) });

it work on ios and Android
But i have problem with the exif /metadata part. on Android the uploaded picture contain the exif but not on IOS.

is some one getting this error ?

Use same format in Typescript

Hi, I was wondering how to to the same thing in typescript. I get an error with this line:

data.append('photo', {
  uri: photo.uri,
  type: 'image/jpeg', 
  name: 'testPhotoName'
});

Because of a type mismatch:

Argument of type '{ uri: string; name: string; type: string; }' is not assignable to parameter of type 'string | Blob'.
  Object literal may only specify known properties, and 'uri' does not exist in type 'string | Blob'.

The documentation of FormData.append looks nothing like the code described above. Does anybody have an idea how to solve this?

not able to upload image React native

I tried uploading the image to the PHP server but it's not working although I was able to upload normal String but getting the issue in image uploading
need help

Progress is always 1

implemented the same

if (evt.lengthComputable) { progressFun((evt.loaded / evt.total) * 100); const progress = (evt.loaded / evt.total) * 100; console.log('progress123', progress, evt.loaded, evt.total); //percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + "%"; }

futch doesn't work as fetch

After succesfully trying configuring fetch to upload images on android/ios/web, I wanted to test futch,

However, it does not work, this is how my code looks like, I just replace fetch, with futch:

const res = await futch(url, requestOptions);
alert(res.status);

alert will display {"isTrusted":true}, I expected 200.

I have tried to add withCredentials = true to support CORS, but that didn't help.

This is futch.js:

const futch = (url, options = {}, onProgress) => new Promise((res, rej) => {
  const xhr = new XMLHttpRequest();
  xhr.withCredentials = true;
  xhr.open(options.method || 'get', url);
  for (const k in options.headers||{})
    xhr.setRequestHeader(k, options.headers[k]);
  // Object.keys(opts.headers || {}).forEach((key) => {
  //   xhr.setRequestHeader(key, opts.headers[key]);
  // });
  xhr.onload = (e) => res(e.target);
  xhr.onerror = rej;
  if (xhr.upload && onProgress) {
    xhr.upload.onprogress = onProgress;
  }
  xhr.send(options.body);
});
export default futch;
  • Any idea why?
  • How can I get the progress in React native ?

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.