Android 是否将本机图像标记defaultSource点响应到内存中的图像数据?
医生说:Android 是否将本机图像标记defaultSource点响应到内存中的图像数据?,android,react-native,Android,React Native,医生说: defaultSource A static image to display while loading the image source. uri - a string representing the resource identifier for the image, which should be either a local file path or the name of a static image resource (which should be wra
defaultSource
A static image to display while loading the image source.
uri - a string representing the resource identifier for the image, which should be either a local file path or the name of a static image resource (which should be wrapped in the require('./path/to/image.png') function).
width, height - can be specified if known at build time, in which case these will be used to set the default <Image/> component dimensions.
scale - used to indicate the scale factor of the image. Defaults to 1.0 if unspecified, meaning that one image pixel equates to one display point / DIP.
number - Opaque type returned by something like require('./image.jpg').
我认为这是不可能的 该属性仅接受两种不同的类型:
require('./image.jpg')
{uri:string,width:number,height:number,scale:number}
。uri
字段是指向本机端图像的字符串RNFetchBlob.fetch('GET', 'http://www.example.com/images/img1.png', {
Authorization : 'Bearer access-token...',
// more headers ..
})
// when response status code is 200
.then((res) => {
// the conversion is done in native code
let base64Str = res.base64()
// the following conversions are done in js, it's SYNC
let text = res.text()
let json = res.json()
})
// Status code is not 200
.catch((errorMessage, statusCode) => {
// error handling
})