Skip to content

Commit

Permalink
Add longPress support to ListItem and amend ListItemProps (ant-design…
Browse files Browse the repository at this point in the history
  • Loading branch information
nodece authored and BANG88 committed Aug 27, 2019
1 parent fa8fc35 commit 3e968df
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions components/list/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Image, StyleProp, StyleSheet, Text, TouchableHighlight, View, ViewStyle } from 'react-native';
import { GestureResponderEvent, Image, StyleProp, StyleSheet, Text, TouchableHighlight, View, ViewStyle } from 'react-native';
import Icon from '../icon';
import { WithTheme, WithThemeStyles } from '../style';
import { BriefProps as BriefBasePropsType, ListItemPropsType } from './PropsType';
Expand All @@ -8,9 +8,11 @@ import ListStyles, { ListStyle } from './style/index';
export interface ListItemProps
extends ListItemPropsType,
WithThemeStyles<ListStyle> {
onPress?: () => void;
onPressIn?: () => void;
onPressOut?: () => void;
onPress?: (event: GestureResponderEvent) => void;
onPressIn?: (event: GestureResponderEvent) => void;
onPressOut?: (event: GestureResponderEvent) => void;
delayLongPress?: number;
onLongPress?: (event: GestureResponderEvent) => void;
style?: StyleProp<ViewStyle>;
}

Expand Down Expand Up @@ -47,6 +49,8 @@ export default class Item extends React.Component<ListItemProps, any> {
static defaultProps: Partial<ListItemProps> = {
multipleLine: false,
wrap: false,
delayLongPress: 500,
onLongPress: () => {},
};
static Brief = Brief;
render() {
Expand All @@ -61,6 +65,8 @@ export default class Item extends React.Component<ListItemProps, any> {
onPress,
onPressIn,
onPressOut,
onLongPress,
delayLongPress,
wrap,
disabled,
align,
Expand Down Expand Up @@ -221,6 +227,8 @@ export default class Item extends React.Component<ListItemProps, any> {
}
onPressIn={onPressIn}
onPressOut={onPressOut}
onLongPress={onLongPress}
delayLongPress={delayLongPress}
>
{itemView}
</TouchableHighlight>
Expand Down

0 comments on commit 3e968df

Please sign in to comment.