react-native-zoom-draggable-view
View
component)
iOS only. (android returns Getting started
$ npm install react-native-zoom-draggable-view --save
Manual installation
iOS
- In XCode, in the project navigator, create new group and name it
RNZoomDraggableView
. - Right click on
RNZoomDraggableView
group,Add Files to [your project's name]
. - Go to
node_modules
➜react-native-zoom-draggable-view/ios
and addRNZoomDraggableView-Bridging-Header.h
,RNZoomDraggableView.swift
,RNZoomDraggableViewBridge.m
,RNZoomDraggableViewManager.swift
files. - You may need to add
#import "React/RCTView.h"
to your[your project's name]-Bridging-Header.h
file. - Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNZoomDraggableViewPackage;
to the imports at the top of the file - Add
new RNZoomDraggableViewPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-zoom-draggable-view' project(':react-native-zoom-draggable-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-zoom-draggable-view/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-zoom-draggable-view')
Usage
; { console; }; { const numberOfTouches = nativeEvent; console; }; { const numberOfTouches = nativeEvent; console; }; { const touchEnd = nativeEvent; console; }; { return <View style= flex: 1 > <ZoomDraggableView ref= thisviewRef = ref style= width: 350 height: 350 zoomScale=05 // initial Scale minimumZoomScale=02 maximumZoomScale=2 requiresMinScale=true onTap=thisonTap onTouchStart=thisonTouchStart onTouchEnd=thisonTouchEnd onLongPress=thisonLongPress userInteractionEnabled=thisstateuserInteractionEnabled longPressEnabled=true > <Image style= width: 700 height: 700 source= uri: 'yourImageSourcePath' /> </ZoomDraggableView> </View> ; }