diff --git a/src/datetimepicker.common.ts b/src/datetimepicker.common.ts index 058dd35..43a807a 100644 --- a/src/datetimepicker.common.ts +++ b/src/datetimepicker.common.ts @@ -2,7 +2,7 @@ import { View } from "tns-core-modules/ui/core/view"; import { ContentView } from "tns-core-modules/ui/content-view"; import { Page } from "tns-core-modules/ui/page"; import { Color } from "tns-core-modules/color"; -import * as frameModule from "tns-core-modules/ui/frame"; +import { Frame } from "tns-core-modules/ui/frame"; import { DateTimePicker as DateTimePickerDefinition, DateTimePickerStyle as DateTimePickerStyleDefinition @@ -76,7 +76,7 @@ export class DateTimePickerStyleBase implements DateTimePickerStyleDefinition { } export function getCurrentPage(): Page { - let topmostFrame = frameModule.topmost(); + let topmostFrame = Frame.topmost(); if (topmostFrame) { return topmostFrame.currentPage; } @@ -122,4 +122,4 @@ function applySelectors(view: T, callback: (view: T) => void) { view.onUnloaded(); } } -} \ No newline at end of file +} diff --git a/src/datetimepicker.ios.ts b/src/datetimepicker.ios.ts index bceac1f..15b4952 100644 --- a/src/datetimepicker.ios.ts +++ b/src/datetimepicker.ios.ts @@ -148,6 +148,10 @@ export class DateTimePicker extends DateTimePickerBase { const parentWithController = iosView.getParentWithViewController(view); viewController = parentWithController ? parentWithController.viewController : undefined; } + + while (viewController.presentedViewController) { + viewController = viewController.presentedViewController; + } } if (viewController) { @@ -243,4 +247,4 @@ export class DateTimePicker extends DateTimePickerBase { } return null; } -} \ No newline at end of file +}