Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-zoom-view

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-zoom-view

scaling operations on view

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-native-zoom-view

��

icon1.gif

  • ʵ��ͼƬ�Ŵ���С�����������������һ��ؼ�

��װ

  • yarn add react-native-zoom-view
  • npm install react-native-zoom-view

����ʵ������

import ViewControl from 'react-native-zoom-view'
const {width,height} = Dimensions.get('window')

<ViewControl
    cropWidth={width}     
    cropHeight={height}
    imageWidth={width}
    imageHeight={height}>
    <Image
	style={{
	    width:width,
	    height:height,
	    resizeMode: 'contain'
	}}
	source={{
	    uri:item
	}}/>
</ViewControl>

ʵ�����ź����һ�


ʵ�����ź����һ�
import Swiper from 'react-native-swiper'
import ViewControl from 'react-native-zoom-view'

renderSwiperItemView() {
const imgs = [
    'http://img1.ph.126.net/u1dVCkMgF8qSqqQLXlBFQg==/6631395420169075600.jpg',
    'http://img2.ph.126.net/PqPdn4nhTSXTlPfDE_igJg==/6631322852401020356.jpg',
    'http://img1.ph.126.net/Ta6-WaHwuYMSehnn6Xcmyg==/6631426206490316698.jpg',
    'http://img0.ph.126.net/bCkBoPHS4d32mUJPqBIYrQ==/6631803338979839988.jpg',
    'http://img2.ph.126.net/bkaOfRyDoyddXri0GjpWjA==/6630608169839463386.jpg',
];
return imgs.map((item,i)=>{
    return (
	<ViewControl
	    key={i}
	    cropWidth={width}
	    cropHeight={height}
	    imageWidth={width}
	    imageHeight={height}>
	    <Image
		style={{
		    width:width,
		    height:height,
		    resizeMode: 'contain'
		}}
		source={{
		    uri:item
		}}/>
	</ViewControl>
    )
})
}

render() {
return (
    <Swiper
	loop={false}
	showsPagination={false}>
	{this.renderSwiperItemView()}
    </Swiper>
);
}
    

�ĵ�

PropsTypeDescriptionDefaultValue
cropWidth(required)numberoperating area width100
cropHeight(required)numberoperating area height100
imageWidth(required)numberpicture width100
imageHeight(required)numberpicture height100
onClick()=>voidonClick()=>{}
panToMovebooleanallow to move picture with one fingertrue
pinchToZoombooleanallow scale with two fingerstrue
leaveStayTimenumberhow many milliseconds after the finger presses to trigger onClick100
leaveDistancenumberhow many finger movement can also trigger onClick10
horizontalOuterRangeOffset(offsetX?: number)=>voidhorizontal beyond the distance, the parent to do picture switching, you can listen to this function. When this function is triggered, you can do the switch operation()=>{}
onDragLeft()=>voidtrigger to switch to the left of the graph, the left sliding speed exceeds the threshold when triggered()=>{}
responderRelease(vx: number)=>voidlet go but do not cancel()=>{}
maxOverflownumbermaximum sliding threshold100
longPressTimenumberlong press threshold800
onLongPress()=>voidon longPress()=> {}

Reference

  • ͼƬ�ŵ���С���������ֶ�������react-native-image-zoom��ֻ���޸��˺�������һЩ����ʹ����Ӽ������һ���
  • react-native-image-zoom

Keywords

FAQs

Package last updated on 24 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc