How to detect a screenshot in a RN application? - react-native

I'm having some problem about a screenshot-detector in an application.
I'm using EXPO, but I've no idea about how can I detect a screenshot.
Suppose that I've a profile screen. Each user has a profile page, I want to detect when another user does a screenshot on the screen.
My problem is: how can I detect this? I readed about the gesture here, but it didn't help me. With the gestures I can detect, instead, the scroll in a page, the location x and location y.
I readed also this answer, but about the event touchesCancelled:withEvent:touchesCancelled:withEvent: I have not found anything in React Native docs (and also EXPO docs).
So: which is the idea behind a screenshot detector? Thanks for your help!

You can't do it without detaching EXPO. There is already a feature request for that.
If you decide to detach EXPO, react-native-screenshot-detector might be helpful. The solution is very similar to the one from the linked question.

Currently with expo there is no way to do that, But if you detach you can use this package it supports android&ios screenshot detecting react-native-detector

Related

rendering different screen based on input by the user React Native

Hello fellow programmers, i wanted to ask how can i achieve different screen rendering based on input by the user. I have done it in one way but i want to know is there any better way to do?
Attached is the link to snack on expo. You can run it and see the code of how i have done it.
If there are better alternates, please let me know.
Thankyou.
please dont mark the question as duplicate before going throught it.
For better choice you can using react-navigation https://reactnavigation.org/docs/auth-flow/ This package work in Expo
The example you posted looks mostly like something I would use conditional rendering techniques for like the && syntax
See here for more guidance:
https://reactjs.org/docs/conditional-rendering.html
If your pages are dramatically different though (not just options flipping on and off) then I would recommend react navigation as giri commented.

how to navigate between webview pages described in different files

Good day, I have such a problem. The application is made on the basis of webview, at the beta stage. And I faced such a problem that after the registration stage I need to launch a separate page in which the native elements and the webview are combined. Please give a tip on how to cope with this task
U.P.D The crux of the problem is this. I have a file that describes one webview page. I need to make sure that after the user is registered, he is thrown to another file, where the webview is also described, but in addition to the webview there are native menu elements for the user to navigate the application. If it's not clear, I can try to make a block diagram, maybe this will be clearer

React native turn by turn navigation

we working with expo and using mapview, however, there are many restrictions in react native maps, as we are planning to implement turn by turn navigation. Integrating Mapbox would have been the best option, however we do not think it’s best to eject the project as expo doesn’t still support Mapbox. Although, I came across a package, react native maps navigation, I would like to know if anyone has been able to successfully implement it in their project and it functioned properly, and also know if there are any drawbacks that comes along with it. I am asking this because the author says “Please note that this module is usable but still under heavy development. Some properties and/or component names might change without notice.”
Kindly give your suggestions and advice. Thanks
Mapbox works very well in a react-native projects and recommend to use this service for your project but effectively, it don't works with expo so for me, you should eject your project to use it.
I paste here some packages I used for a GPS project (The last one is to get the current position of an user)
react-native-mapbox-gl/maps
mapbox-sdk
react-native-geolocation
Hope that could help you

How to programmatically close an ActionSheetIOS in React Native?

I can't find a way to programmatically close an ActionSheetIOS. When the device orientation changes, if there is an action sheet open, I need to close it before reopening it (otherwise it is erroneously anchored to the wrong location). I haven't been able to find a way to trigger closing it without requiring user input. Is this possible programmatically?
The documentation does not mention this being possible in the current version (0.38.0). I also could not find any related issue, so the only ideas that comes to mind are either finding a package that implements the functionality JS.coach, or extending the implementation of ActionSheetIOS to include that functionality. Maybe this question might be helpful.
React Native version 0.69.0 has added the ActionSheetIOS.dismissActionSheet() method, which will dismiss the most upper action sheet.

Changing Taskbar menu icon in nodewebkit app dynamically

I am working on a nodewebkit app. Looking for a functionality where in I can change task-bar icon of app to notify users, similar to what Skype does when a new message is received by user.
Is there any way it can be done in Nodewebkit?
Initially I tried changing window.icon in package.json file, but then I came to know that it is used only once, i.e. on app load. So that did not work.
Anything else I can try?
Thanks in advance
Window.requestAttention(Boolean attention) is what I was looking for.
It worked for me.
Thanks to Dhiraj, It gave me an additional feature for icon.