Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,20 @@ describe('Simple relations', () => {
});

describe('External relations', () => {
test('simultaneousWithExternalGesture', () => {
test('simultaneousWith', () => {
const pan1 = renderHook(() =>
useGesture(SingleGestureName.Pan, { disableReanimated: true })
).result.current;
const pan2 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
simultaneousWithExternalGesture: pan1,
simultaneousWith: pan1,
})
).result.current;
const pan3 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
simultaneousWithExternalGesture: [pan1, pan2],
simultaneousWith: [pan1, pan2],
})
).result.current;

Expand All @@ -134,20 +134,20 @@ describe('External relations', () => {
);
});

test('requireExternalGestureToFail', () => {
test('requireToFail', () => {
const pan1 = renderHook(() =>
useGesture(SingleGestureName.Pan, { disableReanimated: true })
).result.current;
const pan2 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
requireExternalGestureToFail: pan1,
requireToFail: pan1,
})
).result.current;
const pan3 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
requireExternalGestureToFail: [pan1, pan2],
requireToFail: [pan1, pan2],
})
).result.current;

Expand All @@ -160,20 +160,20 @@ describe('External relations', () => {
expect(pan3.gestureRelations.waitFor).toStrictEqual([pan1.tag, pan2.tag]);
});

test('blocksExternalGesture', () => {
test('blocks', () => {
const pan1 = renderHook(() =>
useGesture(SingleGestureName.Pan, { disableReanimated: true })
).result.current;
const pan2 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
blocksExternalGesture: pan1,
block: pan1,
})
).result.current;
const pan3 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
blocksExternalGesture: [pan1, pan2],
block: [pan1, pan2],
})
).result.current;

Expand Down Expand Up @@ -313,25 +313,25 @@ describe('Complex relations with external gestures', () => {
const pan1 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
simultaneousWithExternalGesture: pan5,
simultaneousWith: pan5,
})
).result.current;
const pan2 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
simultaneousWithExternalGesture: pan5,
simultaneousWith: pan5,
})
).result.current;
const pan3 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
requireExternalGestureToFail: pan5,
requireToFail: pan5,
})
).result.current;
const pan4 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
requireExternalGestureToFail: pan5,
requireToFail: pan5,
})
).result.current;

Expand Down Expand Up @@ -391,14 +391,14 @@ describe('Complex relations with external gestures', () => {
const pan1 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
simultaneousWithExternalGesture: [pan4, pan5],
simultaneousWith: [pan4, pan5],
})
).result.current;

const pan2 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
requireExternalGestureToFail: [pan4, pan5],
requireToFail: [pan4, pan5],
})
).result.current;

Expand Down Expand Up @@ -466,7 +466,7 @@ describe('External relations with composed gestures', () => {
const pan3 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
simultaneousWithExternalGesture: composedGesture,
simultaneousWith: composedGesture,
})
).result.current;

Expand Down Expand Up @@ -503,7 +503,7 @@ describe('External relations with composed gestures', () => {
const pan3 = renderHook(() =>
useGesture(SingleGestureName.Pan, {
disableReanimated: true,
simultaneousWithExternalGesture: composedGesture,
simultaneousWith: composedGesture,
})
).result.current;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function extractHandlerTags(
return otherTags;
}

function makeSimultaneousWithExternalGestureSymmetric(
function makeSimultaneousWithSymmetric(
otherHandler: Gesture | Gesture[] | undefined,
handlerTag: number
) {
Expand Down Expand Up @@ -62,17 +62,12 @@ export function prepareRelations<THandlerData, TConfig>(
config: BaseGestureConfig<THandlerData, TConfig>,
handlerTag: number
): GestureRelations {
makeSimultaneousWithExternalGestureSymmetric(
config.simultaneousWithExternalGesture,
handlerTag
);
makeSimultaneousWithSymmetric(config.simultaneousWith, handlerTag);

return {
simultaneousHandlers: extractHandlerTags(
config.simultaneousWithExternalGesture
),
waitFor: extractHandlerTags(config.requireExternalGestureToFail),
blocksHandlers: extractHandlerTags(config.blocksExternalGesture),
simultaneousHandlers: extractHandlerTags(config.simultaneousWith),
waitFor: extractHandlerTags(config.requireToFail),
blocksHandlers: extractHandlerTags(config.block),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { FilterNeverProperties } from './UtilityTypes';

// Unfortunately, this type cannot be moved into ConfigTypes.ts because of circular dependency
type ExternalRelations = {
simultaneousWithExternalGesture?: Gesture | Gesture[];
requireExternalGestureToFail?: Gesture | Gesture[];
blocksExternalGesture?: Gesture | Gesture[];
simultaneousWith?: Gesture | Gesture[];
requireToFail?: Gesture | Gesture[];
block?: Gesture | Gesture[];
};

// Similarly, this type cannot be moved into ConfigTypes.ts because it depends on `ExternalRelations`
Expand Down
Loading