且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当我使用 pop() 返回时导航时,应用程序崩溃

更新时间:2022-12-20 21:15:34

我传递了错误的对象.{{...this.panHandlers}} 而不是 { ...this.panHandlers}

I was passing the wrong object. {{...this.panHandlers}} instead of { ...this.panHandlers}

class CustomStack extends React.Component {
  panHandlers = {};

  userActivity;

  constructor(props) {
    super(props);
    this.userActivity = new UserActivity();
  }

  componentDidMount() {
    this.userActivity.startTimer();
    this.panHandlers = this.userActivity.panHandlers();
  }

  static router = AuthenticatedNavigator.router;

  render() {
    const {
      navigation
    } = this.props;
    return <AuthenticatedNavigator screenProps = { ...this.panHandlers
    }
    navigation = {
      navigation
    }
    />;
  }
}