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/deprecations #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 20 additions & 2 deletions RNBlurModalView.m
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,28 @@ - (id)initWithCoverView:(UIView *)view {

@implementation UILabel (AutoSize)

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

- (void)autoHeight {
CGRect frame = self.frame;
CGSize maxSize = CGSizeMake(frame.size.width, 9999);
CGSize expectedSize = [self.text sizeWithFont:self.font constrainedToSize:maxSize lineBreakMode:self.lineBreakMode];
CGSize expectedSize;

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {

CGRect textRect = [self.text boundingRectWithSize:maxSize
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:self.font}
context:nil];
expectedSize = textRect.size;
} else {

// supress warning as we're using conditional code
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

expectedSize = [self.text sizeWithFont:self.font constrainedToSize:maxSize lineBreakMode:self.lineBreakMode];
}

frame.size.height = expectedSize.height;
[self setFrame:frame];
}
Expand Down Expand Up @@ -697,7 +715,7 @@ -(UIImage *)boxblurImageWithBlur:(CGFloat)blur {
//clean up
CGContextRelease(ctx);
CGColorSpaceRelease(colorSpace);
free(pixelBuffer2)
free(pixelBuffer2);
free(pixelBuffer);
CFRelease(inBitmapData);

Expand Down