ammarahm-ed / react-native-actions-sheet

A Cross Platform(Android, iOS & Web) ActionSheet with a flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.
https://rnas.vercel.app
MIT License
1.42k stars 119 forks source link

No params passed to initial route #316

Closed ziga-hvalec closed 5 months ago

ziga-hvalec commented 10 months ago

When using router i'm trying to pass params to the initial route

router is registered

registerSheet(
  'test_router',
  RouterSheet,
);

RouterSheet

  <ActionSheet
    enableRouterBackNavigation
    routes={routes}
    initialRoute={'initial_route'}
  />

Routes

const routes: Route[] = [
  {
    name: 'initial_route',
    component: InitialRouteComponent,
  },
 {
    name: 'second_route',
    component: SecondRouteComponent,
  },
];

i'm trying to navigate like so

SheetManager.show('test_router', {
  params: {
    test: 'test'
  }
}

inside my initial route i'm trying to get the params

const params = useSheetRouteParams();

but this is always undefiend

I did also try navigating to second route and pass params like so

return router?.navigate(
        'second_route',
        {
          test1: 'test1'
        },
      );

which works as expected