react-native-share-menu
react-native-share-menu copied to clipboard
How can disable share View iOS
I'm using this lib for receive sharing intent. I don't need custom or default share view on iOS how can i disable share View entirely?
Thanks in advance
Did you figure out how to do it? I tried meddling with ShareViewController
, and was able to remove share view, but the app from which I was sharing kept freezing
I was able to do it
- I changed
SLComposeServiceViewController
toUIViewController
in ShareViewController.swift - Remove
isContentValid
,didSelectPost
,configurationItems
functions, and callhandlePost
inviewDidLoad
- Add
viewDidAppear
withcompleteRequest
, this ensures app from which we share won't freeze
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
completeRequest()
}
- In
Info.plist
of your Share Extension, changeNSExtensionMainStoryboard
toNSExtensionPrincipalClass
, and set value to$(PRODUCT_MODULE_NAME).ShareViewController
. Also you can removeMainInterface
if you want
@Tauka thanks for this! The custom view is indeed gone.
Though the original app (say Photos) still freezes with a semi transparent grey overlay on top of it. Where shall I add viewDidAppear
to?
I have added
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
completeRequest()
}
to ShareViewController.swift
. Is this correct? Thanks!
I figure out that, if I am in the page of an image and share from there, Photos app won't stuck. However if I am in the grid view, long press an image then share, this view will stuck.
Thanks @Tauka for the solution for disabling share pop up!
Those who are having trouble to add handlePost
into viewDidLoad
can use it like this
guard let items = self.extensionContext?.inputItems as? [NSExtensionItem] else {
print("Error: \(COULD_NOT_FIND_ITEMS_ERROR)")
return
}
handlePost(items)