Skip to content

Commit 80fab29

Browse files
author
Andrew Beckman
committed
add and document support for passing keyboardShouldPersistTaps prop to scroll view
1 parent cccca70 commit 80fab29

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ npm i react-native-sortable-list --save
3535
- **showsHorizontalScrollIndicator** (boolean) when false, the horizontal scroll indicator will not be visible. The default value is true.
3636
- **sortingEnabled?** (boolean) when false, rows are not sortable. The default value is true.
3737
- **scrollEnabled?** (boolean) when false, the content does not scrollable. The default value is true.
38+
- **keyboardShouldPersistTaps** (string)<br />
39+
Determines when the keyboard should stay visible after a tap.
40+
- 'never' (the default), tapping outside of the focused text input when the keyboard is up dismisses the keyboard. When this happens, children won't receive the tap.
41+
- 'always', the keyboard will not dismiss automatically, and the scroll view will not catch taps, but children of the scroll view can catch taps.
42+
- 'handled', the keyboard will not dismiss automatically when the tap was handled by a children, (or captured by an ancestor.<br/>
3843
- **manuallyActivateRows?** (bool) whether you intend to use the `toggleRowActive` method to activate a row or use the out of box solution.
3944
- **autoscrollAreaSize?** (number) determines the height for vertical list and the width for horizontal list of the area at the begining and the end of the list that will trigger autoscrolling. Defaults to 60.<br />
4045
- **rowActivationTime?** (number) determines time delay in ms before pressed row becomes active. Defaults to 200 ms.<br />

src/SortableList.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default class SortableList extends Component {
2929
autoscrollAreaSize: PropTypes.number,
3030
rowActivationTime: PropTypes.number,
3131
manuallyActivateRows: PropTypes.bool,
32+
keyboardShouldPersistTaps: PropTypes.oneOf(['never', 'always', 'handled']),
3233

3334
renderRow: PropTypes.func.isRequired,
3435
renderHeader: PropTypes.func,
@@ -42,6 +43,7 @@ export default class SortableList extends Component {
4243
static defaultProps = {
4344
sortingEnabled: true,
4445
scrollEnabled: true,
46+
keyboardShouldPersistTaps: 'never',
4547
autoscrollAreaSize: 60,
4648
manuallyActivateRows: false,
4749
showsVerticalScrollIndicator: true,
@@ -184,7 +186,7 @@ export default class SortableList extends Component {
184186
}
185187

186188
render() {
187-
let {contentContainerStyle, innerContainerStyle, horizontal, style, showsVerticalScrollIndicator, showsHorizontalScrollIndicator} = this.props;
189+
let {contentContainerStyle, innerContainerStyle, horizontal, style, showsVerticalScrollIndicator, showsHorizontalScrollIndicator, keyboardShouldPersistTaps} = this.props;
188190
const {animated, contentHeight, contentWidth, scrollEnabled} = this.state;
189191
const containerStyle = StyleSheet.flatten([style, {opacity: Number(animated)}])
190192
innerContainerStyle = [
@@ -209,6 +211,7 @@ export default class SortableList extends Component {
209211
contentContainerStyle={contentContainerStyle}
210212
scrollEventThrottle={2}
211213
scrollEnabled={scrollEnabled}
214+
keyboardShouldPersistTaps={keyboardShouldPersistTaps}
212215
showsHorizontalScrollIndicator={showsHorizontalScrollIndicator}
213216
showsVerticalScrollIndicator={showsVerticalScrollIndicator}
214217
onScroll={this._onScroll}>

0 commit comments

Comments
 (0)