javascript - ImageBackground ResizeMode -
i updated react-native , introduced warning, following code:
<image source={require('../../assets/icons/heart.png')} style={{ resizemode: 'contain', height: 25, width: 25 }} > <text>foobar</text> </image> and warning:
index.ios.bundle:50435 using <image> children deprecated , error in near future. please reconsider layout or use <imagebackground> instead.
trouble when use imagebackground component instead gives me warning can't use resizemode style it.
<imagebackground source={require('../../assets/icons/heart.png')} style={{ resizemode: 'contain', height: 25, width: 25 }} > <text>foobar</text> </imagebackground> and warning:
warning: failed prop type: invalid props.style key 'resizemode' supplied 'view'. bad object: { resizemode: 'contain, height: 25, width: 25}
how supposed use imagebackgrounds? there doens't seem documentation online.
imagebackground accepts 2 style props – style , imagestyle – (obviously) applied internal view , image respectively. it's worth noting height , width values container style applied image style automatically. details visit this.
Comments
Post a Comment