diff --git a/src/helpers/errors.js b/src/helpers/errors.js index 17a31de83..3a030ac3d 100644 --- a/src/helpers/errors.js +++ b/src/helpers/errors.js @@ -39,20 +39,6 @@ export function printDeprecationWarning(functionName: string) { warned[functionName] = true; } -export function printUnsafeWarning(functionName: string) { - if (warned[functionName]) { - return; - } - - console.warn(` - Deprecation Warning: - ${functionName} is not recommended for use and has been renamed to UNSAFE_${functionName}. - In react-native-testing-library 2.x only the UNSAFE_${functionName} name will work. - `); - - warned[functionName] = true; -} - export function throwRemovedFunctionError( functionName: string, docsRef: string diff --git a/website/docs/Queries.md b/website/docs/Queries.md index a4b8992a9..a0c0fd705 100644 --- a/website/docs/Queries.md +++ b/website/docs/Queries.md @@ -203,23 +203,24 @@ const element = getByA11yValue({ min: 40 }); The interface is the same as for other queries, but we won't provide full names so that they're harder to find by search engines. -### `UNSAFE_ByType`, `ByType` +### `UNSAFE_ByType` -> Note: added in v1.4 +> UNSAFE_getByType, UNSAFE_getAllByType, UNSAFE_queryByType, UNSAFE_queryAllByType -> This method has been **deprecated** and has been prepended with `UNSAFE_` prefix. In react-native-testing-library 2.x only the prefixed version will work. +Returns a `ReactTestInstance` with matching a React component type. -A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches. - -### `UNSAFE_ByProps`, `ByProps` +:::caution +This method has been marked unsafe, since it requires knowledge about implementation details of the component. Use responsibly. +::: -> This method has been **deprecated** and has been prepended with `UNSAFE_` prefix. In react-native-testing-library 2.x only the prefixed version will work. +### `UNSAFE_ByProps` -A method returning a `ReactTestInstance` with matching props object +> UNSAFE_getByProps, UNSAFE_getAllByProps, UNSAFE_queryByProps, UNSAFE_queryAllByProps -### `ByName` +Returns a `ReactTestInstance` with matching props object. -> This method has been **deprecated** because using it results in fragile tests that may break between minor React Native versions. **DON'T USE IT**. It will be removed in next major release (v2.0). Use the other alternatives, such as [`getByText`](#bytext) instead. It's listed here only for back-compat purposes for early adopters of the library -> A method returning a `ReactTestInstance` with matching a React component type. Throws when no matches. +:::caution +This method has been marked unsafe, since it requires knowledge about implementation details of the component. Use responsibly. +:::