diff --git a/android/src/main/java/com/henninghall/date_picker/DatePickerModule.java b/android/src/main/java/com/henninghall/date_picker/DatePickerModule.java index a7d6550..7bf5f34 100644 --- a/android/src/main/java/com/henninghall/date_picker/DatePickerModule.java +++ b/android/src/main/java/com/henninghall/date_picker/DatePickerModule.java @@ -55,7 +55,7 @@ public class DatePickerModule extends ReactContextBaseJavaModule { final String cancelText = props.getString("cancelText"); final View pickerWithMargin = withTopMargin(picker); - return new AlertDialog.Builder(DatePickerPackage.context.getCurrentActivity()) + return new AlertDialog.Builder(DatePickerPackage.context.getCurrentActivity(), getTheme(props)) .setTitle(title) .setCancelable(true) .setView(pickerWithMargin) @@ -80,6 +80,17 @@ public class DatePickerModule extends ReactContextBaseJavaModule { .create(); } + private int getTheme(ReadableMap props) { + int defaultTheme = 0; + String theme = props.getString("theme"); + if(theme == null) return defaultTheme; + switch (theme){ + case "light": return AlertDialog.THEME_DEVICE_DEFAULT_LIGHT; + case "dark": return AlertDialog.THEME_DEVICE_DEFAULT_DARK; + default: return defaultTheme; + } + } + private PickerView createPicker(ReadableMap props){ int height = 180; LinearLayout.LayoutParams rootLayoutParams = new LinearLayout.LayoutParams(