Closed jayeshgurudayalani closed 4 years ago
I believe the issue is with file: {data:item}
as for a reference, please check how it works with RN code sample https://github.com/ConnectyCube/connectycube-reactnative-samples/blob/master/RNChat/src/screens/main/chat/index.js#L107
Hi, @jayeshgurudayalani
Also you set incorrect mime_type cause file:///storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20200623-WA0003.jpg
is JPG but you have set type as 'image/png'
.
Try to use localPath to get file object or use any React Native library to pick files, files from gallery or from camera
Thank you all of you for quick response . I have solve issue and issue was with file: {data:item}
I need to provide them object like this file: {uri: item, name: name, type: type},
"react": "16.9.0", "react-native": "0.61.5", "react-native-connectycube": "^3.2.0",
i have tried to implement CPI(Custom Identity Provider) which is working fine but facing issue in upload image.I have tried to upload image as mentioned in this link under title "Attachments (photo / video)"
https://developers.connectycube.com/js/messaging
here is mycode to upload image
const fileParams = { file: {data:item}, name: ImageUpload.getRendomString() + '.png', type: 'image/png', size: stats.size, public:true };
ConnectyCube .storage .createAndUpload(fileParams) .then(result => { console.log("image uploaded") }) .catch(error => { console.log('error in uploading image on connectycube'); }); })
but it is throwing error as mentioned below
Possible Unhandled Promise Rejection (id: 6): TypeError: undefined is not an object (evaluating 'response.url') processAjaxError@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:348983:21 http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:348961:36 tryCallOne@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27027:16 http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27128:27 _callTimer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:30582:17 _callImmediatesPass@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:30618:19 callImmediates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:30837:33 callImmediates@[native code] __callImmediates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2625:35 http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2402:34 __guard@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2608:15 flushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2401:21 flushedQueue@[native code] callFunctionReturnFlushedQueue@[native code]
here item is an image local url file:///storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20200623-WA0003.jpg" Let me know if there is any mistake in code .. i have tried from my side and not able to solve issue Note :- I have not purchased any plan for connectycube