@react-native-pure/gallery
v1.5.4
Published
滑动查看图片/视频,支持缩放
Downloads
18
Readme
gallery
A pure JavaScript image and video gallery component for react-native apps with common gestures like pan, pinch and doubleTap, supporting both iOS and Android. Support custom item.
Install
$ npm i @react-native-pure/gallery --save
Documentaion
Quite easy to use:
import GalleryView from "@react-native-pure/gallery"
import {GalleryFileType} from '@react-native-pure/gallery/src/types'
class Galleray extends React.Component{
data = [{
url:'http://www.bz55.com/uploads/allimg/150122/139-150122145421.jpg',
type:GalleryFileType.image
}]
render(){
return (
<GalleryViewer dataSource={this.data}/>
);
}
}
GalleryProps
dataSource
Array<GalleryData>style?
anyinitIndex?
(Number* 初始显示第几张图renderFooter?
(index: Number) => React.ReactElement 自定义尾部renderHeader?
(index: Number) => React.ReactElement 自定义头部renderItem?
(data:GalleryData,index: Number) => React.ReactElement 内容页面渲染renderIndicator?
(data:GalleryData,index: Number) => React.ReactElement 是否显示加载动画onChange?
(index:number)=>void 当内容切换时触发maxScale?
Number最大缩放比例minScale?
(Number最小缩放比例onPress?
(index: Number) =>void单击onDoubleClick?
(index: Number) =>void 双击enableDoubleClickZoom?
Boolean是否支持双击,默认支持onResponderGrant?
((event,gestureState)=>void 手势开始onResponderMove?
((event,gestureState)=>void 手势移动onResponderEnd?
((event,gestureState)=>void 手势结束
GalleryData
url
String 图片/视频url地址type
** $Values<typeof GalleryFileType>** 数据源类型coverImageUrl
String 视频封面图地址disableZoom
Boolean 禁用缩放,默认false
GalleryFileType
-1
other0
图片1
视频