Closed pierroo closed 7 months ago
Hello @pierroo, can you provide me a sample code about how you use the library?
Of course @JimmyDaddy , here it is:
viewShotRefs?.current
.capture()
.then(async uri => {
console.log('view shot: ', uri);
ImageMarker.markText({
src: uri, // file://
text: 'blablabla'
}`,
scale: 1,
quality: 100,
saveFormat: 'base64',
position: 'bottomRight',
color: '#ffffff',
fontSize: 36,
shadowStyle: {
dx: 1,
dy: 1,
radius: 10,
color: '#000000',
},
})
.then(res => {
goShare(res);
})
.catch(err => {
console.log('error marking img: ', err);
});
})
.catch(e => {
console.log('could not capture full canvas: ', e);
});
@pierroo the API has been changed in v1.x.x, you should modify you code like below
viewShotRefs?.current
.capture()
.then(async (uri) => {
console.log('view shot: ', uri);
try {
const markRes = await ImageMarker.markText({
backgroundImage: {
src: uri,
scale: 1,
},
watermarkTexts: [
{
text: 'blablabla',
position: {
position: Position.bottomRight,
},
style: {
color: '#ffffff',
fontSize: 36,
shadowStyle: {
dx: 1,
dy: 1,
radius: 10,
color: '#000000',
},
},
},
],
scale: 1,
quality: 100,
saveFormat: ImageFormat.base64,
});
goShare(markRes);
} catch (err) {
console.log('error marking img: ', err);
}
})
.catch((e) => {
console.log('could not capture full canvas: ', e);
});
Describe the bug I recently upgraded RN to 0.73, so I had to upgrade this library to 1.2.6 But since then, markText with src image no longer works
I now get the error "please set image!" when the image is indeed set.
Devlopment environment(please complete the following information):
Smartphone (please complete the following information):
Additional context Important to note: the image is coming from a viewshot capture, but still, that local file path used to work in previous versions.
EDIT: actually even with a local image using require('pathToImage') I still get the same error :/