我无法根据react native image上的文档来实现。有人可以帮我吗?
Image.getSize(this.props.data.thumbnail, (width,height) =>{
const win = Dimensions.get('window')
const ratio = win.width/width
this.setState( {
width: style.width,
height: height * ratio
})
})
答案 0 :(得分:1)
有一个错误回调,可用于处理错误。
Image.getSize(this.props.data.thumbnail, (width, height) =>
{
const win = Dimensions.get('window')
const ratio = win.width/width
this.setState({
width: style.width,
height: height * ratio
})
}, (error) =>
{
this.setState({ loading: false });
console.log( error );
});