change the initial route name for bottom sheet based on redux state

Viewed 67

For react navigation 4, I have a bottom tab with 4 screens. I want to override the initial Route dynamically based on a value present in the redux -

const initState = {
  // route
  routeName: welcome_screen,
};

the routeName parameter will be passed via a function

const navigationHandler = (routeName) => {
  
  return routeName;
};

which will be passed to the initialRouteName for the bottom sheet

initialRouteName: navigationHandler(welcome_screen),

but when I passed it, it's giving me an error saying that the function is an instance of an object.

complete error image is it possible to pass a function that returns a string to the initialRouteName? or perhaps a better way to change the initial route name dynamically?

0 Answers
Related