mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
9fc3fc83ac
Summary: Changelog: [Internal] in this diff, i convert the following method to a C function. https://www.internalfb.com/code/fbsource/[c58818169205f1e0fa816968efdb4c3fac8333e9]/xplat/js/react-native-github/React/Views/RCTView.h?lines=43 besides for testing demonstration purposes later in the stack, C functions are a superior choice to static class methods because they incur less binary size cost (see section 4.3 of https://swolchok.github.io/objcperf/ if you're curious, and https://fb.workplace.com/groups/aexpixfn/posts/1909150855887748 for the impact of a conversion) Reviewed By: RSNara Differential Revision: D31949241 fbshipit-source-id: dd40871d48f1de168d360168c4dd60015145d7e3
23 lines
498 B
Objective-C
23 lines
498 B
Objective-C
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "RCTViewUtils.h"
|
|
|
|
#import "UIView+React.h"
|
|
|
|
UIEdgeInsets RCTContentInsets(UIView *view)
|
|
{
|
|
while (view) {
|
|
UIViewController *controller = view.reactViewController;
|
|
if (controller) {
|
|
return controller.view.safeAreaInsets;
|
|
}
|
|
view = view.superview;
|
|
}
|
|
return UIEdgeInsetsZero;
|
|
}
|