diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index 65a6b7068..b5308b464 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -272,6 +272,10 @@ var Image = createReactClass({ console.warn('The component requires a `source` property rather than `src`.'); } + if (this.props.children) { + throw new Error('The component cannot contain children. If you want to render content on top of the image, consider using aboslute positioning.'); + } + if (source && (source.uri || Array.isArray(source))) { let style; let sources; diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index 6d3799533..16588e63f 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -374,6 +374,10 @@ const Image = createReactClass({ console.warn('The component requires a `source` property rather than `src`.'); } + if (this.props.children) { + throw new Error('The component cannot contain children. If you want to render content on top of the image, consider using aboslute positioning.'); + } + return ( component', + render: function() { + return ( + + + + React + + + ); + }, + }, + { + title: 'Nesting content inside component', render: function() { return (