React-native navigate between groups - react-native

In a react-native project, I want to navigate to my Dashboard after user successfully logs-in. But both screens are in different groups inside the same navigator (see screen below):
But navigating as usual does not work:--> (ERROR The action 'REPLACE' with payload {"name":"Dashboard"} was not handled by any navigator.)
Any idea how to achieve that?

Related

Expo TaskManager.defineTask using for background location update is not calling when navigating to other pages

Using Task Manager and Location to get background location updates. Created a file called Location.ts and added the required code.
Javascript code under the defined task is called when the app launches. When I navigate from Login page to Home page and Home Page to Login page defineTask is not called.
In the Android console, it only shows
2022-03-14 19:11:18.947 19624-19624/com.xxx.tmsI/TaskService: Handling job with task name 'LOCATION_TASK_NAME' for app with scoping identifier 'com.xxx.tms'.
2022-03-14 19:11:19.906 19624-19624/com.xxx.tmsI/TaskService: Handling intent with task name 'LOCATION_TASK_NAME' and app scoping identifier 'com.xxx.tms'.
I am using React Navigation and it has Tabbar navigator and Stack Navigator. I tried defining tasks in App.js that also does not works.

how to fix, blank page when trying to use history push in react native

I am working on a APP, where I created a button that navigates you to other page. I imported react native router and use history from react-router dom.
I created seperated folder with login routs (when user is on login screen he can move to sign-up)
Loginrouts.js :
than I created login.js where the button is, it uses useHistory.push() and it calls signup from loginroute.js
But when button is pressed it only shows blank screen, anyone knows why?

Route do not been cleaned when unmountOnBlur

I have an application that pass an order from the screen 1 as a param utilizing this.props.navigation.navigate('Screen',{order}) to the screen 2 and do some stuff in the screen 2. Then I navigate to another screen using the Drawer side menu. When I come back to the screen 2 utilizing the drawer menu the order still in the param (the route was not reseted).
I'm using class Component in my project and when I tried to put something like a reset in the componentWillUnmount, but the react native don't let me do that because this would be a asyncronous call.
In my order class I did (Screen 2):
componentWillUnmout() {
// some code
this.props.navigation.reset();
}
In the Screen 1 I did:
this.props.navigation.navigate('Screen 2', {order});
I tried do what was decribed in this question: https://github.com/react-navigation/react-navigation/issues/6915 but I had no sucess.
How could I reset this params in this conditions? Could I made a listener to reset the route when a navigate to another page in the Drawer Menu?
If your second page is an order details, you better use the stack pile of screens by pushing a new one.
this.props.navigation.push('orderDetails', {order});
Like that, you push a screen at the top of the stack. Navigate function search in your route history and if the screen was already open previously, it came back to it.

Navigating in the same scene with different props

I'm learning react-native with redux and I'm trying to make a kind of social network application.
My problem is: when I'm on a user-1 profile screen and I navigate to user-2 profile, so basically I navigate from Profile.js to Profile.js (same screen) with different props. The problem is when I press the 'back' button, I get the user-2 profile while I should see user-1 profile.
The profile informations are saved in the store with redux.
For navigation I use Actions.sceneKey() from react-native-router-flux.
I already tried :
this.props.navigation.navigate('profile', { key: someRandomKey });
I get "Promise returned from navigate is ignored".
T also tried to save every user profile informations that I visit in an array but I don't know how to manipulate this array when I press back button...

Creating a landing page with an extension using shoutem builder

It seems likes I am limited by the shoutem builder to having a default Main Navigation, whereby all of the other screens are wrapped by it. Is it possible for me to create a landing page where my users can sign in, and then segue to the Main Navigation? How would I achieve this?
The shoutem.auth (Users) extension does something you're asking for. It displays a screen before any shortcuts (i.e. navigation items) are displayed. It achieves this through the use of a middleware which is implemented throughout the entire Shoutem app, visible in the #shoutem/core package.
You could use a similar pattern to achieve your landing/onboarding page extension.