import React, { useState } from 'react'; import { Image, ScrollView } from 'react-native'; import { Button, ImageViewer, Space } from '@xrnjs/ui'; import Card from '_global/Card'; import styles from './style'; const singleImageList = [ { url: 'https://images.unsplash.com/photo-1567945716310-4745a6b7844b?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80', }, ]; const multipleImageList = [ { url: 'https://images.unsplash.com/photo-1567945716310-4745a6b7844b?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80', }, { url: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80', }, { url: 'https://images.unsplash.com/photo-1518837695005-2083093ee35b?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80', }, ]; const BasicUsage = () => { const [visible, setVisible] = useState(false); const [index, setIndex] = useState(1); const handleHiddenModal = () => { console.log('图片预览已关闭'); }; const handlePreviewIndex = (index: number) => { console.log('当前预览图片索引:', index); }; return ( {/** 空值会被过滤 */} {null} {undefined} {multipleImageList.map((item, index) => ( ))} { setVisible(v); }} hiddenPreviewModal={handleHiddenModal} previewImageIndex={(i) => setIndex(i)} imageUrls={multipleImageList} index={index} > {multipleImageList.map((item, index) => ( ))} ); }; export default BasicUsage;