{"id":13486238,"url":"https://github.com/ascoders/react-native-image-viewer","last_synced_at":"2025-09-28T19:32:01.865Z","repository":{"id":43115354,"uuid":"68112216","full_name":"ascoders/react-native-image-viewer","owner":"ascoders","description":"🚀 tiny \u0026 fast lib for react native image viewer pan and zoom","archived":true,"fork":false,"pushed_at":"2021-09-20T21:30:31.000Z","size":2498,"stargazers_count":2448,"open_issues_count":195,"forks_count":582,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-01-15T15:33:19.808Z","etag":null,"topics":["image-viewer","react-component","react-native"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ascoders.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-09-13T13:43:44.000Z","updated_at":"2025-01-10T07:23:50.000Z","dependencies_parsed_at":"2022-09-12T15:24:18.642Z","dependency_job_id":null,"html_url":"https://github.com/ascoders/react-native-image-viewer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ascoders%2Freact-native-image-viewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ascoders%2Freact-native-image-viewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ascoders%2Freact-native-image-viewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ascoders%2Freact-native-image-viewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ascoders","download_url":"https://codeload.github.com/ascoders/react-native-image-viewer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234555933,"owners_count":18851875,"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":["image-viewer","react-component","react-native"],"created_at":"2024-07-31T18:00:42.242Z","updated_at":"2025-09-28T19:32:01.452Z","avatar_url":"https://github.com/ascoders.png","language":"TypeScript","funding_links":[],"categories":["Libraries","Components","TypeScript"],"sub_categories":["Releases","Viewer/Swiper/Carousel"],"readme":"## Show Cases\n\n**Swiper image**\n\n![](https://cloud.githubusercontent.com/assets/7970947/21086300/388dedfc-c056-11e6-955e-0a2a0b541f7f.gif)\n\n**Zoom while sliding**\n\n![](https://cloud.githubusercontent.com/assets/7970947/21086323/7355face-c056-11e6-8d68-384000d41d47.gif)\n\n**Swipe down**\n\n![](https://user-images.githubusercontent.com/7970947/37651584-8b642458-2c73-11e8-9ecc-ef7c72aca1be.gif)\n\n## Getting Started\n\n### Installation\n\n```bash\nnpm i react-native-image-zoom-viewer --save\n```\n\n### Basic Usage\n\n- Install create-react-native-app first\n\n```bash\n$ npm install -g create-react-native-app\n```\n\n- Initialization of a react-native project\n\n```bash\n$ create-react-native-app AwesomeProject\n```\n\n- Then, edit `AwesomeProject/App.js`, like this:\n\n```typescript\nimport { Modal } from 'react-native';\nimport ImageViewer from 'react-native-image-zoom-viewer';\n\nconst images = [{\n    // Simplest usage.\n    url: 'https://avatars2.githubusercontent.com/u/7970947?v=3\u0026s=460',\n\n    // width: number\n    // height: number\n    // Optional, if you know the image size, you can set the optimization performance\n\n    // You can pass props to \u003cImage /\u003e.\n    props: {\n        // headers: ...\n    }\n}, {\n    url: '',\n    props: {\n        // Or you can set source directory.\n        source: require('../background.png')\n    }\n}]\n\nexport default class App extends React.Component {\n    render: function() {\n        return (\n            \u003cModal visible={true} transparent={true}\u003e\n                \u003cImageViewer imageUrls={images}/\u003e\n            \u003c/Modal\u003e\n        )\n    }\n}\n```\n\n### Props\n\n| parameter              | type                                                                                   | required | description                                                                                                                                                                                                                          | default                                                   |\n| :--------------------- | :------------------------------------------------------------------------------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- |\n| imageUrls              | array                                                                                  | yes      | Image Source                                                                                                                                                                                                                         |                                                           |\n| enableImageZoom        | boolean                                                                                | no       | Enable image zoom                                                                                                                                                                                                                    | `true`                                                    |\n| onShowModal            | function\u003cbr\u003e\u003cbr\u003e`(content?: JSX.Element) =\u003e void`                                      | no       | The callback for show modal                                                                                                                                                                                                          | `() =\u003e {}`                                                |\n| onCancel               | function\u003cbr\u003e\u003cbr\u003e`() =\u003e void`                                                           | no       | The callback for cancel modal                                                                                                                                                                                                        | `() =\u003e {}`                                                |\n| flipThreshold          | number                                                                                 | no       | Swipe threshold of the next page                                                                                                                                                                                                     | `80`                                                      |\n| maxOverflow            | number                                                                                 | no       | The X position maximum, that current page can slide to the next page                                                                                                                                                                 | `300`                                                     |\n| index                  | number                                                                                 | no       | Init index of images                                                                                                                                                                                                                 | `0`                                                       |\n| failImageSource        | string, object\u003cbr\u003e\u003cbr\u003e`{url: string}`                                                  | no       | placeholder for fail                                                                                                                                                                                                                 | `''`                                                      |\n| loadingRender          | function\u003cbr\u003e\u003cbr\u003e`() =\u003e React.ReactElement\u003cany\u003e`                                        | no       | placeholder for loading                                                                                                                                                                                                              | `() =\u003e null`                                              |\n| onSaveToCamera         | function\u003cbr\u003e\u003cbr\u003e`(index?: number =\u003e void`                                              | no       | The callback for save to camera                                                                                                                                                                                                      | `() =\u003e {}`                                                |\n| onChange               | function\u003cbr\u003e\u003cbr\u003e`(index?: number =\u003e void`                                              | no       | When the image changed                                                                                                                                                                                                               | `() =\u003e {}`                                                |\n| onMove                 | ( position: [IOnMove](https://github.com/ascoders/react-native-image-zoom/blob/master/src/image-zoom/image-zoom.type.ts) )=\u003evoid | reports movement position data (helpful to build overlays)                                                                                                            | ()=\u003e {}      |\n| saveToLocalByLongPress | boolean                                                                                | no       | Enable save to camera when long press                                                                                                                                                                                                | `true`                                                    |\n| onClick                | function\u003cbr\u003e\u003cbr\u003e`(onCancel?: function) =\u003e void`                                        | no       | Onclick                                                                                                                                                                                                                              | `(onCancel) =\u003e {onCancel()}`                              |\n| onDoubleClick          | function\u003cbr\u003e\u003cbr\u003e`(onCancel?: function) =\u003e void`                                        | no       | OnDoubleClick                                                                                                                                                                                                                        | `(onCancel) =\u003e {onCancel()}`                              |\n| onSave                 | function\u003cbr\u003e\u003cbr\u003e`(url: string) =\u003e void`                                                | no       | The picture is saved to the local method, if you write this method will not call the system default method for Android does not support saveToCameraRoll remote picture, you can call this callback in Android call native interface |                                                           |\n| renderHeader           | function\u003cbr\u003e\u003cbr\u003e`(currentIndex?: number) =\u003e React.ReactElement\u003cany\u003e`                   | no       | Custom header                                                                                                                                                                                                                        | `() =\u003e null`                                              |\n| renderFooter           | function\u003cbr\u003e\u003cbr\u003e`(currentIndex?: number) =\u003e React.ReactElement\u003cany\u003e`                   | no       | Custom footer                                                                                                                                                                                                                        | `() =\u003e null`                                              |\n| renderIndicator        | function\u003cbr\u003e\u003cbr\u003e`(currentIndex?: number, allSize?) =\u003e React.ReactElement\u003cany\u003e`: number | no       | Custom indicator                                                                                                                                                                                                                     | `(currentIndex, allSize) =\u003e currentIndex + \"/\" + allSize` |\n| renderImage            | function\u003cbr\u003e\u003cbr\u003e`(props: any) =\u003e React.ReactElement\u003cany\u003e`                              | no       | Custom image component                                                                                                                                                                                                               | `(props) =\u003e \u003cImage {...props} /\u003e`                         |\n| renderArrowLeft        | function\u003cbr\u003e\u003cbr\u003e`() =\u003e React.ReactElement\u003cany\u003e`                                        | no       | Custom left arrow                                                                                                                                                                                                                    | `() =\u003e null`                                              |\n| renderArrowRight       | function\u003cbr\u003e\u003cbr\u003e`() =\u003e React.ReactElement\u003cany\u003e`                                        | no       | Custom right arrow                                                                                                                                                                                                                   | `() =\u003e null`                                              |\n| onSwipeDown            | function\u003cbr\u003e\u003cbr\u003e`() =\u003e void`                                                           | no       | Callback for swipe down                                                                                                                                                                                                              | `() =\u003e null`                                              |\n| footerContainerStyle   | object\u003cbr\u003e\u003cbr\u003e`{someStyle: someValue}`                                                 | no       | custom style props for container that will be holding your footer that you pass                                                                                                                                                      | `bottom: 0, position: \"absolute\", zIndex: 9999`           |\n| backgroundColor        | string\u003cbr\u003e\u003cbr\u003e`white`                                                                  | no       | Component background color                                                                                                                                                                                                           | `black`                                                   |\n| enableSwipeDown        | boolean                                                                                | no       | Enable swipe down to close image viewer. When swipe down, will trigger onCancel.                                                                                                                                                     | `false`                                                   |\n| swipeDownThreshold     | number                                                                                 | no       | Threshold for firing swipe down function                                                                                                                                                                                             |                                                           |\n| doubleClickInterval    | number                                                                                 | no       | Double click interval.                                                                                                                                                                                                               |                                                           |\n| pageAnimateTime        | number                                                                                 | no       | Set the animation time for page flipping.                                                                                                                                                                                            | `100`                                                     |\n| enablePreload          | boolean                                                                                | no       | Preload the next image                                                                                                                                                                                                               | `false`                                                   |\n| useNativeDriver        | boolean                                                                                | no       | Whether to animate using [`useNativeDriver`](https://reactnative.dev/docs/animations#using-the-native-driver)                                                                                                                        | `false`                                                   |\n| menus                  | function\u003cbr\u003e\u003cbr\u003e`({cancel,saveToLocal}) =\u003e React.ReactElement\u003cany\u003e`                    | no       | Custom menus, with 2 methods:`cancel` to hide menus and `saveToLocal` to save image to camera\n| menuContext            | object\u003cbr\u003e\u003cbr\u003e`{someKey: someValue}`                                                   | no       | Custom menu context.                              | `{ saveToLocal: 'save to the album', cancel: 'cancel' }`\n## Development pattern\n\n### Step 1, run TS listener\n\nAfter clone this repo, then:\n\n```bash\nnpm install\nnpm start\n```\n\n### Step 2, run demo\n\n```bash\ncd demo\nnpm install\nnpm start\n```\n\nThen, scan the QR, use your [expo app](https://expo.io./).\n\n### Dependence\n\nDepend on `react-native-image-pan-zoom`: https://github.com/ascoders/react-native-image-zoom\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fascoders%2Freact-native-image-viewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fascoders%2Freact-native-image-viewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fascoders%2Freact-native-image-viewer/lists"}