dancormier / react-native-swipeout

iOS-style swipeout buttons behind component
MIT License
2.62k stars 646 forks source link

Close previously open button when I swipe another cell #259

Open ankits47b opened 6 years ago

ankits47b commented 6 years ago

How do I close previously opened swipe button when I swipe another cell for swipe out button..

EyalSi commented 6 years ago

use something like this: <Swipeout left={swipeoutBtnsLeft} right={swipeoutBtnsRight} autoClose={true} rowID={index} close={this.state.activeRow !== index} onOpen={(secId, rowId, direction) => { if (typeof direction !== "undefined" && this.state) { this.setState({ activeRow: rowId }); if (this.state.previousTimeOut != null) clearTimeout(this.state.previousTimeOut); this.state.previousTimeOut = setTimeout( (() => { if ( this.state && this.state.activeRow != null && this.state.activeRow == rowId ) { this.setState({ activeRow: null }); } }).bind(this), 5000 ); } }}

{component}

rjuevesano commented 5 years ago

It's not working.