Update Images.md with ImageBackground
Summary: This part of the documentation was outdated since v0.46. :) Closes https://github.com/facebook/react-native/pull/15151 Differential Revision: D5478408 Pulled By: shergin fbshipit-source-id: a9d442560ad2768a684b9bbb11285b5f20f9d00d
This commit is contained in:
parent
c748d692a4
commit
8dea90ba8b
|
@ -186,13 +186,15 @@ On the user side, this lets you annotate the object with useful attributes such
|
|||
|
||||
## Background Image via Nesting
|
||||
|
||||
A common feature request from developers familiar with the web is `background-image`. To handle this use case, simply create a normal `<Image>` component and add whatever children to it you would like to layer on top of it.
|
||||
A common feature request from developers familiar with the web is `background-image`. To handle this use case, you can use the `<ImageBackground>` component, which has the same props as `<Image>`, and add whatever children to it you would like to layer on top of it.
|
||||
|
||||
You might not want to use `<ImageBackground>` in some cases, since the implementation is very simple. Refer to `<ImageBackground>`'s [source code](https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageBackground.js) for more insight, and create your own custom component when needed.
|
||||
|
||||
```javascript
|
||||
return (
|
||||
<Image source={...}>
|
||||
<ImageBackground source={...}>
|
||||
<Text>Inside</Text>
|
||||
</Image>
|
||||
</ImageBackground>
|
||||
);
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue