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

fix(accessibility): adapt font size on iOS modal #850

Merged
Merged
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
18 changes: 17 additions & 1 deletion ios/RNDatePickerManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,25 @@ - (UIView *)view

CGRect pickerBounds = picker.bounds;


// Detect the content size category
UIContentSizeCategory contentSize = UIApplication.sharedApplication.preferredContentSizeCategory;
int heightIncrement = 0;

// Adjust height based on content size category
if ([contentSize isEqualToString:UIContentSizeCategoryAccessibilityLarge]) {
heightIncrement = 15;
} else if ([contentSize isEqualToString:UIContentSizeCategoryAccessibilityExtraLarge]) {
heightIncrement = 40;
} else if ([contentSize isEqualToString:UIContentSizeCategoryAccessibilityExtraExtraLarge]) {
heightIncrement = 70;
} else if ([contentSize isEqualToString:UIContentSizeCategoryAccessibilityExtraExtraExtraLarge]) {
heightIncrement = 90;
}

// height
double pickerHeight = [self getPickerHeight:alertView];
int alertHeightPx = iPad ? (title ? 300 : 260) : (title ? 370 : 340);
int alertHeightPx = iPad ? (title ? 300 : 260) : (title ? 370 + heightIncrement : 340 + heightIncrement);
NSLayoutConstraint *height = [NSLayoutConstraint constraintWithItem:alertView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:alertHeightPx];
[alertView addConstraint:height];
pickerBounds.size.height = pickerHeight;
Expand Down
Loading