{"_id":"@campminderjd/react-native-image-zoom-viewer","name":"@campminderjd/react-native-image-zoom-viewer","dist-tags":{"latest":"2.2.27"},"versions":{"2.2.27":{"name":"@campminderjd/react-native-image-zoom-viewer","version":"2.2.27","description":"react native image viewer,大图浏览","main":"built/index.js","types":"built/index.d.ts","scripts":{"prepare":"rm -rf built && tsc","start":"tsc -w --outDir demo/built"},"keywords":["image-viewer"],"author":{"name":"ascoders"},"license":"MIT","dependencies":{"react-native-image-pan-zoom":"^2.1.9"},"peerDependencies":{"react":"*","react-native":"*"},"devDependencies":{"@types/react":"*","@types/react-native":"*","ascoders-tslint-config":"^1.0.2","react":"*","react-native":"*","tslint":"^5.8.0","tslint-config-prettier":"^1.13.0","typescript":"^2.9.2"},"_id":"@campminderjd/react-native-image-zoom-viewer@2.2.27","gitHead":"9cea7c093010e3c023902a383a62427e8927011c","_nodeVersion":"21.1.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-dOM+Nph9Ss2hWHaxdVHyJgT22jGcwqBLYAsNInAhuWPfDmYorquayhUWR3+tWR2R0HqK3Hiw7sedW/4lzn/J/Q==","shasum":"11ab79d004d5c6ab968508a68bc7ab8fdfa5ece8","tarball":"https://registry.npmjs.org/@campminderjd/react-native-image-zoom-viewer/-/react-native-image-zoom-viewer-2.2.27.tgz","fileCount":24,"unpackedSize":109393,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD3RTEfjas5u6UgZXHcqYaj5P0lvZvq88VgEu2uLwlHKAIhAP3n9mw1PS8T+DJd2g2y9zYXhtr+T3lz4NG1r4kV4oQf"}]},"_npmUser":{"name":"campminderjd","email":"jeremy@campminder.com"},"directories":{},"maintainers":[{"name":"campminderjd","email":"jeremy@campminder.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-image-zoom-viewer_2.2.27_1709074409020_0.6398124057292733"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-27T22:53:28.922Z","2.2.27":"2024-02-27T22:53:29.165Z","modified":"2024-02-27T22:53:29.927Z"},"maintainers":[{"name":"campminderjd","email":"jeremy@campminder.com"}],"description":"react native image viewer,大图浏览","keywords":["image-viewer"],"author":{"name":"ascoders"},"license":"MIT","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&s=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 <Image />.\n    props: {\n        // headers: ...\n    }\n}, {\n    props: {\n        // Or you can set source directory.\n        url: '',\n        source: require('../background.png')\n    }\n}]\n\nexport default class App extends React.Component {\n    render: function() {\n        return (\n            <Modal visible={true} transparent={true}>\n                <ImageViewer imageUrls={images}/>\n            </Modal>\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<br><br>`(content?: JSX.Element) => void`                                      | no       | The callback for show modal                                                                                                                                                                                                          | `() => {}`                                                |\n| onCancel               | function<br><br>`() => void`                                                           | no       | The callback for cancel modal                                                                                                                                                                                                        | `() => {}`                                                |\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<br><br>`{uri: string}`                                                  | no       | placeholder for fail                                                                                                                                                                                                                 | `''`                                                      |\n| loadingRender          | function<br><br>`() => React.ReactElement<any>`                                        | no       | placeholder for loading                                                                                                                                                                                                              | `() => null`                                              |\n| onSaveToCamera         | function<br><br>`(index?: number => void`                                              | no       | The callback for save to camera                                                                                                                                                                                                      | `() => {}`                                                |\n| onChange               | function<br><br>`(index?: number => void`                                              | no       | When the image changed                                                                                                                                                                                                               | `() => {}`                                                |\n| onMove                 | ( position: [IOnMove](https://github.com/ascoders/react-native-image-zoom/blob/master/src/image-zoom/image-zoom.type.ts) )=>void | reports movement position data (helpful to build overlays)                                                                                                            | ()=> {}      |\n| saveToLocalByLongPress | boolean                                                                                | no       | Enable save to camera when long press                                                                                                                                                                                                | `true`                                                    |\n| onClick                | function<br><br>`(onCancel?: function) => void`                                        | no       | Onclick                                                                                                                                                                                                                              | `(onCancel) => {onCancel()}`                              |\n| onDoubleClick          | function<br><br>`(onCancel?: function) => void`                                        | no       | OnDoubleClick                                                                                                                                                                                                                        | `(onCancel) => {onCancel()}`                              |\n| onSave                 | function<br><br>`(url: string) => 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<br><br>`(currentIndex?: number) => React.ReactElement<any>`                   | no       | Custom header                                                                                                                                                                                                                        | `() => null`                                              |\n| renderFooter           | function<br><br>`(currentIndex?: number) => React.ReactElement<any>`                   | no       | Custom footer                                                                                                                                                                                                                        | `() => null`                                              |\n| renderIndicator        | function<br><br>`(currentIndex?: number, allSize?) => React.ReactElement<any>`: number | no       | Custom indicator                                                                                                                                                                                                                     | `(currentIndex, allSize) => currentIndex + \"/\" + allSize` |\n| renderImage            | function<br><br>`(props: any) => React.ReactElement<any>`                              | no       | Custom image component                                                                                                                                                                                                               | `(props) => <Image {...props} />`                         |\n| renderArrowLeft        | function<br><br>`() => React.ReactElement<any>`                                        | no       | Custom left arrow                                                                                                                                                                                                                    | `() => null`                                              |\n| renderArrowRight       | function<br><br>`() => React.ReactElement<any>`                                        | no       | Custom right arrow                                                                                                                                                                                                                   | `() => null`                                              |\n| onSwipeDown            | function<br><br>`() => void`                                                           | no       | Callback for swipe down                                                                                                                                                                                                              | `() => null`                                              |\n| footerContainerStyle   | object<br><br>`{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<br><br>`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\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","readmeFilename":"README.md"}