Skip to content

Commit 6900d38

Browse files
committed
Add custom menus component
1 parent 84e338c commit 6900d38

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: README.md

+1-1
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

Diff for: src/image-viewer.component.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,14 @@ export default class ImageViewer extends React.Component<Props, State> {
642642
return null;
643643
}
644644

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+
645653
return (
646654
<View style={this.styles.menuContainer}>
647655
<View style={this.styles.menuShadow} />

0 commit comments

Comments
 (0)