Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename navigationTriggerElement to focusRestorationSelector
  • Loading branch information
ciampo committed Dec 14, 2021
commit 092acf5129ec4d73e40c48d427cf81ae4ad038bc
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ function NavigatorProvider(
const navigatorContextValue: NavigatorContextType = {
location: locationHistory[ locationHistory.length - 1 ],
push: ( path, options ) => {
const { navigationTriggerElement, ...restOptions } = options;
const { focusRestorationSelector, ...restOptions } = options;

// The `navigationTriggerElement` needs to be applied on the current
// The `focusRestorationSelector` needs to be applied on the current
// location, while the remaining options need to be applied on the
// incoming location
setLocationHistory( [
...locationHistory.slice( 0, -1 ),
// Force the `isBack` flag to `true` when navigating back.
{
...locationHistory[ locationHistory.length - 1 ],
navigationTriggerElement,
focusRestorationSelector,
},
{
path,
Expand Down
5 changes: 2 additions & 3 deletions packages/components/src/navigator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import type { ReactNode } from 'react';

type NavigateOptions = {
navigationTriggerElement?: unknown;
focusRestorationSelector?: string;
};

export type NavigatorLocation = {
export type NavigatorLocation = NavigateOptions & {
isBack?: boolean;
path?: string;
navigationTriggerElement?: unknown;
};

export type NavigatorContext = {
Expand Down