Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/datetimepicker/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface PickerOptions {
title?: string;
okButtonText?: string;
cancelButtonText?: string;
iosPermittedArrowDirections?: number;
}

export class DateTimePickerStyleBase implements DateTimePickerStyleDefinition {
Expand Down
6 changes: 6 additions & 0 deletions packages/datetimepicker/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export interface PickerOptions {
* Text for the cancel button of the picker (default is Cancel on iOS, localized version of Cancel on android (based on the devices locale settings)).
*/
cancelButtonText?: string;

/**
* iOS only: permitted arrow directions
* Defaults to `UIPopoverArrowDirection.Any` when not provided.
*/
iosPermittedArrowDirections?: number;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/datetimepicker/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class DateTimePicker extends DateTimePickerBase {
DateTimePicker._nativeDialog = DateTimePicker._createNativeDialog(nativeDatePicker, options, style, (result) => {
resolve(result);
});
DateTimePicker._showNativeDialog(DateTimePicker._nativeDialog, nativeDatePicker, style);
DateTimePicker._showNativeDialog(DateTimePicker._nativeDialog, nativeDatePicker, options, style);
});
return pickDate;
}
Expand All @@ -39,7 +39,7 @@ export class DateTimePicker extends DateTimePickerBase {
DateTimePicker._nativeDialog = DateTimePicker._createNativeDialog(nativeTimePicker, options, style, (result) => {
resolve(result);
});
DateTimePicker._showNativeDialog(DateTimePicker._nativeDialog, nativeTimePicker, style);
DateTimePicker._showNativeDialog(DateTimePicker._nativeDialog, nativeTimePicker, options, style);
});
return pickTime;
}
Expand Down Expand Up @@ -158,7 +158,7 @@ export class DateTimePicker extends DateTimePickerBase {
return alertController;
}

static _showNativeDialog(nativeDialog: UIAlertController, nativePicker: UIDatePicker, style: DateTimePickerStyle) {
static _showNativeDialog(nativeDialog: UIAlertController, nativePicker: UIDatePicker, options: PickerOptions, style: DateTimePickerStyle) {
const app = UIApplication.sharedApplication;
const win = app.keyWindow || (app.windows && app.windows.count > 0 && app.windows.objectAtIndex(0));
let viewController = win.rootViewController;
Expand All @@ -170,7 +170,7 @@ export class DateTimePicker extends DateTimePickerBase {
if (nativeDialog.popoverPresentationController) {
nativeDialog.popoverPresentationController.sourceView = viewController.view;
nativeDialog.popoverPresentationController.sourceRect = CGRectMake(viewController.view.bounds.size.width / 2.0, viewController.view.bounds.size.height / 2.0, 1.0, 1.0);
nativeDialog.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirection.Any;
nativeDialog.popoverPresentationController.permittedArrowDirections = options && options.iosPermittedArrowDirections !== undefined ? options.iosPermittedArrowDirections : UIPopoverArrowDirection.Any;
}

viewController.presentViewControllerAnimatedCompletion(nativeDialog, true, () => {});
Expand Down