javascript - requiring module by name is only supported in debugging mode and will break in production -
i have list of text , images, name of image firebase database , concatenate extracted name path of images' folder under project: that's code used
var icon= require ('path/'+item.image+'.png') return ( ... <image style={{width: 50, height: 50}} source={icon}/>
the images displayed have warnings as have images in list read somewhere
require('image!...') no longer supported
support require('image!…'), has been deprecated long time, removed. if still loading images way in apps, make sure check documentation alternatives.
there no explicit question being asked, assume you're asking "what error mean?" , "what, if anything, should make go away?".
the require('image!...')
(really) old way of using images in react native. suspect issue here you're building image name dynamically.
see react native docs on images:
in order work, image name in require has known statically.
// <image source={require('./my-icon.png')} /> // bad var icon = this.props.active ? 'my-icon-active' : 'my-icon-inactive'; <image source={require('./' + icon + '.png')} /> // var icon = this.props.active ? require('./my-icon-active.png') : require('./my-icon-inactive.png'); <image source={icon} />
so don't build image name dynamically.
yes, feel pain having write switch-case countries of world...
Comments
Post a Comment