react-native-share-menu
react-native-share-menu copied to clipboard
ios shareData.data is an array rather than object
Hi, on ios I get {data:[{data:..., mimeType:...}]} rather than {data:..., mimeType:...} like on android.
my extension info.plist contains:
I tried different ways to write NSExtensionActivationRule, but I always get an array. Is it normal? none doc, exemple and issues here don't seem talk about that.
nobody has this problem? I'm surprised to be the only one. Same problem on example provided in this repository
I'm also seeing this issue. The typing is incorrect for ShareMenuReactView. It's currently typed as follows:
interface ShareMenuReactView {
dismissExtension(error?: string): void;
openApp(): void;
continueInApp(extraData?: object): void;
data(): Promise<{mimeType: string, data: string}>;
}
But what the data call returns corresponds to this:
data(): Promise<{ data: [{ data: string; mimeType: string }] }>;
A simple (though not pretty) workaround is to just cast to the right type:
ShareMenuReactView.data()
.then(({ data: shareData }) => {
// Typing is wrong on data argument - cast to workaround
const [{ data, mimeType }] = shareData as unknown as ShareData;
});
type ShareData = [{ data: string; mimeType: string }];
Facing the same issue
nobody has this problem? I'm surprised to be the only one. Same problem on example provided in this repository
I have the same problem. Just code a workaround: check and to convert array to object. Will wait till proper solution.