naoufal / react-native-safari-view

A React Native wrapper for Safari View Controller.
https://www.npmjs.com/package/react-native-safari-view
494 stars 110 forks source link

FR: Support 3D touch / peek & pop #84

Open brunolemos opened 6 years ago

brunolemos commented 6 years ago

Support previewing the safari view using "Peek & Pop" before actually opening it.

koenpunt commented 6 years ago

Can you elaborate on what exactly you’re asking for?

brunolemos commented 6 years ago

Hi @koenpunt, I mean a way to do this on iPhone 6S and newer:

Gif
koenpunt commented 6 years ago

I just tested this somewhere where I implemented this library, and it just works by default. So unless I don't understand you correctly, this ticket can be closed.

brunolemos commented 6 years ago

@koenpunt Sorry, I wasn't clear. I don't mean inside the safari view. I mean before we open the link using this lib, got it? Like, I have a component that when I click it calls SafariView.show({.... I would need somehow force touch this component and preview the page content that SafariView will open.

koenpunt commented 6 years ago

A I see. Not sure if that should the responsibility of this library, but I'll see if I find some time to look into it. Or if you have any idea, I encourage you to open a PR.

brunolemos commented 6 years ago

I use react-native-navigation and they recently added this feature to their lib (implementation). They ask for a component ref for it to work.

But react-native-safari-view just expose static methods, so I don't know what would be the best approach to integrate 3d touch feature.

caiovncius commented 6 years ago

Hello. Anyone have any example how to can i do this? I try like the documentation but I don`t have success.

Thanks.

koenpunt commented 6 years ago

Btw, is this even natively supported for SFSafariViewController?

ptmt commented 6 years ago

Yes, it's supported. Quite nice actually, you get out-of-the-box actions such as Add To Reading List and Open in Safari. I managed to implement that, but by relying on react-native-navigation. Will try to think how to extract this code and send pull request.