Skip to content

Commit fe3ebaa

Browse files
Merge variables.
#1004 (comment)
1 parent 1eb1136 commit fe3ebaa

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

android/src/main/java/com/reactcommunity/rndatetimepicker/Common.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public static DialogInterface.OnShowListener setButtonTextColor(@NonNull final C
9696
}
9797

9898
@NonNull
99-
public static DialogInterface.OnShowListener openYearDialog(final AlertDialog dialog, final boolean canOpenYearDialog, final boolean showYearPickerFirst) {
99+
public static DialogInterface.OnShowListener openYearDialog(final AlertDialog dialog, final boolean canOpenYearDialog) {
100100
return dialogInterface -> {
101-
if (canOpenYearDialog && showYearPickerFirst && dialog instanceof DatePickerDialog datePickerDialog) {
101+
if (canOpenYearDialog && dialog instanceof DatePickerDialog datePickerDialog) {
102102
DatePicker datePicker = datePickerDialog.getDatePicker();
103103

104104
int yearId = Resources.getSystem().getIdentifier("date_picker_header_year", "id", "android");

android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,10 @@ private DatePickerDialog createDialog(Bundle args) {
103103
if (activityContext != null) {
104104
RNDatePickerDisplay display = getDisplayDate(args);
105105
boolean needsColorOverride = display == RNDatePickerDisplay.SPINNER;
106-
boolean canOpenYearDialog = display == RNDatePickerDisplay.DEFAULT;
107-
boolean showYearPickerFirst = args.getBoolean(RNConstants.ARG_SHOW_YEAR_PICKER_FIRST);
106+
boolean canOpenYearDialog = display == RNDatePickerDisplay.DEFAULT && args.getBoolean(RNConstants.ARG_SHOW_YEAR_PICKER_FIRST);
108107
dialog.setOnShowListener(
109108
combine(
110-
openYearDialog(dialog, canOpenYearDialog, showYearPickerFirst),
109+
openYearDialog(dialog, canOpenYearDialog),
111110
setButtonTextColor(activityContext, dialog, args, needsColorOverride)
112111
)
113112
);

0 commit comments

Comments
 (0)