1.0.6 • Published 6 years ago

@duagentur/react-native-zoomable-view v1.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Warning: Not production ready yet!

react-native-zoomable-view

A view component for react-native with pinch to zoom, tap to move and double tap to zoom capability.

Readme: Coming soon

Props

Events

namedescriptionparamsexpected return
onStartShouldSetPanResponderdescriptionevent, gestureState, zoomableViewEventObject, baseComponentResult{boolean} whether panresponder should be set or not
onMoveShouldSetPanResponderdescriptionevent, gestureState, zoomableViewEventObject, baseComponentResult{boolean} whether panresponder should be set or not
onPanResponderGrantdescriptionevent, gestureState, zoomableViewEventObjectvoid
onPanResponderEndWill be called when gesture endsevent, gestureState, zoomableViewEventObjectvoid
onPanResponderMoveWill be called when user moves while touchingevent, gestureState, zoomableViewEventObjectvoid
onDoubleTapWill be called, when user double taps the screenevent, gestureState, zoomableViewEventObjectvoid
onShiftingBeforeWill be called, when user taps and moves the view, but before our view movement work kicks in (so this is the place to interrupt movement, if you need to)event, gestureState, zoomableViewEventObject{boolean} if this returns false, ZoomableView will not process the shift, otherwise it will
onShiftingAfterWill be called, when user taps and moves the view, but after the values have changed alreadyevent, gestureState, zoomableViewEventObjectvoid
onShiftingEndWill be called, when user stops a tap and move gestureevent, gestureState, zoomableViewEventObjectvoid
onPinchMovementBeforeWill be called, while the user pinches the screen, but before our zoom work kicks in (so this is the place to interrupt zooming, if you need to)event, gestureState, zoomableViewEventObject{boolean} if this returns false, ZoomableView will not process the pinch, otherwise it will
onPinchMovementAfterWill be called, while the user pinches the screen, but after the values have changed alreadyevent, gestureState, zoomableViewEventObject{boolean} if this returns false, ZoomableView will not process the pinch, otherwise it will
onPinchEndWill be called, when the pinch has endedevent, gestureState, zoomableViewEventObject{boolean} if this returns false, ZoomableView will not process the pinch, otherwise it will

zoomableViewEventObject

The zoomableViewEventObject object is attached to every event and represents the current state of our zoomable view.

   {
      zoomLevel: number,         // current level of zooming (usually a value between minZoom and maxZoom)
      offsetX: number,           // current offset left
      offsetY: number,           // current offset top
      lastScale: number,         // last zoom level (before we started the movement)
      lastX: number,             // last offset left (before we started the movement)
      lastY: number,             // last offset top (before we started the movement)
      lastMovePinch: boolean,    // information if a movement is going on
   }