Skip to content

Commit

Permalink
Fix android native wheel stop glitch
Browse files Browse the repository at this point in the history
  • Loading branch information
henninghall authored Jul 12, 2020
2 parents e97c57d + 0eabc46 commit 437b317
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# React Native Date Picker [![npm](https://img.shields.io/npm/v/react-native-date-picker.svg)](https://www.npmjs.com/package/react-native-date-picker) [![npm](https://img.shields.io/npm/dm/react-native-date-picker.svg)](https://www.npmjs.com/package/react-native-date-picker)

# React Native Date Picker [![npm](https://img.shields.io/npm/v/react-native-date-picker.svg)](https://www.npmjs.com/package/react-native-date-picker) [![Build status](https://img.shields.io/github/workflow/status/henninghall/react-native-date-picker/Android:%20build%20&%20test?label=tests)](https://github.com/henninghall/react-native-date-picker/actions) [![npm](https://img.shields.io/npm/dm/react-native-date-picker.svg)](https://www.npmjs.com/package/react-native-date-picker)

This is a React Native Date Picker with following main features:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.henninghall.date_picker.pickers;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Paint;
import android.os.Handler;
import android.util.AttributeSet;
Expand Down Expand Up @@ -174,7 +173,13 @@ public void setOnValueChangedListener(final Picker.OnValueChangeListener listene
public void onScrollStateChange(NumberPicker numberPicker, int state) {
boolean stoppedScrolling = previousState != SCROLL_STATE_IDLE && state == SCROLL_STATE_IDLE;
if (stoppedScrolling) {
listener.onValueChange();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
listener.onValueChange();
}
// the delay make sure the wheel has stopped before sending the value change event
}, 500);
}
previousState = state;
}
Expand Down

0 comments on commit 437b317

Please sign in to comment.