react-native-ios-context-menu icon indicating copy to clipboard operation
react-native-ios-context-menu copied to clipboard

Add ability to show a new view when Preview.ContextMenuInteractionCommitStyle is "pop"

Open j-braun0384 opened this issue 3 years ago • 4 comments

It would be so cool if we can nicely transition to a new view/screen when we pop the preview after pressing it - a very commonly used tactic in many mainstream apps (twitter, instagram etc.).

Looking at this article: https://kylebashour.com/posts/context-menu-guide - seems the way to go is to tap into the animator.addCompletion instance method from the contextMenuInteraction func like so:

func contextMenuInteraction(_ interaction: UIContextMenuInteraction, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) {
    animator.addCompletion {
       // HERE WE DEFINE THE LOGIC TO SHOW A PASSED IN VIEW?
        if let viewController = animator.previewViewController {
            self.show(viewController, sender: self)
        }
    }
}

We should be able to house this logic within RNIContextMenuView.swift

...thoughts?

j-braun0384 avatar Apr 18 '22 02:04 j-braun0384

To clarify: one example of this is Twitter. If you long press a tweet, and then click into it, it'll nicely transition into the next tweet screen. This would be a cool feature.

nandorojo avatar Oct 16 '23 16:10 nandorojo

@nandorojo this feature would be one of those "bridge closing" efforts towards fully native feeling apps in RN. Any idea if this is in the works or being considered?

klosmo avatar Dec 25 '23 07:12 klosmo

It would be cool, might need to be on the RN screens side though. Honestly don't know what it would take.

nandorojo avatar Dec 25 '23 12:12 nandorojo