Skip to content

Commit 364576c

Browse files
committed
Add contols prop to config prev & next buttons (#30 & #31), fix freezint (#27)
1 parent 8c2ed45 commit 364576c

10 files changed

Lines changed: 453 additions & 229 deletions

File tree

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ Try with expo: https://expo.io/@antonkalinin/react-native-image-view
1111

1212
## Installation
1313

14+
```bash
15+
yarn add react-native-image-view
16+
```
17+
18+
or
19+
1420
```bash
1521
npm install --save react-native-image-view
1622
```
@@ -59,6 +65,7 @@ Prop name | Description | Type | Default value | Platform |
5965
`isVisible` | Is modal shown or not | boolean | false |
6066
`onClose` | Function called on modal closed | function | none |
6167
`renderFooter` | Function returns a footer element | function | none |
68+
`controls` | Config of available controls (see below) | Object | {close: true} |
6269

6370
#### Image item:
6471

@@ -73,7 +80,19 @@ Prop name | Description | Type | Default value | Platform |
7380
7481
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.
7582
76-
### Next feature: Momentum scroll in zoom mode
83+
#### controls prop:
84+
85+
```js
86+
type ControlType = React.Component<{onPress: () => void}> | null | boolean,
87+
88+
{
89+
close: ControlType // Component for close button in up right corner, as onPress prop accepts function to close modal
90+
next: ControlType, // Component for next image button, as onPress prop accepts function to scroll to next image
91+
prev: ControlType, // Component for previous image button, as onPress prop accepts function to scroll to previous image
92+
}
93+
```
94+
95+
To use default components just set `{next: true, prev: true}`, close is showing by default. To create custom controls check src/controls.
7796
7897
### License
7998
[MIT](LICENSE)

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
"name": "react-native-image-view",
33
"version": "2.0.12",
44
"description": "React Native modal image view with pinch zoom",
5-
"main": "index.js",
5+
"main": "src/ImageView",
66
"scripts": {
7-
"test": "eslint index.js",
87
"flow": "flow",
98
"eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
109
"postversion": "git push origin master && git push --tags origin master"
@@ -43,8 +42,7 @@
4342
"files": [
4443
"package.json",
4544
"readme.md",
46-
"index.js",
47-
"types.js"
45+
"src"
4846
],
4947
"author": "Anton Kalinin",
5048
"license": "MIT",

0 commit comments

Comments
 (0)