react-native-tips's Introduction
react-native-tips's People
Forkers
chelseazhai thanzero thunderbird7 kobbiman rubythonode phpsmarter py389172739 kafkaforks furkancelik pages-alex-alex2006hw sivapictuscode evrimulgen mate38 onewoorks l3th2nh zhocean123 naviocean jatin-codes adhinta shindigira sugaith mohaaosman sunnyjake maaveran sravindravmd kdastan asalem1 dovandu malina react-native-common isapoetra carloswalterbr xchinjo s0lus davidleee nnnnnoel christinamcqueen androconsis fidato818 palfonsoag lraniel hankkuu-mobile muhwezideo jsflor leductien95 rnproj xclidongboreact-native-tips's Issues
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) + "%"; }
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
React Native Example
Hi! Just uploaded a sample repo here https://github.com/mgscreativa/React-Native-Upload-Files-to-Meteor-Server
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?
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 ?
Get file URI like pdf or doc
In the description you use photo/image as an example, but if the file is pdf or doc how can I get the URI?
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 ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.