Switch 'number of lines' validation to DEV only (#44961)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44961

Switch the "number of lines" warning, which ensures this value is not negative, to only fire in DEV.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D58472148

fbshipit-source-id: e52849effe9a6dc3f25288a64deebd4fd7624e4e
This commit is contained in:
Pieter Vanderwerff
2024-06-16 20:30:52 -07:00
committed by Facebook GitHub Bot
parent 9435097b16
commit b56646fa08
+5 -3
View File
@@ -212,9 +212,11 @@ const Text: React.AbstractComponent<
let _numberOfLines = numberOfLines;
if (_numberOfLines != null && !(_numberOfLines >= 0)) {
console.error(
`'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
);
if (__DEV__) {
console.error(
`'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
);
}
_numberOfLines = 0;
}