Skip to content
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

[TimerMixin] Removing TimerMixin on SwipeableRow #21499

Closed
Closed
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
12 changes: 8 additions & 4 deletions Libraries/Experimental/SwipeableRow/SwipeableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const StyleSheet = require('StyleSheet');
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const TimerMixin = require('react-timer-mixin');
const View = require('View');

const createReactClass = require('create-react-class');
Expand Down Expand Up @@ -85,8 +84,7 @@ const SwipeableRow = createReactClass({
displayName: 'SwipeableRow',
_panResponder: {},
_previousLeft: CLOSED_LEFT_POSITION,

mixins: [TimerMixin],
_timeoutID: (null: ?TimeoutID),

propTypes: {
children: PropTypes.any,
Expand Down Expand Up @@ -157,7 +155,7 @@ const SwipeableRow = createReactClass({
* Do the on mount bounce after a delay because if we animate when other
* components are loading, the animation will be laggy
*/
this.setTimeout(() => {
this._timeoutID = setTimeout(() => {
this._animateBounceBack(ON_MOUNT_BOUNCE_DURATION);
}, ON_MOUNT_BOUNCE_DELAY);
}
Expand All @@ -173,6 +171,12 @@ const SwipeableRow = createReactClass({
}
},

componentWillUnmount() {
if (this._timeoutID != null) {
clearTimeout(this._timeoutID);
}
},

render(): React.Element<any> {
// The view hidden behind the main view
let slideOutView;
Expand Down
1 change: 1 addition & 0 deletions RNTester/js/SwipeableListViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class SwipeableListViewSimpleExample extends React.Component<
noSpacer={true}
noScroll={true}>
<SwipeableListView
bounceFirstRowOnMount={true}
dataSource={this.state.dataSource}
maxSwipeDistance={100}
renderQuickActions={(
Expand Down