From eb2cd077a960cb328eb058aebfe23c87de23f2aa Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 22 Feb 2016 04:43:51 -0800 Subject: [PATCH] Support rotation in RCTModalHostView Summary: When rotating a modal view we should adjust the root view's frame. Reviewed By: majak Differential Revision: D2939712 fb-gh-sync-id: 974634276d2c0ad22b46976020d0a21e1dac9026 shipit-source-id: 974634276d2c0ad22b46976020d0a21e1dac9026 --- React/Views/RCTModalHostView.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/React/Views/RCTModalHostView.m b/React/Views/RCTModalHostView.m index aecb77dba..63121a37f 100644 --- a/React/Views/RCTModalHostView.m +++ b/React/Views/RCTModalHostView.m @@ -58,13 +58,17 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:coder) - (void)insertReactSubview:(UIView *)subview atIndex:(__unused NSInteger)atIndex { + RCTAssert([_modalViewController.view reactTag] == nil, @"Modal view can only have one subview"); [subview addGestureRecognizer:_touchHandler]; + subview.autoresizingMask = UIViewAutoresizingFlexibleHeight | + UIViewAutoresizingFlexibleWidth; _modalViewController.view = subview; } - (void)removeReactSubview:(UIView *)subview { RCTAssert(subview == _modalViewController.view, @"Cannot remove view other than modal view"); + [subview removeGestureRecognizer:_touchHandler]; _modalViewController.view = nil; }