Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

How can I open swipeout manually? #55

Closed
iicdii opened this issue Jan 11, 2016 · 2 comments
Closed

How can I open swipeout manually? #55

iicdii opened this issue Jan 11, 2016 · 2 comments

Comments

@iicdii
Copy link

iicdii commented Jan 11, 2016

//  open swipeout manually
, _open: function(direction) {
    this.refs.swipeoutContent.measure((ox, oy, width, height) => {
      this.setState({
        btnWidth: (width/5),
        btnsLeftWidth: this.props.left ? (width/5)*this.props.left.length : 0,
        btnsRightWidth: this.props.right ? (width/5)*this.props.right.length : 0,
        contentHeight: height,
        contentWidth: width,
      });
    });
    btnsRightWidth = this.state.btnsRightWidth;
    btnsLeftWidth = this.state.btnsLeftWidth;
    if (direction == 'right') {
      // open swipeout right
      this._tweenContent('contentPos', -btnsRightWidth);
      this.setState({ contentPos: -btnsRightWidth, openedLeft: false, openedRight: true });
    } else if (direction == 'left') {
      // open swipeout left
      this._tweenContent('contentPos', btnsLeftWidth);
      this.setState({ contentPos: btnsLeftWidth, openedLeft: true, openedRight: false });
    }
  }
,

I add this function to open swipeout manually, it works only when I touched swipeout content at least once. Actually I found solution without trying to touch once, which write the direct width in btnsRightWidth and btnsLeftWidth variable but it's not universal way at all. What do you think about?

@silentcloud
Copy link
Collaborator

#118

@maximromanyuk
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants