File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 88 UIManager ,
99 NativeModules ,
1010 Platform ,
11+ PanResponder ,
1112} from 'react-native' ;
1213import ClassicsHeader from "./ClassicsHeader" ;
1314import { ViewPropTypes , PropTypes } from './Util'
@@ -43,6 +44,16 @@ class SmartRefreshControl extends Component {
4344
4445 return findNodeHandle ( this . refs . refreshLayout ) ;
4546 }
47+ componentWillMount ( ) {
48+ this . _panResponder = PanResponder . create ( {
49+ onMoveShouldSetPanResponderCapture : ( evt , gestureState ) => {
50+ if ( Math . abs ( gestureState . dx ) > 1 || Math . abs ( gestureState . dy ) > 1 ) {
51+ return true
52+ }
53+ return false ;
54+ }
55+ } ) ;
56+ }
4657 renderHeader = ( ) => {
4758 const { HeaderComponent} = this . props ;
4859 if ( HeaderComponent ) {
@@ -61,13 +72,14 @@ class SmartRefreshControl extends Component {
6172 }
6273 render ( ) {
6374 const nativeProps = { ...this . props , ...{
64- onSmartRefresh :this . _onSmartRefresh ,
65- } }
75+ onSmartRefresh :this . _onSmartRefresh ,
76+ } }
6677 return (
6778 < SmartRefreshLayout
6879 ref = "refreshLayout"
6980 { ...nativeProps }
70- onMoveShouldSetResponderCapture = { ( ) => true } //拦截子组件的触摸移动事件
81+ { ...this . _panResponder . panHandlers }
82+ //onMoveShouldSetResponderCapture={()=>true}//拦截子组件的触摸移动事件
7183 >
7284 { this . renderHeader ( ) }
7385 { React . cloneElement (
You can’t perform that action at this time.
0 commit comments