Skip to content
This repository was archived by the owner on Sep 28, 2021. It is now read-only.

Commit ae8e63b

Browse files
authored
Merge pull request #307 from React-Sextant/master
Prohibit any panResponder when longPress to show menu
2 parents cdfbf8a + 6900d38 commit ae8e63b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default class App extends React.Component {
105105
| doubleClickInterval | number | no | Double click interval. | |
106106
| pageAnimateTime | number | no | Set the animation time for page flipping. | `100` |
107107
| enablePreload | boolean | no | Preload the next image | `false` |
108-
108+
| menus | function<br><br>`({cancel,saveToLocal}) => React.ReactElement<any>` | no | Custom menus, with 2 methods:`cancel` to hide menus and `saveToLocal` to save image to camera
109109
## Development pattern
110110

111111
### Step 1, run TS listener

src/image-viewer.component.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,9 @@ export default class ImageViewer extends React.Component<Props, State> {
547547
enableSwipeDown={this.props.enableSwipeDown}
548548
swipeDownThreshold={this.props.swipeDownThreshold}
549549
onSwipeDown={this.handleSwipeDown}
550-
pinchToZoom={this.props.enableImageZoom}
551-
enableDoubleClickZoom={this.props.enableImageZoom}
550+
panToMove={!this.state.isShowMenu}
551+
pinchToZoom={this.props.enableImageZoom&&!this.state.isShowMenu}
552+
enableDoubleClickZoom={this.props.enableImageZoom&&!this.state.isShowMenu}
552553
doubleClickInterval={this.props.doubleClickInterval}
553554
>
554555
{this!.props!.renderImage!(image.props)}
@@ -641,6 +642,14 @@ export default class ImageViewer extends React.Component<Props, State> {
641642
return null;
642643
}
643644

645+
if(this.props.menus) {
646+
return (
647+
<View style={this.styles.menuContainer}>
648+
{this.props.menus({cancel:this.handleLeaveMenu,saveToLocal:this.saveToLocal})}
649+
</View>
650+
)
651+
}
652+
644653
return (
645654
<View style={this.styles.menuContainer}>
646655
<View style={this.styles.menuShadow} />

0 commit comments

Comments
 (0)