Skip to content

Commit 937be0a

Browse files
committed
1 parent b150406 commit 937be0a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Examples/BouncesAndScrollEnabledExample.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* @Author: 石破天惊
3+
* @email: shanshang130@gmail.com
4+
* @Date: 2021-07-21 13:05:32
5+
* @LastEditTime: 2021-09-18 10:39:36
6+
* @LastEditors: 石破天惊
7+
* @Description:
8+
*/
19
/*
210
*
311
* Created by Stone
@@ -13,7 +21,7 @@ import {SpringScrollView} from '../src';
1321

1422
export class BouncesAndScrollEnabledExample extends React.Component {
1523
state = {
16-
contentCount: 20,
24+
contentCount: 100,
1725
bounces: true,
1826
scrollEnabled: true,
1927
showsVerticalScrollIndicator: true,
@@ -33,7 +41,7 @@ export class BouncesAndScrollEnabledExample extends React.Component {
3341
key={index}
3442
onPress={() => {
3543
this.setState((p) => ({
36-
contentCount: p.contentCount === 1 ? 20 : 1,
44+
contentCount: p.contentCount === 1 ? 100 : 1,
3745
}));
3846
}}>
3947
<Text style={styles.text}>

src/SpringScrollView.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class SpringScrollView extends React.PureComponent<SpringScrollViewPropTy
5050
_scrollEventAttachment;
5151
_nativeOffset;
5252
_touching = false;
53+
_dragging = false;
5354
_sizeChangeInterval = 0;
5455

5556
constructor(props) {
@@ -95,6 +96,7 @@ export class SpringScrollView extends React.PureComponent<SpringScrollViewPropTy
9596
onScrollBeginDrag={this._onScrollBeginDrag}
9697
onMomentumScrollEnd={this._onMomentumScrollEnd}
9798
scrollEventThrottle={1}
99+
onStartShouldSetResponderCapture={() => this._dragging}
98100
>
99101
<SpringScrollContentViewNative
100102
style={contentStyle}
@@ -557,11 +559,13 @@ export class SpringScrollView extends React.PureComponent<SpringScrollViewPropTy
557559

558560
_onMomentumScrollEnd = () => {
559561
this._touching = false;
562+
this._dragging = false;
560563
this._beginIndicatorDismissAnimation();
561564
this.props.onMomentumScrollEnd && this.props.onMomentumScrollEnd();
562565
};
563566

564567
_onScrollBeginDrag = () => {
568+
this._dragging = true;
565569
if (this.props.dragToHideKeyboard) Keyboard.dismiss();
566570
this.props.onScrollBeginDrag && this.props.onScrollBeginDrag();
567571
};

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-spring-scrollview",
3-
"version": "3.0.1-rc.5",
3+
"version": "3.0.2",
44
"description": "A cross-platform (iOS & Android) spring ScrollView",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)