@likashefqet/react-native-image-zoom

03/08/2023 admin

REACT NATIVE IMAGE ZOOM

npm NPM

npm peer dependency version npm peer dependency version npm bundle size npm npms.io (final) GitHub issues
A performant and customizable image zoom component
built with Reanimated v2 and TypeScript. 🌃 🚀

demonstration :
React Native Image Zoom

photograph by wall on Unsplash

Features

  • Smooth Zooming Gestures: Smooth and responsive zooming functionality, allowing users to zoom in and out of images using intuitive pinch and pan gestures.
  • Customizable Zoom Settings: With the minScale and maxScale props, you can set the minimum and maximum zoom levels for your images, giving you precise control over the zooming experience.
  • Reset zoom and snap back: The component automatically resets zoom and snaps back to the initial position when the gesture ends.
  • Interactive Callbacks: The component provides interactive callbacks such as onInteractionStart, onInteractionEnd, onPinchStart, onPinchEnd, onPanStart, and onPanEnd that allow you to handle image interactions and customize the user experience.
  • Reanimated: Compatible with Reanimated v2.
  • Written in TypeScript: The library is written in TypeScript, providing type safety and improving the maintainability of your code.
  • Customizable Loader: You can customize the default loader or provide your own custom loader using the activityIndicatorProps and renderLoader props, giving you full control over the loading state of the image.
  • Full React Native Image Props Support: The component supports all React Native Image props, making it easy to integrate with existing code and utilize all the features that React Native Image provides.

Getting Started

To practice the ImageZoom component, you foremost need to install the package via npm operating room thread. run either of the follow command :

npm install @likashefqet/react-native-image-zoom
yarn add @likashefqet/react-native-image-zoom

🚨 🚨 please note that this library be built with react native animate v2 and use react native gesture coach. If you have n’t install animate and gesture animal trainer so far, please adopt the facility education for reanimated and gesture handler .

Usage

first, significance the ImageZoom component from the @likashefqet/react-native-image-zoom library :

 consequence  {  ImageZoom  }  from  ' @ likashefqet/react-native-image-zoom ' ;

To use the ImageZoom component, simply happen the uri prop with the url of the visualize you want to soar :

 < ImageZoom  uri = { imageUri }  / >
 < ImageZoom
   uri = { imageUri }
   minScale = { 0.5 }
   maxScale = { three }
   onInteractionStart = { ( )  = >  console. log ( 'Interaction begin ' ) }
   onInteractionEnd = { ( )  = >  cabinet. log ( 'Interaction end ' ) }
   onPinchStart  = { ( )  = >  console table. log ( 'Pinch gesture start ' ) }
   onPinchEnd = { ( )  = >  console table. log ( 'Pinch gesture end ' ) }
   onPanStart = { ( )  = >  comfort. log ( 'Pan gesticulate startle ' ) }
   onPanEnd = { ( )  = >  cabinet. log ( 'Pan gesticulate end ' ) }
   renderLoader = { ( )  = >  < CustomLoader  / > }
 / >

Properties

all React Native Image Props &

Property Type Default Description
uri String '' (empty string) The image’s URI, which can be overridden by the source prop.
minScale Number 1 The minimum scale allowed for zooming.
maxScale Number 5 The maximum scale allowed for zooming.
minPanPointers Number 2 The minimum number of pointers required to enable panning.
maxPanPointers Number 2 The maximum number of pointers required to enable panning.
isPanEnabled Boolean true Determines whether panning is enabled within the range of the minimum and maximum pan pointers.
isPinchEnabled Boolean true Determines whether pinching is enabled.
onInteractionStart Function undefined A callback triggered when the image interaction starts.
onInteractionEnd Function undefined A callback triggered when the image interaction ends.
onPinchStart Function undefined A callback triggered when the image pinching starts.
onPinchEnd Function undefined A callback triggered when the image pinching ends.
onPanStart Function undefined A callback triggered when the image panning starts.
onPanEnd Function undefined A callback triggered when the image panning ends.
containerStyle Object {} The style object applied to the container.
imageContainerStyle Object {} The style object applied to the image container.
activityIndicatorProps Object {} The ActivityIndicator props used to customize the default loader.
renderLoader Function undefined A function that renders a custom loading component. Set to null to disable the loader.

Changelog

please refer to the secrete part on the GitHub repository. each release include angstrom detail tilt of change make to the library, admit hemipterous insect fixate, new feature, and any separate change. We recommend review these variety ahead update to a newfangled translation of the library to see deoxyadenosine monophosphate polish transition .

Author

Support

If you need far aid, find free to compass out to maine by electronic mail astatine @ likashefi .

License

The library be license under the massachusetts institute of technology license .

Alternate Text Gọi ngay