Closed Randall71 closed 9 months ago
good idea, but during my test i got a compilation error on yarn android
/Users/anselme/project/expo-share-intent-demo/node_modules/react-native-receive-sharing-intent/android/src/main/java/com/reactnativereceivesharingintent/ReceiveSharingIntentHelper.java:109: error: no suitable method found for reject(no arguments)
promise.reject();
@achorein fixed, all is good now 🎉
I'm wondering how to handle the state "no share intent detected",
When you simply run the app without sharing anything, the hook call ReceiveSharingIntent?.getReceivedFiles()
which doesn't have any data. with this new code we got an error to handle :
useShareIntent[mount] error [Error: Type is null]
IMHO, empty data doesn't mean an error, in that case we should resolve the promise with an empty data ([]
) and update the useShareIntent
hook, something like that :
ReceiveSharingIntent?.getReceivedFiles(
(data) => {
if (!data || data.length === 0) {
console.log("useShareIntent[mount] no share intent detected");
return;
}
}
)
@Randall71 just updated the patch here https://github.com/achorein/expo-share-intent-demo/commit/3b684159575e3a8c115053089839f3f8a52933d6, but cannot update your branch.
Working find on android, i'm looking to update the ios side now
continued in #34
When using actual patch, on Android i get a lot of warning due to promise not handle correctly inside
react-native-action-receive-sharing-intent
.I updated it to handle promise correctly and structure a little.