Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: support preferredDatePickerStyle in iOS 14 #246

Merged
merged 1 commit into from
Aug 11, 2020

Conversation

vonovak
Copy link
Member

@vonovak vonovak commented Aug 11, 2020

Summary

The PR was opened by @SConaway in #211, who raised the issue about weird appearance in ios 14. @vonovak took over most of the implementation. This PR was opened just to trigger automatic release (that was not handled before due to wrong format of commit message).

This adds support for preferredDatePickerStyle to the module. I took the android-only display prop and extended the support for ios too, as opposed to adding a new ios-only prop.

The implementation was quite involved; for display: spinner, compact and inline we just assign those to preferredDatePickerStyle but for default we first need to find out what that is going to be, which is determined by the OS, and hence there is a async call across the bridge to find this out. The value could be cached I suppose, but that can be done later.

I also refactored the example app so that all the possible combinations can be properly tested. That also means changing e2e tests 😅

this requires xcode 11 to build, so we'll make this a breaking change

This closes #203, closes #75

Test Plan

Build and test the example app on xcode 11 and xcode 12

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS ✅❌
Android ✅❌

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I mentioned this change in CHANGELOG.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)

@vonovak vonovak changed the title feat: support preferredDatePickerStyle in iOS 14"" feat: support preferredDatePickerStyle in iOS 14 Aug 11, 2020
@vonovak vonovak merged commit e96f061 into master Aug 11, 2020
@vonovak vonovak deleted the revert-245-revert-211-ios14-fix branch August 11, 2020 08:53
vonovak pushed a commit that referenced this pull request Aug 11, 2020
# [3.0.0](v2.6.2...v3.0.0) (2020-08-11)

### Features

* support preferredDatePickerStyle in iOS 14 ([#246](#246)) ([e96f061](e96f061))

### BREAKING CHANGES

* you need XCode 11 to build this version, and you need this version to properly support iOS 14 (for that you need XCode 12)

This adds support for preferredDatePickerStyle to the module. We took the android-only display prop and extended the support for iOS too, as opposed to adding a new ios-only prop.
@vonovak
Copy link
Member Author

vonovak commented Aug 11, 2020

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@scarlac
Copy link

scarlac commented Aug 11, 2020

Thanks @vonovak ! Much appreciated.

FYI: A coworker had an issue where an @available rule wouldn't prevent Xcode from checking the block where we were manually setting the preferred style ourselves. He was running Xcode 11.2. It seemed to work on another machine with Xcode 11.4. Despite Apple's docs saying version Xcode >=11.0. Just in case someone reports compilation issues, try asking them to upgrade their Xcode.

mmazzarolo added a commit to mmazzarolo/react-native-modal-datetime-picker that referenced this pull request Sep 19, 2020
### Features

* Fix support of iOS 14 by defaulting the community datetimepicker display to "display" (you can still manually override it if needed). See react-native-datetimepicker/datetimepicker#246.

### BREAKING CHANGES

* You need at least `@react-native-community/[email protected]` for this version to work correctly.
* You need XCode 11 to build this version, and you need this version to properly support iOS 14 (for that you need XCode 12)
@abdo17rabah
Copy link

abdo17rabah commented Dec 16, 2020

How can i please update the package to use display= "spinner"

@SConaway
Copy link
Contributor

@abdo17rabah

Assuming you're on the latest version (3.0.8 as of now), set that prop on the component you're rendering (either in a class's render() or a function's return) like this: <RNDateTimePicker display="spinner" value={date} onChange={setDate} />. Is this what you mean?

CleanShot 2020-12-16 at 08 19 16@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants