1
1
import React , { Component } from 'react' ;
2
2
import PropTypes from 'prop-types'
3
- import { StyleSheet , Image , Text , View , UIManager , findNodeHandle } from 'react-native' ;
3
+ import { StyleSheet , Image , Text , View , Platform , ActionSheetIOS , UIManager , findNodeHandle } from 'react-native' ;
4
4
import { MoreButton } from './Buttons'
5
5
6
6
const styles = StyleSheet . create ( {
@@ -57,7 +57,7 @@ export class NoteListItem extends Component {
57
57
onNavigateNote : PropTypes . func ,
58
58
}
59
59
60
- onPressMenu = ( e , index ) => {
60
+ onPressMenu = index => {
61
61
const { note, onNavigateNote, onRemoveNote } = this . props
62
62
switch ( index ) {
63
63
case 0 :
@@ -68,12 +68,13 @@ export class NoteListItem extends Component {
68
68
}
69
69
70
70
onOpenMenu = ( ) => {
71
- UIManager . showPopupMenu (
72
- findNodeHandle ( this . _buttonRef ) ,
73
- [ 'Edit' , 'Delete' ] ,
74
- ( e ) => console . error ( e ) ,
75
- this . onPressMenu
76
- )
71
+ const button = findNodeHandle ( this . _buttonRef )
72
+ const options = [ 'Edit' , 'Delete' ]
73
+
74
+ Platform . select ( {
75
+ ios : ActionSheetIOS . showActionSheetWithOptions ( options , this . onPressMenu ) ,
76
+ android : UIManager . showPopupMenu ( button , options , ( e ) => console . error ( e ) , ( e , i ) => this . onPressMenu ( i ) )
77
+ } )
77
78
}
78
79
79
80
render ( ) {
0 commit comments