Skip to content

chore: 修改生命周期方法 #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions SmartRefreshControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SmartRefreshControl extends Component {

return findNodeHandle(this.refs.refreshLayout);
}
componentWillMount() {
componentDidMount() {
this._panResponder = PanResponder.create({
onMoveShouldSetPanResponderCapture: (evt, gestureState) => {
if(this.shiftPercent >= 0.039 || this.footerShiftPercent >= 0.068){//满足条件捕获事件
Expand Down Expand Up @@ -127,7 +127,7 @@ class SmartRefreshControl extends Component {
<SmartRefreshLayout
ref="refreshLayout"
{...nativeProps}
{...this._panResponder.panHandlers}
{...this._panResponder?.panHandlers}
>
{this.renderHeader()}
{this.props.children}
Expand Down Expand Up @@ -169,4 +169,4 @@ SmartRefreshControl.propTypes = {
SmartRefreshControl.defaultProps={
overScrollBounce:false
}
export default SmartRefreshControl;
export default SmartRefreshControl;
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import react, { Component } from "react"
import React, { Component } from "react"
import {ViewProps} from "react-native";
interface SmartRefreshLayoutProps extends ViewProps{
onRefresh?:()=>void,
Expand Down