[RTR] Add usage warning behind flag (#27903)

## Summary

Moving towards deprecation of ReactTestRenderer. Log a warning on each
render so we can remove the exports in a future major version.

We can enable this flag in web RTR without disrupting RN tests by
flipping the flag in
`packages/shared/forks/ReactFeatureFlags.test-renderer.js`

## How did you test this change?

`yarn test
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js`

DiffTrain build for [66c8346401](https://github.com/facebook/react/commit/66c8346401d271588e4c400921c5dab5478fc623)
This commit is contained in:
jackpope
2024-02-23 16:38:05 +00:00
parent ec5b61a29b
commit edd8fbef41
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -1 +1 @@
aaf85f3af8c30252edaab5c24975cd086937b2a4
66c8346401d271588e4c400921c5dab5478fc623
@@ -387,6 +387,7 @@ export default [
"memo: The first argument must be a component. Instead received: %s",
"onError returned something with a type other than \"string\". onError should return a string and may return null or undefined but must not return anything else. It received something of type \"%s\" instead",
"propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.",
"react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer",
"render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",
"render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.",
"render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render.",