Skip to content

Commit

Permalink
fix: disable modal confirm while wheel spinning (#824)
Browse files Browse the repository at this point in the history
* fix: disable confirm while scrolling

Regression, introduced in 5.0.2 by #804

* cleanup
  • Loading branch information
henninghall committed May 24, 2024
1 parent 6b73453 commit 93e3c66
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.henninghall.date_picker.ui.SpinnerState;
import com.henninghall.date_picker.ui.SpinnerStateListener;

import net.time4j.android.ApplicationStarter;

Expand Down Expand Up @@ -126,9 +128,21 @@ private PickerView createPicker(ReadableMap props){
}
}
picker.update();

picker.addSpinnerStateListener(new SpinnerStateListener() {
@Override
public void onChange(SpinnerState state) {
setEnabledConfirmButton(state == SpinnerState.idle);
}
});

return picker;
}

private void setEnabledConfirmButton(boolean enabled) {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled);
}

private View withTopMargin(PickerView view) {
LinearLayout linearLayout = new LinearLayout(DatePickerPackage.context);
linearLayout.setLayoutParams(new LinearLayout.LayoutParams(
Expand Down

0 comments on commit 93e3c66

Please sign in to comment.