Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,7 @@

Size RNTModalViewSize(void)
{
__block CGSize screenSize = RCTScreenSize();

dispatch_sync(dispatch_get_main_queue(), ^{
RNTModalWindowHelper *windowHelper = [[RNTModalWindowHelper alloc] init];
UIInterfaceOrientation orientation = [windowHelper getWindowOrientation];

if (UIInterfaceOrientationIsLandscape(orientation)) {
screenSize = CGSizeMake(screenSize.height, screenSize.width);
}
});

CGSize screenSize = RCTScreenSize();
return { screenSize.width, screenSize.height };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
@property(nonatomic, strong) ModalAnimation *inAnimation;
@property(nonatomic, strong) ModalAnimation *outAnimation;
@property(nonatomic, assign) CGRect lastBounds;
@property(nonatomic, assign) BOOL shouldTrackRotationChange;

@end

Expand Down
10 changes: 1 addition & 9 deletions ios/Library/RNTModalViewController/RNTModalViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ - (instancetype)initWithDelegate:(id<RNTModalViewControllerDelegate>)delegate {
if (self) {
self.reactSubviewContainer = [[UIView alloc] init];
self.delegate = delegate;
self.shouldTrackRotationChange = NO;
}
return self;
}
Expand All @@ -38,16 +37,10 @@ - (void)viewDidLoad {
[self setupReactSubview:self.reactSubviewContainer];
}

- (void)viewDidAppear:(BOOL)animated {
[self.inAnimation animate:self.reactSubviewContainer completion:^(BOOL finished) {
self.shouldTrackRotationChange = YES;
}];
}

- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
if (!CGRectEqualToRect(self.lastBounds, self.view.bounds) && self.shouldTrackRotationChange) {
if (!CGRectEqualToRect(self.lastBounds, self.view.bounds)) {
[self.delegate boundsDidChange:self.view.bounds];
self.lastBounds = self.view.bounds;
}
Expand All @@ -67,7 +60,6 @@ - (void)dismiss {
self.reactSubviewContainer = [self.reactSubviewContainer snapshotViewAfterScreenUpdates:NO];
[prevReactSubviewContainer removeFromSuperview];

self.shouldTrackRotationChange = NO;
[self setupReactSubview:self.reactSubviewContainer];
[self.outAnimation prepareAnimation:self.reactSubviewContainer];
[self.outAnimation animate:self.reactSubviewContainer completion:^(BOOL finished) {
Expand Down
13 changes: 1 addition & 12 deletions ios/RNTModalShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,7 @@ - (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex
{
[super insertReactSubview:subview atIndex:atIndex];
if ([subview isKindOfClass:[RCTShadowView class]]) {
dispatch_sync(dispatch_get_main_queue(), ^{
RNTModalWindowHelper *windowHelper = [[RNTModalWindowHelper alloc] init];
UIInterfaceOrientation orientation = [windowHelper getWindowOrientation];

CGSize screenSize = RCTScreenSize();

if (UIInterfaceOrientationIsPortrait(orientation)) {
((RCTShadowView *)subview).size = screenSize;
} else {
((RCTShadowView *)subview).size = CGSizeMake(screenSize.height, screenSize.width);
}
});
((RCTShadowView *)subview).size = RCTScreenSize();
}
}

Expand Down