Open climsaroj opened 1 year ago
My qpplication works perfectly for the first time but then the second time, It's just don't work at all. I have to re-load application and then this function will continued work for file that I shared from the second time.
Here is my code:
getData = () => { var result; ReceiveSharingIntent.getReceivedFiles((data) => { console.log("InreceivedFile"); console.log(data); var path = "file://" + data[0].filePath; if (Platform.OS === "android") { result = { uri: data[0].contentUri, type: data[0].mimeType, name: data[0].fileName, fileCopyUri: path, }; } else { var mimeTrans; if (data[0].mimeType === ".pdf") { mimeTrans = "application/pdf"; } else if (data[0].mimeType === ".xml") { mimeTrans = "text/xml"; } else if (data[0].mimeType === ".json") { mimeTrans = "application/json"; } result = { uri: data[0].filePath, type: mimeTrans, name: data[0].fileName, fileCopyUri: data[0].filePath, }; } this.uploadVerify(result); }, (err) => { console.log(err); }, "ShareMedia" ); };
componentDidMount() { SplashScreen.hide(); this.getData(); } componentDidFocus = () => { this.getData(); } componentWillUnmount() { ReceiveSharingIntent.clearReceivedFiles(); }
I've used class based which is not the same as the example. If anyone has encountered this problem, please help.
Thanks.
I had a same issue with receiving intent properly something like this. After a long research, I cheated something to solve it. I know this is not a best solution to your problem but I disabled the back button in the app and it looks fine now.
ReceiveSharingIntent.getReceivedFiles( (fileList) => { ................................ ................................ const backHandler = BackHandler.addEventListener('hardwareBackPress', () => true) return () => backHandler.remove(); <========= adding this (error) => { console.log('error', error); }); }
remove it ReceiveSharingIntent.clearReceivedFiles();
remove it ReceiveSharingIntent.clearReceivedFiles();
I had the same issue and it solved my problem, @MiteshKalal7 Thank you very much
My qpplication works perfectly for the first time but then the second time, It's just don't work at all. I have to re-load application and then this function will continued work for file that I shared from the second time.
Here is my code:
I've used class based which is not the same as the example. If anyone has encountered this problem, please help.
Thanks.