Image
用法
本機圖片
<Image source={require('./my-icon.png')} />
or
var icon = require('./my-icon.kpng');
<Image source={icon} />
原生資料夾圖片 (需要指定大小)
<Image source={{uri:'app_icon'}} style={{width:40,height:40}} />
網路加載圖片 (需要指定大小)
<Image source={{uri:'http://www.xxx.com'}} style={{width:40,height:40}} />
crop
{url:...,crop:{left:10,top:50,width:20,height:40}}
resizeMode
- Contain 只有一邊會填滿
- Cover 填滿
- Stretch 置中
- center 居中不拉伸
- repeat 重複直到填滿,只有ios可以用
style 中的resizeMode
- contain
- cover
- stretch
- center
- repeat
註: Image 的 source 最好是用 變數 不要用 this.state 版面不一定會更新