Navigating back from react native page to native: how? - react-native

I'm working on a native app that I want to display some pages in using React Native. I'm using react-navigation to handle a stack, and launching that in an Android activity (built according to the documentation for integrating React Native code into native apps) and from the similar instructions for iOS.
Once I enter the stack, I can navigate around it just fine - back navigation works with both an on-screen button calling navigation.goBack()/navigation.pop() and the Android hardware back button. The problem comes when I reach the top of the RN stack - I'd expect another attempt to pop from the stack or another press of the hardware back button to exit the app, but it doesn't; instead nothing happens when pressing the back button, and the on-screen button gives an error like:
The action 'GO_BACK' was not handled by any navigator.
and doesn't do anything.
How can I make back navigation from the top level of my React Native content seamlessly return me to the native app on both iOS and Android?

Related

React native hardware back button is not working after login and logout functions?

React native hardware back button is not working after login and logout functions, I am changing the stack navigator but it not working. But once you close the app and open, then hardware back button it works normally.The problem when I am changing the stack navigator it is not working.Any solution?
React Navigation version 5.9.8

Placing a react-native-video inside FlatList then pressing a button to go full screen

Say I have a react native app with a FlatList. Inside the FlatList is a react-native-video component. The video is hosted online. Inside the FlatList the video can be played. What I want is also a button that can be pressed and the video should go full screen. Is this possible to do without having to reload the video?
One solution I can do is when the button is pressed a new screen shows (e.g. in StackNavigator) with the video using flex:1 to fill up the screen. However, because it is a new screen the video needs to load again.
I've seen the Reddit app be able to bring up a video full screen without having to reload it. Of course this might be a native app and harder to do in react native.
Any thoughts on how to achieve this in react native?
EDIT: Added extra info.

Can i disable hardware overview button (a recent button) on a phone in react native?

I need disable a recent button. It is possible to implement this functionality when using react native?
About disable recent button when use react native i didn't find any thing. The difficulty is that my project uses expo, therefore i don't can use native modules Image for the button which must to be disabled
As I understand your question, you want to hide android navigation bar. There are 2 ways to achieve that:
Use React Native libraries: There are some libraries supporting you to hide navigation bar.
Hide Android Navigation Bar in React Native
How to hide React Native NavigationBar
How to hide android system' s bottom navigation bar in React Native App without changing MainActivity? Maybe through AndroidManifest?
Write a simple native module to do that: First, you need to read React Native document about Native Modules for Android. If you know how to use that, you can start searching: "android hide navigation bar". For example: How to hide navigation bar permanently in android activity?
In case you have any problems about creating native modules, just provide information about them.

Why React native navigation loads all components at the same time?

I am using react native navigation v2 by wix. I have a welcome screen with login screen and register. I start the startAuth.js from App.js. There are two tabs with login and register.
But as soon as app starts the componentWillMount methods runs in the register screen but yet i am at login tab.
Why is this happening?
react-native-navigation's Tab does not support lazy loading. But there are two special lifecyle functions where you can put your logic when component appear or disappear on screen
componentDidAppear(): called each time this component appears on screen
componentDidDisappear(): called each time this component disappears from screen
https://wix.github.io/react-native-navigation/docs/screen-lifecycle
There is also a discussion about topic https://github.com/wix/react-native-navigation/issues/1250

How can I show a splash screen in React Native with React Native Navigation while loading app Redux state?

I am trying to integrate React Native Navigation by Wix into my application and am not sure how to go about setting things up to handle a loading phase.
The library has a splash screen at the native layer but that is only displayed while the bundle is being parsed. Once that is complete and React Native takes over, I then rehydrate my Redux store (from Redux-Persist), make a couple checks, call out to an API to validate a token, and redirect the user to the proper screen. While all of this is happening, I want to display a loading screen but have no idea how to go about it using this library.
I don't want to show my app or let the user use the app until all of the loading and checks have completed.
Is this possible with this library? If so, how do I set it up? My navigation is tab based, no side drawer.
There're 2 options for you:
1. Call Navigation.startSingleApp with the only screen is "Loading Screen" when app start. At that time, you call rehydrate redux. When the call back invoked, you call Navigation.start (single or tab) to your main screen
2. Design the registerScreen with route "Loading" for loading screen. When app start, call Navigation.startSingleApp for the loading screen. On "componentDidMount" of loading screen, call rehydrate redux, when call back invoke, push to Main screen