Skip to content

Commit 208ef32

Browse files
authored
Merge pull request #29 from gfontenot/gf-disabled-children
Allow children to mark themselves as inactive
2 parents d177a1d + 1a18d7d commit 208ef32

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ import SortableGrid from 'react-native-sortable-grid'
114114

115115
Function that is executed when the block is double tapped within a timeframe of ```doubleTapTreshold``` (default 150ms). Assigning this will delay the execution of ```onTap```. Omitting this will cause all taps to be handled as single taps, regardless of their frequency.
116116

117+
- ``` inactive ``` **Boolean**
118+
119+
Flag to mark a child node as being inactive. If set, no touch events will be fired when users interact with the node.
117120

118121
## onDragRelease return value looks like this:
119122

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class Block extends Component {
2929
<TouchableWithoutFeedback
3030
style = {{ flex: 1 }}
3131
delayLongPress = { this.props.delayLongPress }
32-
onLongPress = { this.props.onLongPress }
33-
onPress = { this.props.onPress }>
32+
onLongPress = { () => this.props.inactive || this.props.onLongPress() }
33+
onPress = { () => this.props.inactive || this.props.onPress() }>
3434

3535
<View style={styles.itemImageContainer}>
3636
<View style={ this.props.itemWrapperStyle }>
@@ -63,6 +63,7 @@ class SortableGrid extends Component {
6363
onPress = { this.handleTap(item.props) }
6464
itemWrapperStyle = { this._getItemWrapperStyle(key) }
6565
deletionView = { this._getDeletionView(key) }
66+
inactive = { item.props.inactive }
6667
>
6768
{item}
6869
</Block>

0 commit comments

Comments
 (0)