Skip to content

Commit

Permalink
chore(menu): fix wrong naming
Browse files Browse the repository at this point in the history
  • Loading branch information
pierpo committed Nov 6, 2023
1 parent cc858f5 commit a855167
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/lib/src/spatial-navigation/SpatialNavigator.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Direction, Lrud } from '@bam.tech/lrud';

export type OnDirectionHandledWithMovement = (direction: Direction) => void;
type OnDirectionHandledWithMovementRef = { current: OnDirectionHandledWithMovement };
export type OnDirectionHandledWithoutMovement = (direction: Direction) => void;
type OnDirectionHandledWithoutMovementRef = { current: OnDirectionHandledWithoutMovement };

type SpatialNavigatorParams = {
onDirectionHandledWithoutMovementRef: OnDirectionHandledWithMovementRef;
onDirectionHandledWithoutMovementRef: OnDirectionHandledWithoutMovementRef;
};

export default class SpatialNavigator {
private lrud: Lrud;
private isLocked = false;
private onDirectionHandledWithoutMovementRef: OnDirectionHandledWithMovementRef;
private onDirectionHandledWithoutMovementRef: OnDirectionHandledWithoutMovementRef;

constructor({
onDirectionHandledWithoutMovementRef = { current: () => undefined },
Expand Down
6 changes: 3 additions & 3 deletions packages/lib/src/spatial-navigation/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SpatialNavigatorContext } from '../context/SpatialNavigatorContext';
import { useBeforeMountEffect } from '../hooks/useBeforeMountEffect';
import { useCreateSpatialNavigator } from '../hooks/useCreateSpatialNavigator';
import { useLockRootSpatialNavigator } from '../hooks/useLockRootSpatialNavigator';
import { OnDirectionHandledWithMovement } from '../SpatialNavigator';
import { OnDirectionHandledWithoutMovement } from '../SpatialNavigator';

const ROOT_ID = 'root';

Expand All @@ -22,7 +22,7 @@ type Props = {
* for your side menu, which would be common across pages, and you'd
* make this menu active when you reach the left side of your page navigator.
*/
onDirectionHandledWithoutMovement?: OnDirectionHandledWithMovement;
onDirectionHandledWithoutMovement?: OnDirectionHandledWithoutMovement;
children: ReactNode;
};

Expand All @@ -33,7 +33,7 @@ export const SpatialNavigationRoot = ({
}: Props) => {
// We can't follow the react philosophy here: we can't recreate a navigator if this function changes
// so we'll have to store its ref and update the ref if there is a new value to this function
const onDirectionHandledWithoutMovementRef = useRef<OnDirectionHandledWithMovement>(
const onDirectionHandledWithoutMovementRef = useRef<OnDirectionHandledWithoutMovement>(
() => undefined,
);
// Update the ref at every render
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import SpatialNavigator, { OnDirectionHandledWithMovement } from '../SpatialNavigator';
import SpatialNavigator, { OnDirectionHandledWithoutMovement } from '../SpatialNavigator';
import { useEffect, useMemo } from 'react';
import { remoteControlSubscriber, remoteControlUnsubscriber } from '../configureRemoteControl';

type SpatialNavigatorHookParams = {
onDirectionHandledWithoutMovementRef: React.MutableRefObject<OnDirectionHandledWithMovement>;
onDirectionHandledWithoutMovementRef: React.MutableRefObject<OnDirectionHandledWithoutMovement>;
};

export const useCreateSpatialNavigator = ({
Expand Down

0 comments on commit a855167

Please sign in to comment.