Skip to content

Commit 44c1649

Browse files
nkabrownfacebook-github-bot
authored andcommittedNov 19, 2017
Mention <ImageBackground> when error is thrown
Summary: Improve the error message shown when you try to nest components in an `<Image>` component by referencing the `<ImageBackground>` component. It would be helpful if the error message displayed when you try to nest components in an `<Image>` component mentioned the `<ImageBackground>` component. Especially since this component is not yet well documented. [IOS][MINOR][Libraries/Image/Image.ios.js] - Surfaced `<ImageBackground>` in error message [ANDROID][MINOR][Libraries/Image/Image.android.js] - Surfaced `<ImageBackground>` in error message Closes #16880 Differential Revision: D6369396 Pulled By: shergin fbshipit-source-id: c4ae4dbb77d0fce6cbd7a42d1957d16112b24549
1 parent 1b22d49 commit 44c1649

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎Libraries/Image/Image.android.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ var Image = createReactClass({
274274
}
275275

276276
if (this.props.children) {
277-
throw new Error('The <Image> component cannot contain children. If you want to render content on top of the image, consider using absolute positioning.');
277+
throw new Error('The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.');
278278
}
279279

280280
if (source && (source.uri || Array.isArray(source))) {

‎Libraries/Image/Image.ios.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ const Image = createReactClass({
374374
}
375375

376376
if (this.props.children) {
377-
throw new Error('The <Image> component cannot contain children. If you want to render content on top of the image, consider using absolute positioning.');
377+
throw new Error('The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.');
378378
}
379379

380380
return (

0 commit comments

Comments
 (0)
Please sign in to comment.