PHP 7.4.33
Preview: RCTWrapperViewController.m Size: 2.09 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/react-native/React/Views/RCTWrapperViewController.m
/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import "RCTWrapperViewController.h"

#import <UIKit/UIScrollView.h>

#import "RCTAutoInsetsProtocol.h"
#import "RCTUtils.h"
#import "UIView+React.h"

@implementation RCTWrapperViewController {
  UIView *_wrapperView;
  UIView *_contentView;
  CGFloat _previousTopInset;
  CGFloat _previousBottomInset;

  CGFloat _currentTopInset;
  CGFloat _currentBottomInset;
}

- (instancetype)initWithContentView:(UIView *)contentView
{
  RCTAssertParam(contentView);

  if ((self = [super initWithNibName:nil bundle:nil])) {
    _contentView = contentView;
  }
  return self;
}

RCT_NOT_IMPLEMENTED(-(instancetype)initWithNibName : (NSString *)nn bundle : (NSBundle *)nb)
RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)

- (void)viewWillLayoutSubviews
{
  [super viewWillLayoutSubviews];

  _currentTopInset = self.view.safeAreaInsets.top;
  _currentBottomInset = self.view.safeAreaInsets.bottom;
}

static BOOL RCTFindScrollViewAndRefreshContentInsetInView(UIView *view)
{
  if ([view conformsToProtocol:@protocol(RCTAutoInsetsProtocol)]) {
    [(id<RCTAutoInsetsProtocol>)view refreshContentInset];
    return YES;
  }
  for (UIView *subview in view.subviews) {
    if (RCTFindScrollViewAndRefreshContentInsetInView(subview)) {
      return YES;
    }
  }
  return NO;
}

- (void)viewDidLayoutSubviews
{
  [super viewDidLayoutSubviews];

  if (_previousTopInset != _currentTopInset || _previousBottomInset != _currentBottomInset) {
    RCTFindScrollViewAndRefreshContentInsetInView(_contentView);
    _previousTopInset = _currentTopInset;
    _previousBottomInset = _currentBottomInset;
  }
}

- (void)loadView
{
  // Add a wrapper so that the wrapper view managed by the
  // UINavigationController doesn't end up resetting the frames for
  //`contentView` which is a react-managed view.
  _wrapperView = [[UIView alloc] initWithFrame:_contentView.bounds];
  [_wrapperView addSubview:_contentView];
  self.view = _wrapperView;
}

@end

Directory Contents

Dirs: 3 × Files: 59
Name Size Perms Modified Actions
- drwxr-xr-x 2025-03-28 11:04:43
Edit Download
- drwxr-xr-x 2025-03-28 11:04:43
Edit Download
- drwxr-xr-x 2025-03-28 11:04:43
Edit Download
283 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
444 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
418 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.51 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
446 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
880 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
332 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.01 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
20.67 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
372 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.74 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.80 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
20.24 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
463 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
640 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
380 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
5.49 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
306 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
683 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
3.52 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
286 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.96 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.70 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
18.54 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
2.29 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
4.57 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.78 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
6.86 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
446 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.85 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
997 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
3.87 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
399 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
670 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
400 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
880 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.09 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
387 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
429 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.06 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.92 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
8.82 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
26.60 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
389 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
377 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
276 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.75 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
453 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
5.11 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
37.36 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
4.64 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
28.90 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
376 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
500 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
397 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.09 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
459 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
4.44 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
13.40 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).