Skip to content
Open
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
10 changes: 9 additions & 1 deletion SlideButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ export class SlideButton extends Component {
animatedX: new Animated.Value(0),
released: false,
swiped: true,
slideBackTimer: null
};
}

componentWillUnmount() {
if (this.state.slideBackTimer) {
clearTimeout(this.state.slideBackTimer);
}
}

/* Button movement of > 40% is considered a successful slide */
isSlideSuccessful() {
if (!this.props.slideDirection) {
Expand Down Expand Up @@ -80,7 +87,7 @@ export class SlideButton extends Component {
});

// Slide it back in after 1 sec
setTimeout(() => {
var slideBackTimer = setTimeout(() => {
self.moveButtonIn(() => {
self.setState({
released: false,
Expand All @@ -89,6 +96,7 @@ export class SlideButton extends Component {
});
}, 1000);

self.setState({ slideBackTimer: slideBackTimer });
} else {
this.snapToPosition(() => {
self.setState({
Expand Down