Gathering detailed insights and metrics for react-native-photoview-fixios-test
Gathering detailed insights and metrics for react-native-photoview-fixios-test
Gathering detailed insights and metrics for react-native-photoview-fixios-test
Gathering detailed insights and metrics for react-native-photoview-fixios-test
npm install react-native-photoview-fixios-test
Typescript
Module System
Node Version
NPM Version
Total Downloads
822
Last Day
4
Last Week
9
Last Month
19
Last Year
105
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
react-native-photoview-fixios-test@1.0.2
Unpacked Size
1.27 MB
Size
395.94 kB
File Count
255
NPM Version
6.9.0
Node Version
10.16.0
Cumulative downloads
Total Downloads
Last day
0%
4
Compared to previous day
Last week
125%
9
Compared to previous week
Last month
137.5%
19
Compared to previous month
Last year
-37.5%
105
Compared to previous year
No dependencies detected.
Provides custom Image view for React Native that allows to perform pinch-to-zoom on images. Works on both iOS and Android.
This component uses PhotoDraweeView for Android and MWPhotobrowser on iOS.
1import PhotoView from 'react-native-photo-view';
Basics:
1<PhotoView 2 source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}} 3 minimumZoomScale={0.5} 4 maximumZoomScale={3} 5 androidScaleType="center" 6 onLoad={() => console.log("Image loaded!")} 7 style={{width: 300, height: 300}} />
Property | Type | Description |
---|---|---|
source | Object | same as source for other React images |
loadingIndicatorSource | Object | source for loading indicator |
fadeDuration | int | duration of image fade (in ms) |
minimumZoomScale | float | The minimum allowed zoom scale. The default value is 1.0 |
maximumZoomScale | float | The maximum allowed zoom scale. The default value is 3.0 |
showsHorizontalScrollIndicator | bool | iOS only: When true, shows a horizontal scroll indicator. The default value is true. |
showsVerticalScrollIndicator | bool | iOS only: When true, shows a vertical scroll indicator. The default value is true. |
scale | float | Set zoom scale programmatically |
androidZoomTransitionDuration | int | Android only: Double-tap zoom transition duration |
androidScaleType | String | Android only: One of the default Android scale types: "center", "centerCrop", "centerInside", "fitCenter", "fitStart", "fitEnd", "fitXY" |
onLoadStart | func | Callback function |
onLoad | func | Callback function |
onLoadEnd | func | Callback function |
onProgress | func | iOS only: Callback function, invoked on download progress with {nativeEvent: {loaded, total}}. |
onTap | func | Callback function (called on image tap) |
onViewTap | func | Callback function (called on tap outside of image) |
onScale | func | Callback function |
react-native-image-zoom functionality is similar, but there are several major differencies:
Just two simple steps:
npm install --save react-native-photo-view
rnpm link react-native-photo-view
android/settings.gradle
include ':react-native-photo-view'
project(':react-native-photo-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-photo-view/android')
android/app/build.gradle
dependencies {
compile project(':react-native-photo-view')
}
MainActivity.java
for RN < 0.29 and to your MainApplication.java
for RN >=0.29To register PhotoViewPackage
, you need to change the MainActivity
or MainApplication
depending on React Native version of your app:
1import com.reactnative.photoview.PhotoViewPackage; 2 3// ... 4 5public class MainActivity extends ReactActivity { 6 // ... 7 8 @Override 9 protected List<ReactPackage> getPackages() { 10 return Arrays.<ReactPackage>asList( 11 new MainReactPackage(), 12 new PhotoViewPackage() // add this manager 13 ); 14 } 15 16 // ... 17}
No vulnerabilities found.
No security vulnerabilities found.