Skip to content

Commit

Permalink
fix: modal theming (android) (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
henninghall authored Feb 13, 2023
1 parent 014bb93 commit 11a4164
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private AlertDialog createDialog(
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)
Expand All @@ -80,6 +80,17 @@ public void onCancel(DialogInterface dialogInterface) {
.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(
Expand Down

0 comments on commit 11a4164

Please sign in to comment.