From 508cc06565c1a2ab6ec88dbb8d40d3a2962c198c Mon Sep 17 00:00:00 2001 From: Hugo Dozois Date: Fri, 1 Jul 2016 04:08:22 -0700 Subject: [PATCH] Add __DEV__ around textInput prop check Summary: **Motivation** The prop validation was run on every render, even in prod which seems odd to me. This adds a dev check to make sure prod build skips the validation. **Test plan (required)** There are no changes to the ui. Closes https://github.com/facebook/react-native/pull/8499 Differential Revision: D3508805 Pulled By: javache fbshipit-source-id: 68c6a1224e33997f9df93481426daff790ef5bcd --- Libraries/Components/TextInput/TextInput.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 493bdedc3..af4a8ffc2 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -538,11 +538,13 @@ const TextInput = React.createClass({ var props = Object.assign({}, this.props); props.style = [styles.input, this.props.style]; if (!props.multiline) { - for (var propKey in onlyMultiline) { - if (props[propKey]) { - throw new Error( - 'TextInput prop `' + propKey + '` is only supported with multiline.' - ); + if (__DEV__) { + for (var propKey in onlyMultiline) { + if (props[propKey]) { + throw new Error( + 'TextInput prop `' + propKey + '` is only supported with multiline.' + ); + } } } textContainer =