<ImageBackground> got `imageRef` and `imageStyle` props

Summary: It can be useful when you want to setup `tintColor` for the image or get a reference to call `setNativeProps` then.

Reviewed By: ericvicenti

Differential Revision: D5158908

fbshipit-source-id: 873c1cae9bd0af711a42016dcc548231e3cf89e7
This commit is contained in:
Valentin Shergin 2017-06-01 14:03:53 -07:00 committed by Facebook Github Bot
parent d41c9d94fd
commit 2e66ac8999
1 changed files with 13 additions and 8 deletions

View File

@ -42,18 +42,23 @@ const View = require('View');
*/
class ImageBackground extends React.Component {
render() {
const {children, style, ...props} = this.props;
const {children, style, imageStyle, imageRef, ...props} = this.props;
return (
<View style={style}>
<Image
{...props}
style={{
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
}}
style={[
{
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
},
imageStyle,
]}
ref={imageRef}
/>
{children}
</View>