React Native Retrieve Actual Image Sizes -


i able know actual size of network-loaded image has been passed <image /> have tried using onlayout work out size (as taken here https://github.com/facebook/react-native/issues/858) seems return sanitised size after it's been pushed through layout engine.

i tried looking onloadstart, onload, onloadend, onprogress see if there other information available cannot seem of these fire. have declared follows:

  onimageloadstart: function(e){     console.log("onimageloadstart");   },    onimageload: function(e){     console.log("onimageload");   },    onimageloadend: function(e){     console.log("onimageloadend");   },     onimageprogress: function(e){     console.log("onimageprogress");   },    onimageerror: function(e){     console.log("onimageerror");   },    render: function (e) {     return (       <image         source={{uri: "http://adomain.com/myimageurl.jpg"}}         style={[this.props.style, this.state.style]}         onlayout={this.onimagelayout}         onloadstart={(e) => {this.onimageloadstart(e)}}         onload={(e) => {this.onimageload(e)}}         onloadend={(e) => {this.onimageloadend(e)}}         onprogress={(e) => {this.onimageprogress(e)}}         onerror={(e) => {this.onimageerror(e)}} />     );   } 

thanks.

image component provides static method size of image. example:

image.getsize(myuri, (width, height) => {this.setstate({width, height})}); 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -