Skip to content

support preferredDatePickerStyle in iOS 14 #211

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

Merged
merged 10 commits into from
Aug 10, 2020

Conversation

SConaway
Copy link
Contributor

@SConaway SConaway commented Jul 3, 2020

Summary

The PR was opened by @SConaway, who raised the issue about weird appearance in ios 14. @vonovak took over most of the implementation

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)

@luancurti
Copy link
Member

@vonovak do you want to review this PR? I'm not available to review because I'm using Xcode 11.5 and I did not want to update to Xcode 12 beta

@SConaway SConaway marked this pull request as draft July 4, 2020 01:03
@vonovak vonovak self-assigned this Jul 4, 2020
@jwktje
Copy link

jwktje commented Jul 6, 2020

@luancurti You can install the XCode beta alongside 11.5. So far I've done this without issue when testing iOS14 stuff.

@SConaway
Copy link
Contributor Author

SConaway commented Jul 7, 2020

I can't figure out how to do cell.datePicker.preferredDatePickerStyle = .wheels in ObjectiveC. [view setValue:UIDatePickerStyleWheels forKey:@"preferredDatePickerStyle"]; doesn't compile.

@SConaway
Copy link
Contributor Author

SConaway commented Aug 7, 2020

At the moment, I'm getting this error:

[view setValue:UIDatePickerStyleWheels forKey:@"preferredDatePickerStyle"]; 
Implicit conversion of 'NSInteger' (aka 'long') to 'id _Nullable' is disallowed with ARC

@vonovak
Copy link
Member

vonovak commented Aug 7, 2020

@SConaway I will take care of this PR :) (and the feature itself)

@SConaway
Copy link
Contributor Author

SConaway commented Aug 7, 2020

Ok. Sounds good. Hope the little i did helps.

@vonovak vonovak force-pushed the ios14-fix branch 2 times, most recently from a310997 to 9ee04d7 Compare August 9, 2020 00:28
@vonovak vonovak changed the title preferredDatePickerStyle for iOS 14 support preferredDatePickerStyle in iOS 14 Aug 9, 2020
@vonovak vonovak marked this pull request as ready for review August 9, 2020 23:07
@vonovak vonovak requested review from luancurti and removed request for vonovak August 9, 2020 23:07
@SConaway
Copy link
Contributor Author

SConaway commented Aug 10, 2020

@vonovak

I noticed a crashing issue:

When I open the picker on default and date, then switch to inline, the app crashes with this nice long log:

2020-08-10 11:50:23.815600-0700 example[59454:7421854] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
	(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<_UISystemBaselineConstraint:0x600003498000 H:[_UIDatePickerLinkedLabel:0x7f90f84730a0]-(NSLayoutAnchorConstraintSpace(8))-[UILayoutGuide:0x600002e3df80'']   (active)>",
    "<_UISystemBaselineConstraint:0x600003498050 H:[UILayoutGuide:0x600002e3df80'']-(>=NSLayoutAnchorConstraintSpace(8))-[_UIDatePickerTouchOutsetButton:0x7f90fa0593c0]   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000034e2d00 h=--& v=--& dateTimePicker.height == 34.5   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x6000034f93b0 _UIDatePickerLinkedLabel:0x7f90f84730a0.leading == UILayoutGuide:0x600002e3e060'UIViewLayoutMarginsGuide'.leading   (active)>",
    "<NSLayoutConstraint:0x6000034980a0 H:[_UIDatePickerTouchOutsetButton:0x7f90fa0593c0]-(28)-[_UIDatePickerTouchOutsetButton:0x7f90fa059a20]   (active)>",
    "<NSLayoutConstraint:0x6000034980f0 _UIDatePickerTouchOutsetButton:0x7f90fa059a20.trailing == UILayoutGuide:0x600002e3e060'UIViewLayoutMarginsGuide'.trailing   (active)>",
    "<NSLayoutConstraint:0x600003498140 _UIDatePickerLinkedLabel:0x7f90f84730a0.top >= _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003498190 _UIDatePickerLinkedLabel:0x7f90f84730a0.centerY == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.centerY   (active)>",
    "<NSLayoutConstraint:0x60000349eb70 H:|-(0)-[UICollectionView:0x7f90fb089800]   (active, names: '|':_UIDatePickerCalendarDateView:0x7f90f9649fc0 )>",
    "<NSLayoutConstraint:0x60000349ebc0 UICollectionView:0x7f90fb089800.trailing == _UIDatePickerCalendarDateView:0x7f90f9649fc0.trailing   (active)>",
    "<NSLayoutConstraint:0x60000349ecb0 V:|-(14)-[UIStackView:0x7f90f8475ef0]   (active, names: '|':_UIDatePickerCalendarDateView:0x7f90f9649fc0 )>",
    "<NSLayoutConstraint:0x60000349ed00 V:[UIStackView:0x7f90f8475ef0]-(0)-[UICollectionView:0x7f90fb089800]   (active)>",
    "<NSLayoutConstraint:0x60000349ed50 UICollectionView:0x7f90fb089800.bottom == _UIDatePickerCalendarDateView:0x7f90f9649fc0.bottom - 4   (active)>",
    "<NSLayoutConstraint:0x6000034994f0 UIStackView:0x7f90fa049b90.top == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.top   (active)>",
    "<NSLayoutConstraint:0x600003499540 UIStackView:0x7f90fa049b90.bottom == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.bottom   (active)>",
    "<NSLayoutConstraint:0x6000034823f0 V:|-(0)-[_UIDatePickerCalendarView:0x7f90f9751350]   (active, names: dateTimePicker:0x7f90fa045690, '|':dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003482440 _UIDatePickerCalendarView:0x7f90f9751350.bottom == dateTimePicker.bottom   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x6000034969e0 UICollectionView:0x7f90fb089800.height == 0.714286*UICollectionView:0x7f90fb089800.width + 2   (active)>",
    "<NSLayoutConstraint:0x600003497d90 'UISV-alignment' _UIDatePickerCalendarHeaderView:0x7f90f846fda0.leading == _UIDatePickerCalendarDateView:0x7f90f9649fc0.leading   (active)>",
    "<NSLayoutConstraint:0x600003497de0 'UISV-alignment' _UIDatePickerCalendarHeaderView:0x7f90f846fda0.trailing == _UIDatePickerCalendarDateView:0x7f90f9649fc0.trailing   (active)>",
    "<NSLayoutConstraint:0x600003497bb0 'UISV-canvas-connection' UIStackView:0x7f90fa049b90.top == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003497c00 'UISV-canvas-connection' V:[_UIDatePickerCalendarDateView:0x7f90f9649fc0]-(0)-|   (active, names: '|':UIStackView:0x7f90fa049b90 )>",
    "<NSLayoutConstraint:0x600003497c50 'UISV-spacing' V:[_UIDatePickerCalendarHeaderView:0x7f90f846fda0]-(0)-[_UIDatePickerCalendarDateView:0x7f90f9649fc0]   (active)>",
    "<NSLayoutConstraint:0x6000034954a0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>",
    "<NSLayoutConstraint:0x6000034e3ed0 'UIView-leftMargin-guide-constraint' H:|-(8)-[UILayoutGuide:0x600002e3e060'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIDatePickerCalendarHeaderView:0x7f90f846fda0 )>",
    "<NSLayoutConstraint:0x6000034e3f70 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600002e3e060'UIViewLayoutMarginsGuide']-(8)-|(LTR)   (active, names: '|':_UIDatePickerCalendarHeaderView:0x7f90f846fda0 )>",
    "<NSLayoutConstraint:0x600003499450 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000034969e0 UICollectionView:0x7f90fb089800.height == 0.714286*UICollectionView:0x7f90fb089800.width + 2   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-08-10 11:50:23.831241-0700 example[59454:7421854] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
	(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x6000034e2d00 h=--& v=--& dateTimePicker.height == 34.5   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003498140 _UIDatePickerLinkedLabel:0x7f90f84730a0.top >= _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003498190 _UIDatePickerLinkedLabel:0x7f90f84730a0.centerY == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.centerY   (active)>",
    "<NSLayoutConstraint:0x60000349ecb0 V:|-(14)-[UIStackView:0x7f90f8475ef0]   (active, names: '|':_UIDatePickerCalendarDateView:0x7f90f9649fc0 )>",
    "<NSLayoutConstraint:0x60000349ed00 V:[UIStackView:0x7f90f8475ef0]-(0)-[UICollectionView:0x7f90fb089800]   (active)>",
    "<NSLayoutConstraint:0x60000349ed50 UICollectionView:0x7f90fb089800.bottom == _UIDatePickerCalendarDateView:0x7f90f9649fc0.bottom - 4   (active)>",
    "<NSLayoutConstraint:0x6000034994f0 UIStackView:0x7f90fa049b90.top == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.top   (active)>",
    "<NSLayoutConstraint:0x600003499540 UIStackView:0x7f90fa049b90.bottom == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.bottom   (active)>",
    "<NSLayoutConstraint:0x6000034823f0 V:|-(0)-[_UIDatePickerCalendarView:0x7f90f9751350]   (active, names: dateTimePicker:0x7f90fa045690, '|':dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003482440 _UIDatePickerCalendarView:0x7f90f9751350.bottom == dateTimePicker.bottom   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003497750 'UISV-canvas-connection' UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide'.top == _UIDatePickerLinkedLabel:0x7f90f8494110.top   (active)>",
    "<NSLayoutConstraint:0x6000034977a0 'UISV-canvas-connection' UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide'.bottom == _UIDatePickerLinkedLabel:0x7f90f8494110.bottom   (active)>",
    "<NSLayoutConstraint:0x600003497bb0 'UISV-canvas-connection' UIStackView:0x7f90fa049b90.top == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003497c00 'UISV-canvas-connection' V:[_UIDatePickerCalendarDateView:0x7f90f9649fc0]-(0)-|   (active, names: '|':UIStackView:0x7f90fa049b90 )>",
    "<NSLayoutConstraint:0x600003497c50 'UISV-spacing' V:[_UIDatePickerCalendarHeaderView:0x7f90f846fda0]-(0)-[_UIDatePickerCalendarDateView:0x7f90f9649fc0]   (active)>",
    "<NSLayoutConstraint:0x6000034954a0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>",
    "<NSLayoutConstraint:0x600003496e40 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':UIStackView:0x7f90f8475ef0 )>",
    "<NSLayoutConstraint:0x600003499450 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>",
    "<NSLayoutConstraint:0x600003496da0 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide']   (active, names: '|':UIStackView:0x7f90f8475ef0 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000034977a0 'UISV-canvas-connection' UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide'.bottom == _UIDatePickerLinkedLabel:0x7f90f8494110.bottom   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-08-10 11:50:23.842480-0700 example[59454:7421854] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
	(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<_UISystemBaselineConstraint:0x600003498000 H:[_UIDatePickerLinkedLabel:0x7f90f84730a0]-(NSLayoutAnchorConstraintSpace(8))-[UILayoutGuide:0x600002e3df80'']   (active)>",
    "<_UISystemBaselineConstraint:0x600003498050 H:[UILayoutGuide:0x600002e3df80'']-(>=NSLayoutAnchorConstraintSpace(8))-[_UIDatePickerTouchOutsetButton:0x7f90fa0593c0]   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x6000034e2d00 h=--& v=--& dateTimePicker.height == 34.5   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x6000034f93b0 _UIDatePickerLinkedLabel:0x7f90f84730a0.leading == UILayoutGuide:0x600002e3e060'UIViewLayoutMarginsGuide'.leading   (active)>",
    "<NSLayoutConstraint:0x6000034980a0 H:[_UIDatePickerTouchOutsetButton:0x7f90fa0593c0]-(28)-[_UIDatePickerTouchOutsetButton:0x7f90fa059a20]   (active)>",
    "<NSLayoutConstraint:0x6000034980f0 _UIDatePickerTouchOutsetButton:0x7f90fa059a20.trailing == UILayoutGuide:0x600002e3e060'UIViewLayoutMarginsGuide'.trailing   (active)>",
    "<NSLayoutConstraint:0x600003498140 _UIDatePickerLinkedLabel:0x7f90f84730a0.top >= _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003498190 _UIDatePickerLinkedLabel:0x7f90f84730a0.centerY == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.centerY   (active)>",
    "<NSLayoutConstraint:0x60000349e170 UICollectionView:0x7f90fb089800.height == 0.714286*UICollectionView:0x7f90fb089800.width + 2   (active)>",
    "<NSLayoutConstraint:0x60000349eb70 H:|-(0)-[UICollectionView:0x7f90fb089800]   (active, names: '|':_UIDatePickerCalendarDateView:0x7f90f9649fc0 )>",
    "<NSLayoutConstraint:0x60000349ebc0 UICollectionView:0x7f90fb089800.trailing == _UIDatePickerCalendarDateView:0x7f90f9649fc0.trailing   (active)>",
    "<NSLayoutConstraint:0x60000349ecb0 V:|-(14)-[UIStackView:0x7f90f8475ef0]   (active, names: '|':_UIDatePickerCalendarDateView:0x7f90f9649fc0 )>",
    "<NSLayoutConstraint:0x60000349ed00 V:[UIStackView:0x7f90f8475ef0]-(0)-[UICollectionView:0x7f90fb089800]   (active)>",
    "<NSLayoutConstraint:0x60000349ed50 UICollectionView:0x7f90fb089800.bottom == _UIDatePickerCalendarDateView:0x7f90f9649fc0.bottom - 4   (active)>",
    "<NSLayoutConstraint:0x6000034994f0 UIStackView:0x7f90fa049b90.top == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.top   (active)>",
    "<NSLayoutConstraint:0x600003499540 UIStackView:0x7f90fa049b90.bottom == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.bottom   (active)>",
    "<NSLayoutConstraint:0x6000034823f0 V:|-(0)-[_UIDatePickerCalendarView:0x7f90f9751350]   (active, names: dateTimePicker:0x7f90fa045690, '|':dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003482440 _UIDatePickerCalendarView:0x7f90f9751350.bottom == dateTimePicker.bottom   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003497d90 'UISV-alignment' _UIDatePickerCalendarHeaderView:0x7f90f846fda0.leading == _UIDatePickerCalendarDateView:0x7f90f9649fc0.leading   (active)>",
    "<NSLayoutConstraint:0x600003497de0 'UISV-alignment' _UIDatePickerCalendarHeaderView:0x7f90f846fda0.trailing == _UIDatePickerCalendarDateView:0x7f90f9649fc0.trailing   (active)>",
    "<NSLayoutConstraint:0x600003497bb0 'UISV-canvas-connection' UIStackView:0x7f90fa049b90.top == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003497c00 'UISV-canvas-connection' V:[_UIDatePickerCalendarDateView:0x7f90f9649fc0]-(0)-|   (active, names: '|':UIStackView:0x7f90fa049b90 )>",
    "<NSLayoutConstraint:0x600003497c50 'UISV-spacing' V:[_UIDatePickerCalendarHeaderView:0x7f90f846fda0]-(0)-[_UIDatePickerCalendarDateView:0x7f90f9649fc0]   (active)>",
    "<NSLayoutConstraint:0x6000034954a0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>",
    "<NSLayoutConstraint:0x6000034e3ed0 'UIView-leftMargin-guide-constraint' H:|-(8)-[UILayoutGuide:0x600002e3e060'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIDatePickerCalendarHeaderView:0x7f90f846fda0 )>",
    "<NSLayoutConstraint:0x6000034e3f70 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x600002e3e060'UIViewLayoutMarginsGuide']-(8)-|(LTR)   (active, names: '|':_UIDatePickerCalendarHeaderView:0x7f90f846fda0 )>",
    "<NSLayoutConstraint:0x600003499450 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x60000349e170 UICollectionView:0x7f90fb089800.height == 0.714286*UICollectionView:0x7f90fb089800.width + 2   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-08-10 11:50:23.844961-0700 example[59454:7421854] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
	(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x6000034e2d00 h=--& v=--& dateTimePicker.height == 34.5   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003498140 _UIDatePickerLinkedLabel:0x7f90f84730a0.top >= _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003498190 _UIDatePickerLinkedLabel:0x7f90f84730a0.centerY == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.centerY   (active)>",
    "<NSLayoutConstraint:0x60000349ecb0 V:|-(14)-[UIStackView:0x7f90f8475ef0]   (active, names: '|':_UIDatePickerCalendarDateView:0x7f90f9649fc0 )>",
    "<NSLayoutConstraint:0x60000349ed00 V:[UIStackView:0x7f90f8475ef0]-(0)-[UICollectionView:0x7f90fb089800]   (active)>",
    "<NSLayoutConstraint:0x60000349ed50 UICollectionView:0x7f90fb089800.bottom == _UIDatePickerCalendarDateView:0x7f90f9649fc0.bottom - 4   (active)>",
    "<NSLayoutConstraint:0x6000034994f0 UIStackView:0x7f90fa049b90.top == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.top   (active)>",
    "<NSLayoutConstraint:0x600003499540 UIStackView:0x7f90fa049b90.bottom == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.bottom   (active)>",
    "<NSLayoutConstraint:0x6000034823f0 V:|-(0)-[_UIDatePickerCalendarView:0x7f90f9751350]   (active, names: dateTimePicker:0x7f90fa045690, '|':dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003482440 _UIDatePickerCalendarView:0x7f90f9751350.bottom == dateTimePicker.bottom   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003497bb0 'UISV-canvas-connection' UIStackView:0x7f90fa049b90.top == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003497c00 'UISV-canvas-connection' V:[_UIDatePickerCalendarDateView:0x7f90f9649fc0]-(0)-|   (active, names: '|':UIStackView:0x7f90fa049b90 )>",
    "<NSLayoutConstraint:0x600003497c50 'UISV-spacing' V:[_UIDatePickerCalendarHeaderView:0x7f90f846fda0]-(0)-[_UIDatePickerCalendarDateView:0x7f90f9649fc0]   (active)>",
    "<NSLayoutConstraint:0x600003490f50 'UIView-bottom-readableContentGuide-constraint' UILayoutGuide:0x600002e3ddc0'UIViewLayoutMarginsGuide'.bottom == UILayoutGuide:0x600002e3dc00'UIViewReadableContentGuide'.bottom   (active)>",
    "<NSLayoutConstraint:0x6000034954a0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>",
    "<NSLayoutConstraint:0x600003490d70 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e3ddc0'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':UICollectionView:0x7f90fb089800 )>",
    "<NSLayoutConstraint:0x600003490ff0 'UIView-top-readableContentGuide-constraint' UILayoutGuide:0x600002e3dc00'UIViewReadableContentGuide'.top == UILayoutGuide:0x600002e3ddc0'UIViewLayoutMarginsGuide'.top   (active)>",
    "<NSLayoutConstraint:0x600003499450 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>",
    "<NSLayoutConstraint:0x600003491180 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600002e3ddc0'UIViewLayoutMarginsGuide']   (active, names: '|':UICollectionView:0x7f90fb089800 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600003490f50 'UIView-bottom-readableContentGuide-constraint' UILayoutGuide:0x600002e3ddc0'UIViewLayoutMarginsGuide'.bottom == UILayoutGuide:0x600002e3dc00'UIViewReadableContentGuide'.bottom   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-08-10 11:50:23.848801-0700 example[59454:7421854] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
	(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x6000034e2d00 h=--& v=--& dateTimePicker.height == 34.5   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003498140 _UIDatePickerLinkedLabel:0x7f90f84730a0.top >= _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003498190 _UIDatePickerLinkedLabel:0x7f90f84730a0.centerY == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.centerY   (active)>",
    "<NSLayoutConstraint:0x60000349ecb0 V:|-(14)-[UIStackView:0x7f90f8475ef0]   (active, names: '|':_UIDatePickerCalendarDateView:0x7f90f9649fc0 )>",
    "<NSLayoutConstraint:0x60000349ed00 V:[UIStackView:0x7f90f8475ef0]-(0)-[UICollectionView:0x7f90fb089800]   (active)>",
    "<NSLayoutConstraint:0x60000349ed50 UICollectionView:0x7f90fb089800.bottom == _UIDatePickerCalendarDateView:0x7f90f9649fc0.bottom - 4   (active)>",
    "<NSLayoutConstraint:0x6000034994f0 UIStackView:0x7f90fa049b90.top == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.top   (active)>",
    "<NSLayoutConstraint:0x600003499540 UIStackView:0x7f90fa049b90.bottom == UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide'.bottom   (active)>",
    "<NSLayoutConstraint:0x6000034823f0 V:|-(0)-[_UIDatePickerCalendarView:0x7f90f9751350]   (active, names: dateTimePicker:0x7f90fa045690, '|':dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x600003482440 _UIDatePickerCalendarView:0x7f90f9751350.bottom == dateTimePicker.bottom   (active, names: dateTimePicker:0x7f90fa045690 )>",
    "<NSLayoutConstraint:0x6000034922b0 'UISV-canvas-connection' UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide'.bottom == _UIDatePickerLinkedLabel:0x7f90f975f030.bottom   (active)>",
    "<NSLayoutConstraint:0x600003497bb0 'UISV-canvas-connection' UIStackView:0x7f90fa049b90.top == _UIDatePickerCalendarHeaderView:0x7f90f846fda0.top   (active)>",
    "<NSLayoutConstraint:0x600003497c00 'UISV-canvas-connection' V:[_UIDatePickerCalendarDateView:0x7f90f9649fc0]-(0)-|   (active, names: '|':UIStackView:0x7f90fa049b90 )>",
    "<NSLayoutConstraint:0x600003492490 'UISV-canvas-connection' UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide'.top == _UIDatePickerLinkedLabel:0x7f90f975f030.top   (active)>",
    "<NSLayoutConstraint:0x600003497c50 'UISV-spacing' V:[_UIDatePickerCalendarHeaderView:0x7f90f846fda0]-(0)-[_UIDatePickerCalendarDateView:0x7f90f9649fc0]   (active)>",
    "<NSLayoutConstraint:0x6000034954a0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>",
    "<NSLayoutConstraint:0x600003496e40 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide']-(4)-|   (active, names: '|':UIStackView:0x7f90f8475ef0 )>",
    "<NSLayoutConstraint:0x600003499450 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600002e30fc0'UIViewLayoutMarginsGuide']   (active, names: '|':_UIDatePickerCalendarView:0x7f90f9751350 )>",
    "<NSLayoutConstraint:0x600003496da0 'UIView-topMargin-guide-constraint' V:|-(0)-[UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide']   (active, names: '|':UIStackView:0x7f90f8475ef0 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000034922b0 'UISV-canvas-connection' UILayoutGuide:0x600002e171e0'UIViewLayoutMarginsGuide'.bottom == _UIDatePickerLinkedLabel:0x7f90f975f030.bottom   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-08-10 11:50:23.855502-0700 example[59454:7421854] *** Assertion failure in -[_UICollectionLayoutItemSolver _frameForAbsoluteIndex:additionalFrameOffset:interSolutionSpacing:repeatAxis:], _UICollectionLayoutItemSolver.m:1243
2020-08-10 11:50:23.863876-0700 example[59454:7421854] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: itemCount'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001094b84b2 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x000000010934426e objc_exception_throw + 48
	2   CoreFoundation                      0x00000001094b82db +[NSException raise:format:] + 0
	3   Foundation                          0x0000000108dfb6aa -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
	4   UIKitCore                           0x00000001128b3d17 -[_UICollectionLayoutItemSolver _frameForAbsoluteIndex:additionalFrameOffset:interSolutionSpacing:repeatAxis:] + 354
	5   UIKitCore                           0x00000001128be97f -[_UICollectionLayoutSectionFixedSolver frameForIndex:] + 234
	6   UIKitCore                           0x000000011288de92 -[_UICollectionCompositionalLayoutSolver layoutAttributesForItemAtIndexPath:] + 355
	7   UIKitCore                           0x000000011295e3f4 -[UICollectionViewData layoutAttributesForItemAtIndexPath:] + 329
	8   UIKitCore                           0x000000011292a049 -[UICollectionView _contentOffsetForScrollingToItemAtIndexPath:atScrollPosition:] + 102
	9   UIKitCore                           0x000000011292ad7b -[UICollectionView _scrollToItemAtIndexPath:atScrollPosition:animated:] + 153
	10  UIKitCore                           0x0000000112e34ac2 -[_UIDatePickerCalendarDateView _updateCollectionViewScrollPosition:] + 341
	11  UIKitCore                           0x0000000112e32770 -[_UIDatePickerCalendarDateView layoutSubviews] + 127
	12  UIKitCore                           0x000000011376f269 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2465
	13  QuartzCore                          0x000000010a9aa357 -[CALayer layoutSublayers] + 258
	14  QuartzCore                          0x000000010a9b0809 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 575
	15  QuartzCore                          0x000000010a9bc561 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 65
	16  QuartzCore                          0x000000010a8fd204 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 496
	17  QuartzCore                          0x000000010a933ed3 _ZN2CA11Transaction6commitEv + 783
	18  QuartzCore                          0x000000010a93508f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 79
	19  CoreFoundation                      0x0000000109425cff __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
	20  CoreFoundation                      0x0000000109420836 __CFRunLoopDoObservers + 487
	21  CoreFoundation                      0x0000000109420d67 __CFRunLoopRun + 1137
	22  CoreFoundation                      0x0000000109420542 CFRunLoopRunSpecific + 538
	23  GraphicsServices                    0x000000010d215db3 GSEventRunModal + 139
	24  UIKitCore                           0x000000011321b14e -[UIApplication _run] + 912
	25  UIKitCore                           0x00000001132201b1 UIApplicationMain + 101
	26  example                             0x00000001046b6070 main + 112
	27  libdyld.dylib                       0x000000010b9ef411 start + 1
	28  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: itemCount'
terminating with uncaught exception of type NSException
CoreSimulator 732.7 - Device: iPhone 11 (03CFFB77-8D9B-4FFE-9088-928911A9112A) - Runtime: iOS 14.0 (18A5332e) - DeviceType: iPhone 11

@vonovak
Copy link
Member

vonovak commented Aug 10, 2020

@SConaway which xcode version are you running?

@SConaway
Copy link
Contributor Author

@SConaway which xcode version are you running?

@vonovak I am running XCode 12.0 beta 3 at the moment. I somehow missed upgrading. I am downloading beta 4 now.

@vonovak
Copy link
Member

vonovak commented Aug 10, 2020

@SConaway with beta 4 I see the log in console but there is no crash. I don't think much can be done on our side here, our code is correct. Can you please confirm you have no crash with beta 4?

@SConaway
Copy link
Contributor Author

Seems to have been a bug in iOS 14.0 beta 3. Just upgrading the simulator resolved it.

Copy link
Member

@luancurti luancurti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested using Xcode 11.6 and iOS 12 SDK and iOS 13 SDK and everything seems ok. Great Job! @vonovak @SConaway

@luancurti luancurti merged commit 4e8d8e0 into react-native-datetimepicker:master Aug 10, 2020
@vonovak
Copy link
Member

vonovak commented Aug 11, 2020

@luancurti when merging, please do no forget to change the commit message as described here: #229 otherwise it won't trigger a release 🙂

I'm going to revert and reapply the PR now so semantic-release does all its magic. I'm also a little curious how it handles commits that were reverted 🙂

vonovak added a commit that referenced this pull request Aug 11, 2020
vonovak added a commit that referenced this pull request Aug 11, 2020
vonovak added a commit that referenced this pull request Aug 11, 2020
vonovak pushed a commit that referenced this pull request Aug 11, 2020
## [2.6.2](v2.6.1...v2.6.2) (2020-08-11)

### Reverts

* Revert "support preferredDatePickerStyle in iOS 14 (#211)" (#245) ([1263df9](1263df9)), closes [#211](#211) [#245](#245)
@vonovak
Copy link
Member

vonovak commented Aug 11, 2020

🎉 This PR is included in version 2.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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