Skip to content

Commit

Permalink
Included onLongPress event to ListItem compontent
Browse files Browse the repository at this point in the history
  • Loading branch information
Darlei Kroth committed Dec 18, 2017
1 parent 3f33d2b commit 3e00368
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions ListItem/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ type Props = {
* Called when the touch is released.
*/
onPress(fn: () => void): void;
/**
* Called when the long press is released.
*/
onLongPress(fn: () => void): void;
};

const ios = Platform.OS === 'ios';
Expand All @@ -92,13 +96,14 @@ class Item extends React.PureComponent
dividerStyle,
divider,
selectableBackground,
onPress
onPress,
onLongPress,
} = this.props;

return (
<View>
<View style={[styles.container, containerStyle]} >
<TouchableView onPress={onPress} background={selectableBackground} >
<TouchableView onPress={onPress} background={selectableBackground} onLongPress={onLongPress} >
<View style={[styles.content, contentStyle]} >

<View style={styles.icon} >
Expand Down
3 changes: 2 additions & 1 deletion ListItem/SimpleItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Props = {
titleStyle?: TextStyle;
subtitleStyle?: TextStyle;
onPress(fn: () => void): void;
onLongPress(fn: () => void): void;
};

const ios = Platform.OS === 'ios';
Expand All @@ -30,7 +31,7 @@ class SimpleItem extends React.PureComponent
{
return (
<View style={[styles.container, this.props.containerStyle]} >
<TouchableView onPress={this.props.onPress} >
<TouchableView onPress={this.props.onPress} onLongPress={this.props.onLongPress} >
<View style={[styles.content, this.props.contentStyle]} >
<Text numberOfLines={1} style={[styles.title, this.props.titleStyle]} >
{this.props.title}
Expand Down

0 comments on commit 3e00368

Please sign in to comment.