Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Date Selector Doesn't handle iOS 13 dark mode #87

Open
chris-hut opened this issue Oct 17, 2019 · 3 comments
Open

Date Selector Doesn't handle iOS 13 dark mode #87

chris-hut opened this issue Oct 17, 2019 · 3 comments

Comments

@chris-hut
Copy link

Hello friend!

We've noticed that on iOS 13 with Dark Mode enabled, the selector is invisible:
IMG_3737B3100AAE-1

I've gotten this to work for me by adding a:

if #available(iOS 13.0, *) {
    actionController.overrideUserInterfaceStyle = .light
}

Right before presenting calendar selector!

I also notice that I can't seem to set the style to anything dark, I was going to add a

if #available(iOS 13.0, *) {
  puts("!: we are 13")
  if self.webViewController?.traitCollection.userInterfaceStyle == .dark {
       puts("!: We are dark")
      style = RMActionControllerStyle.black
   }
}
// then initialize the actionController
let actionController: RMDateSelectionViewController = RMDateSelectionViewController(style: style)!

However, even hardcoding it to .black seems to make keep it white!

@CooperRS
Copy link
Owner

Hi there!

The current master branch contains new styles for RMDateSelectionController, which automatically adapt to the current environment.

In addition, the master branch contains some bugfixes which are not yet available in the latest release.

Can you give the master branch a try to see if it improves the situation for you?

Best regards,
Roland

@chris-hut
Copy link
Author

chris-hut commented Oct 18, 2019

Hey Roland!

I tried both master and this commit directly 7d3d785, but didn't seem like in either way I was able to theme it black or have have the text show up in Dark mode.

var data = message.body as! Dictionary<String, AnyObject>
let date: Date

if let year = data["year"], let month = data["month"], let day = data["day"] {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "yyyy,MM,dd"
    // Need to add 1 to month, since iOS wants months to start at 1 instead of 0
    date = dateFormatter.date(from: "\(year),\((month as! UInt) + 1),\(day)") ?? Date()
} else {
    // Fallback to today's date
    date = Date()
}

let selectAction = RMAction<UIDatePicker>(title: "Set Date", style: RMActionStyle.done) { controller in
    self.setDate(controller.contentView.date)

}

let cancelAction = RMAction(title: "Cancel", style: RMActionStyle.cancel) { _ in
    print("Date cancelled")
    self.webViewController?.queueDispatchableAction(DispatchableAction(action: "updateDate", payload: nil))
}


let actionController: RMDateSelectionViewController = RMDateSelectionViewController(style: RMActionControllerStyle.black)!

actionController.title = "Select a Date"

// Actions have to be added separately, opposed to in the constructor in order to stack them
actionController.addAction(selectAction! )
actionController.addAction(cancelAction! as! RMAction<UIDatePicker>)
actionController.disableBlurEffects = true
actionController.disableBouncingEffects = true

actionController.datePicker.date = date
actionController.datePicker.datePickerMode = UIDatePicker.Mode.date


self.webViewController!.present(actionController, animated: true, completion: nil)

Is how I'm trying to make it black!

Thanks,

Chris

@internalG
Copy link

The key is that you can't set disableBlurEffects = YES, the default NO works well.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants