Hello!
I am using (and this works fine) an ImagePicker component to make a photo with a camera, and then send it to a server.
I send it with
formData.append('pic', { uri: imagePickerResult.uri });
where imagePickerResult looks e.g. like this:
Object {
"cancelled": false, "type": "image",
"height": 960,"width": 1280,
"uri": "file:///data/user/0/host.exp.exponent/cache/ExperienceData/ImagePicker/5df50fe9.jpg",
}
And yes, it works. But… for the purposes of testing, I’m a bit tired of really making the photos. It’s only a part of the whole process which needs to be done to complete the tests.
So I thought that I will just simulate it. I added a few random photos into assets/images/simulating
And… now what? I tried to find something, but failed. I guess I should probably use FileSystem to copy the asset file to somewhere else (like FileSystem.cacheDirectory
), right? Or maybe… I can use a path to the image in the assets directory directly?
But… the Asset.fromModule(require('../assets/images/simulating/image-1.jpg')).uri;
returns a … remove url. I just don’t really get these things
I just want to fake the above imagePickerResult
, but with real file, so the upload can actually work.
SDK : 34.0.4 , platforms: all