{"id":13776739,"url":"https://github.com/alwx/react-native-photo-view","last_synced_at":"2025-05-15T07:07:30.501Z","repository":{"id":39974665,"uuid":"61401920","full_name":"alwx/react-native-photo-view","owner":"alwx","description":"Pinch-to-zoom view for React Native (both iOS and Android)","archived":false,"fork":false,"pushed_at":"2022-11-21T07:57:02.000Z","size":223,"stargazers_count":819,"open_issues_count":122,"forks_count":435,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-10T05:38:31.530Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alwx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-17T20:57:51.000Z","updated_at":"2025-05-03T11:37:34.000Z","dependencies_parsed_at":"2022-08-27T00:10:29.128Z","dependency_job_id":null,"html_url":"https://github.com/alwx/react-native-photo-view","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwx%2Freact-native-photo-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwx%2Freact-native-photo-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwx%2Freact-native-photo-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwx%2Freact-native-photo-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alwx","download_url":"https://codeload.github.com/alwx/react-native-photo-view/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292043,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:00:32.337Z","updated_at":"2025-05-15T07:07:25.452Z","avatar_url":"https://github.com/alwx.png","language":"Objective-C","funding_links":[],"categories":["\u003ca name=\"Image-\u0026-Audio-\u0026-Video-\u0026-Docs:-Native-Modules\"\u003eImage, Audio, Video \u0026 Docs: Native Modules\u003c/a\u003e"],"sub_categories":[],"readme":"# react-native-photo-view\n\nProvides custom Image view for React Native that allows to perform\npinch-to-zoom on images. Works on both iOS and Android.\n\nThis component uses [PhotoDraweeView](https://github.com/ongakuer/PhotoDraweeView) for Android and [MWPhotobrowser](https://github.com/mwaterfall/MWPhotoBrowser) on iOS.\n\n## Usage\n\n```javascript\nimport PhotoView from 'react-native-photo-view';\n```\n\nBasics:\n```javascript\n\u003cPhotoView\n  source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}}\n  minimumZoomScale={0.5}\n  maximumZoomScale={3}\n  androidScaleType=\"center\"\n  onLoad={() =\u003e console.log(\"Image loaded!\")}\n  style={{width: 300, height: 300}} /\u003e\n```\n\n## Properties\n\n| Property | Type | Description |\n|-----------------|----------|--------------------------------------------------------------|\n| source | Object | same as source for other React images |\n| loadingIndicatorSource | Object | source for loading indicator |\n| fadeDuration | int | duration of image fade (in ms) |\n| minimumZoomScale | float | The minimum allowed zoom scale. The default value is 1.0 |\n| maximumZoomScale | float | The maximum allowed zoom scale. The default value is 3.0 |\n| showsHorizontalScrollIndicator | bool | **iOS only**: When true, shows a horizontal scroll indicator. The default value is true. |\n| showsVerticalScrollIndicator | bool | **iOS only**: When true, shows a vertical scroll indicator. The default value is true. |\n| scale | float | Set zoom scale programmatically |\nandroidZoomTransitionDuration | int | **Android only**: Double-tap zoom transition duration |\n| androidScaleType | String | **Android only**: One of the default *Android* scale types: \"center\", \"centerCrop\", \"centerInside\", \"fitCenter\", \"fitStart\", \"fitEnd\", \"fitXY\" |\n| onLoadStart | func | Callback function |\n| onLoad | func | Callback function |\n| onLoadEnd | func | Callback function |\n| onProgress | func | **iOS only**: Callback function, invoked on download progress with {nativeEvent: {loaded, total}}. |\n| onTap | func | Callback function (called on image tap) |\n| onViewTap | func | Callback function (called on tap outside of image) |\n| onScale | func | Callback function |\n\n## Compared to [react-native-image-zoom](https://github.com/Anthonyzou/react-native-image-zoom)\n\nreact-native-image-zoom functionality is similar, but there are several major differencies:\n\n* PhotoView is based on PhotoDraweeView which is the \"PhotoView For Fresco\". It works better, it supports several\nimportant callbacks out-of-box and it is, actually, recommended by Chris Banes, because his\n[PhotoView](https://github.com/chrisbanes/PhotoView) (base for react-native-image-zoom) doesn't completely\nsupport Facebook Fresco;\n* PhotoView has more options like fadeDuration and minimumZoomScale/maximumZoomScale and more important callbacks;\n* PhotoView is written in the same manner as default React Image, and it supports most of the\nfeatures Image has (the goal is to be fully compaitable with Image and support absolutely everything);\n* It is possible to use PhotoView as a container (currently iOS only)!\n\n## Automatic installation\n\nJust two simple steps:\n\n```console\nnpm install --save react-native-photo-view\n```\n\n```console\nreact-native link react-native-photo-view\n```\n\n## Manual installation\n\n\n### Android\n1. Add these lines to `android/settings.gradle`\n```\ninclude ':react-native-photo-view'\nproject(':react-native-photo-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-photo-view/android')\n```\n\n2. Add one more dependency to `android/app/build.gradle`\n```\ndependencies {\n    compile project(':react-native-photo-view')\n}\n```\n\n3. Add it to your `MainActivity.java` for RN \u003c 0.29 and to your `MainApplication.java` for RN \u003e=0.29\n\nTo register `PhotoViewPackage`, you need to change the `MainActivity` or `MainApplication` depending on React Native version of your app:\n```java\nimport com.reactnative.photoview.PhotoViewPackage;\n\n// ...\n\npublic class MainActivity extends ReactActivity {\n    // ...\n\n    @Override\n    protected List\u003cReactPackage\u003e getPackages() {\n      return Arrays.\u003cReactPackage\u003easList(\n          new MainReactPackage(),\n          new PhotoViewPackage() // add this manager\n      );\n    }\n\n    // ...\n}\n```\n\n### IOS\n1. Add this line to your podfile\n```\n  pod 'react-native-photo-view', path: './node_modules/react-native-photo-view'\n```\n\n2. Run `pod install`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falwx%2Freact-native-photo-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falwx%2Freact-native-photo-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falwx%2Freact-native-photo-view/lists"}