Browse Source

Fix SafeAreaView and width in sidedrawer (#3418, #4527) (#6080)

Prevously: Adding a sideMenu with no width resulted in the side content having 100% width (partially drawn behind center view). Adding a sidemenu with a width option resulted in SafeAreaView inside the side content not working (content obstructed by iPhone notch).

Undoing the fix in commit 37f5697 fixes the first problem.
Calling setNeedsLayout on the sideMenu also fixes the original problem of SafeAreaView not working correctly. Although I am not sure why this is needed. There may a better solution.

Co-authored-by: Yogev Ben David <yogev132@gmail.com>
rfnd 4 years ago
parent
commit
0da097ef84
No account linked to committer's email address
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.m

+ 2
- 0
lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.m View File

@@ -940,6 +940,7 @@ static NSString *MMDrawerOpenSideKey = @"MMDrawerOpenSide";
940 940
         }
941 941
         [viewController didMoveToParentViewController:self];
942 942
         [viewController.view setAutoresizingMask:autoResizingMask];
943
+        [viewController.view setFrame:viewController.mm_visibleDrawerFrame];
943 944
     }
944 945
 }
945 946
 
@@ -1402,6 +1403,7 @@ static inline CGFloat originXForDrawerOriginAndTargetOriginOffset(CGFloat origin
1402 1403
     [sideDrawerViewControllerToPresent.view setHidden:NO];
1403 1404
     [self resetDrawerVisualStateForDrawerSide:drawer];
1404 1405
     [sideDrawerViewControllerToPresent.view setFrame:sideDrawerViewControllerToPresent.mm_visibleDrawerFrame];
1406
+    [sideDrawerViewControllerToPresent.view setNeedsLayout]; // Added to make SafeAreaView in sideDrawerView work (#3418)
1405 1407
     [self updateDrawerVisualStateForDrawerSide:drawer percentVisible:0.0];
1406 1408
     [sideDrawerViewControllerToPresent beginAppearanceTransition:YES animated:animated];
1407 1409
 }