Skip to content

Commit

Permalink
Mark legacy web implementation as deprecated (#3259)
Browse files Browse the repository at this point in the history
## Description

The legacy web implementation will be removed in Gesture Handler 3.
This PR explicitly marks it as deprecated before that removal occurs.
Suggested in
[this](#3229 (comment))
github comment.

## Test plan

- see how trying to use `enableExperimentalWebImplementation` or
`enableExperimentalWebImplementation` results in a warning.
latekvo authored Dec 9, 2024
1 parent f0604b0 commit 51504ee
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/EnableNewWebImplementation.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
import { Platform } from 'react-native';
import { tagMessage } from './utils';

let useNewWebImplementation = true;
let getWasCalled = false;

/**
* @deprecated new web implementation is enabled by default. This function will be removed in Gesture Handler 3
*/
export function enableExperimentalWebImplementation(
_shouldEnable = true
): void {
// NO-OP since the new implementation is now the default
console.warn(
tagMessage(
'New web implementation is enabled by default. This function will be removed in Gesture Handler 3.'
)
);
}

/**
* @deprecated legacy implementation is no longer supported. This function will be removed in Gesture Handler 3
*/
export function enableLegacyWebImplementation(
shouldUseLegacyImplementation = true
): void {
console.warn(
tagMessage(
'Legacy web implementation is deprecated. This function will be removed in Gesture Handler 3.'
)
);

if (
Platform.OS !== 'web' ||
useNewWebImplementation === !shouldUseLegacyImplementation

0 comments on commit 51504ee

Please sign in to comment.