Open tdammy92 opened 1 year ago
@tdammy92 I think it's more syntax error instead of package issue... you are trying to read res while res do no exist in the scope you are reading in....
either try... const res = await RNHeicConverter.conver()
inside an async function
or process res inside the promise response scope
RNHeicConverter.convert({path: res?.sourceURL})
.then((res: any) => {
console.log(res)}
if (res) {
const file = {
uri:
Platform.OS === 'android'
? res?.path
: res?.sourceURL,
type: res?.mime,
name:
Platform.OS === 'android' ? Date.now().toString() : res?.filename,
};
)
.catch((err: any) => console.log(err));
@noumantahir, Pls ignore the if block.
Using this.
RNHeicConverter.convert({path: res?.sourceURL})
.then((res: any) => console.log(res))
.catch((err: any) => console.log(err));
or
const selectedImage = async(item)=>{
try{
const convertedImage = await RNHeicConverter.convert({path: item?.sourceURL}) ;
console.log(convertedImage)
} catch(error) {
console.log(error)
}
}
I get the same error.
Platform.OS === 'android'
Are u use Android? Which OS are we talking about?
@maxim-kolesnikov @noumantahir
am using a camera roll, when a user clicks on any of the image i get the below object
{
timestamp: 1522437259.365,
type: "image",
group_name: "All Photos",
location: {
altitude: 4.583391486392184,
longitude: -122.50956666666667,
latitude: 37.76007833333333,
heading: 0,
speed: 0.5513811087502415
},
image: {
uri: "ph://CC95F08C-88C3-4012-9D6D-64A413D254B3/L0/001",
extension: "heic",
filename: "IMG_0111.HEIC",
width: 4032,
fileSize: 2808983,
playableDuration: null,
height: 3024
}
}
const sendPhoto = async (item: any) => {
if (item) {
if (Platform.OS === 'ios') {
RNHeicConverter.convert({path: item?.image?.uri})
.then((res: any) => console.log('res from converter', res))
.catch((err: any) => console.log('error from converter', err));
}
}
Platform.OS === 'android'
Are u use Android? Which OS are we talking about?
Building for both OS. but currently testing for IOS.
Getting the same error on iOS...
Am trying to convert an HEIC file from two places.
From @react-native-cameraRoll and from react-native-image-crop-picker
Used RNHeicConverter.convert() am not getting any result neither am i getting a response.
` const sendFile = async () => {
}; `
Please i need help 🙏🏽