Skip to content

Commit 1fec574

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

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,
@@ -192,7 +194,7 @@ export default class SortableList extends Component {
192194
}
193195

194196
render() {
195-
let {contentContainerStyle, innerContainerStyle, horizontal, style, showsVerticalScrollIndicator, showsHorizontalScrollIndicator} = this.props;
197+
let {contentContainerStyle, innerContainerStyle, horizontal, style, showsVerticalScrollIndicator, showsHorizontalScrollIndicator, keyboardShouldPersistTaps} = this.props;
196198
const {animated, contentHeight, contentWidth, scrollEnabled} = this.state;
197199
const containerStyle = StyleSheet.flatten([style, {opacity: Number(animated)}])
198200
innerContainerStyle = [
@@ -217,6 +219,7 @@ export default class SortableList extends Component {
217219
contentContainerStyle={contentContainerStyle}
218220
scrollEventThrottle={2}
219221
scrollEnabled={scrollEnabled}
222+
keyboardShouldPersistTaps={keyboardShouldPersistTaps}
220223
showsHorizontalScrollIndicator={showsHorizontalScrollIndicator}
221224
showsVerticalScrollIndicator={showsVerticalScrollIndicator}
222225
onScroll={this._onScroll}>

0 commit comments

Comments
 (0)