Skip to content

Commit 5174140

Browse files
committed
Reduced delay for onClose callback
1 parent b5703ce commit 5174140

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/components/dropdown/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,22 @@ export default class Dropdown extends PureComponent {
333333
}
334334

335335
onSelect(index) {
336-
let { data, valueExtractor, onChangeText, animationDuration } = this.props;
336+
let {
337+
data,
338+
valueExtractor,
339+
onChangeText,
340+
animationDuration,
341+
rippleDuration,
342+
} = this.props;
343+
337344
let value = valueExtractor(data[index], index);
345+
let delay = Math.max(0, rippleDuration - animationDuration);
338346

339347
if ('function' === typeof onChangeText) {
340348
onChangeText(value, index, data);
341349
}
342350

343-
setTimeout(() => this.onClose(value), animationDuration);
351+
setTimeout(() => this.onClose(value), delay);
344352
}
345353

346354
onLayout(event) {

0 commit comments

Comments
 (0)