diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index e7f450a67..5d9f63d6b 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -407,6 +407,14 @@ var TextInput = React.createClass({ } }, + getChildContext: function() { + return {isInAParentText: true}; + }, + + childContextTypes: { + isInAParentText: React.PropTypes.bool + }, + render: function() { if (Platform.OS === 'ios') { return this._renderIOS(); @@ -524,6 +532,16 @@ var TextInput = React.createClass({ _renderAndroid: function() { var autoCapitalize = autoCapitalizeConsts[this.props.autoCapitalize]; + var children = this.props.children; + var childCount = 0; + ReactChildren.forEach(children, () => ++childCount); + invariant( + !(this.props.value && childCount), + 'Cannot specify both value and children.' + ); + if (childCount > 1) { + children = {children}; + } var textContainer = ; return (