本文內(nèi)容
多張圖片放大后輪播柴墩、捏合效果
單張圖片放大捏合效果
多張圖片放大后輪播茴扁、捏合效果
npm i react-native-image-zoom-viewer --save
import ImageViewer from 'react-native-image-zoom-viewer';
render() {
//主頁是url 不是uri
images.push({url: '圖片地址'});
return (
<ImageViewer
imageUrls={images}
index={2} // 默認(rèn)選中第幾張圖
onClick={()=>{ // 點(diǎn)擊
console.log('234');
}}
/>
);
}
單張圖片放大捏合效果
npm install --save react-native-transformable-image@latest
import Image from 'react-native-transformable-image';
render() {
return (
<Image
style={{width: width, height: height}}
source={{uri: 'https://raw.githubusercontent.com/yoaicom/resources/master/images/game_of_thrones_1.jpg'}}
//pixels={{width: 3607, height: 2400}}
/>
);
}