react-native-photo-editor icon indicating copy to clipboard operation
react-native-photo-editor copied to clipboard

What should the path to the local file look like?

Open vrchvngel opened this issue 3 years ago • 4 comments

Hi, what should the path to the local file look like? It just works with web URL. I've tried:

const result = await PhotoEditor.open({ path: './assets/logo.png' });

and

const result = await PhotoEditor.open({ path: require('./assets/logo.png') });

and it doesn't work.

vrchvngel avatar Feb 06 '22 23:02 vrchvngel

I have same problem, don't know what happenned

khanh21011999 avatar Apr 16 '22 18:04 khanh21011999

I have the same issue, did you found the solution ?

rsnda avatar Jun 10 '22 12:06 rsnda

As far I had tested, it should be an absolute path of the form of "file://...", for both platforms as well. So you should use a library able to open files from the phone filesystem.

It seems like this library is designed to work well with other libraries for reading files or opening files from photo gallery or with the camera, but I don't know if they think of the use case of bringing a file of a form of './assets/...' and other similar cases.

bastiantowers avatar Jun 21 '22 16:06 bastiantowers

you need to add image picker first and then you can use it like that

try { ImageCropPicker.openPicker(gStyles.imgPicker).then(image => { PhotoEditor.open({ path: image.path, stickers: [ 'https://cdn-icons-png.flaticon.com/512/5272/5272912.png', 'https://cdn-icons-png.flaticon.com/512/5272/5272913.png', 'https://cdn-icons-png.flaticon.com/512/5272/5272916.png', ], }).then(result => { console.log('result', result); setFile({path: result}) }); }); } catch (error) {}

ItxAltaf avatar Jan 26 '24 12:01 ItxAltaf