react-native icon indicating copy to clipboard operation
react-native copied to clipboard

0.14 required image cannot get width/height

Open smalllixin opened this issue 11 years ago • 1 comments

Firstly, I love new the asset management strategy.

//before 0.14
var img = require('image!xxx');
img.width, img.height 
var img = require('./img/abc.png');
//I see img is compiled index as integer type

So how can I get image width/height?

smalllixin avatar Nov 10 '15 00:11 smalllixin

Find a way to handle this:

// for react native 0.14 +
var resolveAssetSource = require('resolveAssetSource');
var imgSrc = resolveAssetSource(require('./some.png'));
console.log(imgSrc.width, imgSrc.height);

smalllixin avatar Nov 13 '15 09:11 smalllixin