Skip to content

Commit 7dfae9a

Browse files
committed
feat: add onLongSelect prop to Node
1 parent 2ee0be1 commit 7dfae9a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • packages/lib/src/spatial-navigation/components

packages/lib/src/spatial-navigation/components/Node.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type DefaultProps = {
4040
onFocus?: () => void;
4141
onBlur?: () => void;
4242
onSelect?: () => void;
43+
onLongSelect?: () => void;
4344
onActive?: () => void;
4445
onInactive?: () => void;
4546
orientation?: NodeOrientation;
@@ -101,6 +102,7 @@ export const SpatialNavigationNode = forwardRef<SpatialNavigationNodeRef, Props>
101102
onFocus,
102103
onBlur,
103104
onSelect,
105+
onLongSelect = onSelect,
104106
onActive,
105107
onInactive,
106108
orientation = 'vertical',
@@ -144,6 +146,9 @@ export const SpatialNavigationNode = forwardRef<SpatialNavigationNodeRef, Props>
144146
const currentOnSelect = useRef<() => void>();
145147
currentOnSelect.current = onSelect;
146148

149+
const currentOnLongSelect = useRef<() => void>();
150+
currentOnLongSelect.current = onLongSelect;
151+
147152
const currentOnFocus = useRef<() => void>();
148153
currentOnFocus.current = () => {
149154
onFocus?.();
@@ -174,6 +179,7 @@ export const SpatialNavigationNode = forwardRef<SpatialNavigationNodeRef, Props>
174179
setIsFocused(true);
175180
},
176181
onSelect: () => currentOnSelect.current?.(),
182+
onLongSelect: () => currentOnLongSelect.current?.(),
177183
orientation,
178184
isIndexAlign: alignInGrid,
179185
indexRange,

0 commit comments

Comments
 (0)