Skip to content

Commit 250e35f

Browse files
committed
Code-style fixes
1 parent 8313356 commit 250e35f

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/Row.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,22 @@ export default class Row extends Component {
5656
},
5757

5858
onPanResponderGrant: (e, gestureState) => {
59-
e.persist();
60-
if (!this.props.manuallyActivateRows) {
61-
this._longPressTimer = setTimeout(() => {
62-
this._target = e.nativeEvent.target;
63-
this._prevGestureState = {
64-
...gestureState,
65-
moveX: gestureState.x0,
66-
moveY: gestureState.y0,
67-
};
68-
if (!this._active) {
69-
this._toggleActive(e, gestureState);
70-
}
71-
}, this.props.activationTime);
72-
} else {
73-
this._target = e.nativeEvent.target;
74-
this._prevGestureState = {
75-
...gestureState,
76-
moveX: gestureState.x0,
77-
moveY: gestureState.y0,
78-
};
79-
}
59+
e.persist();
60+
61+
this._target = e.nativeEvent.target;
62+
this._prevGestureState = {
63+
...gestureState,
64+
moveX: gestureState.x0,
65+
moveY: gestureState.y0,
66+
};
67+
68+
if (this.props.manuallyActivateRows) return;
69+
70+
this._longPressTimer = setTimeout(() => {
71+
if (this._active) return;
72+
73+
this._toggleActive(e, gestureState);
74+
}, this.props.activationTime);
8075
},
8176

8277
onPanResponderMove: (e, gestureState) => {
@@ -173,7 +168,12 @@ export default class Row extends Component {
173168
{...this._panResponder.panHandlers}
174169
style={rowStyle}
175170
onLayout={this._onLayout}>
176-
{this.props.manuallyActivateRows && children ? cloneElement(children, { toggleRowActive: this._toggleActive.bind(this) }) : children}
171+
{this.props.manuallyActivateRows && children
172+
? cloneElement(children, {
173+
toggleRowActive: this._toggleActive,
174+
})
175+
: children
176+
}
177177
</Animated.View>
178178
);
179179
}
@@ -198,15 +198,15 @@ export default class Row extends Component {
198198
}
199199
}
200200

201-
_toggleActive(e, gestureState) {
201+
_toggleActive = (e, gestureState) => {
202202
const callback = this._active ? this.props.onRelease : this.props.onActivate;
203203

204204
this._active = !this._active;
205205

206206
if (callback) {
207207
callback(e, gestureState, this._location);
208208
}
209-
}
209+
};
210210

211211
_mapGestureToMove(prevGestureState, gestureState) {
212212
return this.props.horizontal

0 commit comments

Comments
 (0)