New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-view-transformer

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-view-transformer

`react-native-view-transformer` is a pure JavaScript RN component that makes **ANY** views transformable using gestures like pinch, double tap or pull, as below shows:

  • 0.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
191
decreased by-1.55%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-view-transformer

react-native-view-transformer is a pure JavaScript RN component that makes ANY views transformable using gestures like pinch, double tap or pull, as below shows:

Demo project is here

Install

npm install --save react-native-view-transformer@latest

Usage

First, import:

import ViewTransformer from 'react-native-view-transformer';

Then, render:

<ViewTransformer>
  //Your views here
</ViewTransformer>

Now, your views are transformable!

ViewTransformer.Image

The most common case is to transform an image, or a photo, which is famous as a PhotoView, or ImageViewer, so we provide a similar component ViewTransformer.Image, which is much like the official Image component, but transformable!

Just use it like the official Image component:

<ViewTransformer.Image
  style={{width: width, height: height}}
  source={{uri: 'xxx'}}
  pixels={{width: 1920, height: 1080}} //this prop is important!
/>

But with an additional prop pixels, which tells image size in pixels.

The pixels prop is used to align the edge of the image content with the view's boundry and to determine the max scale.(We can actually use Image.getSize to get pixels info on iOS, but NOT on Android, so for now this prop is needed)

There may be a problem: How can I find the pixels info of a remote image without loading it? Well, you can ask your app's API server to provide it. For example, the API server may return a json like

image: {
  url: 'xxx',
  width: 1920,
  height: 1080
}
demo

FAQs

Package last updated on 18 May 2016

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