From b56646fa084b72e66ab32b49262eaa8f101c349a Mon Sep 17 00:00:00 2001 From: Pieter Vanderwerff Date: Sun, 16 Jun 2024 20:30:52 -0700 Subject: [PATCH] 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 --- packages/react-native/Libraries/Text/Text.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index f40e628b411..b9c10b3e736 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -212,9 +212,11 @@ const Text: React.AbstractComponent< let _numberOfLines = numberOfLines; if (_numberOfLines != null && !(_numberOfLines >= 0)) { - console.error( - `'numberOfLines' in must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`, - ); + if (__DEV__) { + console.error( + `'numberOfLines' in must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`, + ); + } _numberOfLines = 0; }