Skip to content

Commit

Permalink
Add contols prop to config prev & next buttons (#30 & #31), fix freez…
Browse files Browse the repository at this point in the history
…int (#27)
  • Loading branch information
antonKalinin committed Nov 19, 2018
1 parent 8c2ed45 commit 364576c
Show file tree
Hide file tree
Showing 10 changed files with 453 additions and 229 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Try with expo: https://expo.io/@antonkalinin/react-native-image-view

## Installation

```bash
yarn add react-native-image-view
```

or

```bash
npm install --save react-native-image-view
```
Expand Down Expand Up @@ -59,6 +65,7 @@ Prop name | Description | Type | Default value | Platform |
`isVisible` | Is modal shown or not | boolean | false |
`onClose` | Function called on modal closed | function | none |
`renderFooter` | Function returns a footer element | function | none |
`controls` | Config of available controls (see below) | Object | {close: true} |

#### Image item:

Expand All @@ -73,7 +80,19 @@ Prop name | Description | Type | Default value | Platform |
It's recommended to specify width and height to speed up rendering, overwise component needs to fetch images sizes and cache them in images objects passed as props.
### Next feature: Momentum scroll in zoom mode
#### controls prop:
```js
type ControlType = React.Component<{onPress: () => void}> | null | boolean,

{
close: ControlType // Component for close button in up right corner, as onPress prop accepts function to close modal
next: ControlType, // Component for next image button, as onPress prop accepts function to scroll to next image
prev: ControlType, // Component for previous image button, as onPress prop accepts function to scroll to previous image
}
```
To use default components just set `{next: true, prev: true}`, close is showing by default. To create custom controls check src/controls.
### License
[MIT](LICENSE)
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"name": "react-native-image-view",
"version": "2.0.12",
"description": "React Native modal image view with pinch zoom",
"main": "index.js",
"main": "src/ImageView",
"scripts": {
"test": "eslint index.js",
"flow": "flow",
"eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
"postversion": "git push origin master && git push --tags origin master"
Expand Down Expand Up @@ -43,8 +42,7 @@
"files": [
"package.json",
"readme.md",
"index.js",
"types.js"
"src"
],
"author": "Anton Kalinin",
"license": "MIT",
Expand Down
Loading

0 comments on commit 364576c

Please sign in to comment.