first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
#import <React/RCTViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
@interface RNCSafeAreaProviderComponentView : RCTViewComponentView
extern NSString *const RNCSafeAreaDidChange;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,154 @@
#import "RNCSafeAreaProviderComponentView.h"
#import <react/renderer/components/safeareacontext/ComponentDescriptors.h>
#import <react/renderer/components/safeareacontext/EventEmitters.h>
#import <react/renderer/components/safeareacontext/Props.h>
#import <react/renderer/components/safeareacontext/RCTComponentViewHelpers.h>
#import <React/RCTFabricComponentsPlugins.h>
#import "RNCSafeAreaUtils.h"
using namespace facebook::react;
@interface RNCSafeAreaProviderComponentView () <RCTRNCSafeAreaProviderViewProtocol>
@end
@implementation RNCSafeAreaProviderComponentView {
UIEdgeInsets _currentSafeAreaInsets;
CGRect _currentFrame;
BOOL _initialInsetsSent;
BOOL _registeredNotifications;
}
// Needed because of this: https://github.com/facebook/react-native/pull/37274
+ (void)load
{
[super load];
}
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const RNCSafeAreaProviderProps>();
_props = defaultProps;
}
return self;
}
#if !TARGET_OS_OSX
- (void)willMoveToSuperview:(UIView *)newSuperView
{
[super willMoveToSuperview:newSuperView];
if (newSuperView != nil && !_registeredNotifications) {
_registeredNotifications = YES;
[self registerNotifications];
}
}
#endif
- (void)registerNotifications
{
#if !TARGET_OS_TV && !TARGET_OS_OSX
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(invalidateSafeAreaInsets)
name:UIKeyboardDidShowNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(invalidateSafeAreaInsets)
name:UIKeyboardDidHideNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(invalidateSafeAreaInsets)
name:UIKeyboardDidChangeFrameNotification
object:nil];
#endif
}
- (void)safeAreaInsetsDidChange
{
[self invalidateSafeAreaInsets];
}
- (void)invalidateSafeAreaInsets
{
if (self.superview == nil) {
return;
}
// This gets called before the view size is set by react-native so
// make sure to wait so we don't set wrong insets to JS.
if (CGSizeEqualToSize(self.frame.size, CGSizeZero)) {
return;
}
UIEdgeInsets safeAreaInsets = self.safeAreaInsets;
CGRect frame = [self convertRect:self.bounds toView:RNCParentViewController(self).view];
if (_initialInsetsSent &&
#if TARGET_OS_IPHONE
UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale()) &&
#elif TARGET_OS_OSX
NSEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale()) &&
#endif
CGRectEqualToRect(frame, _currentFrame)) {
return;
}
_initialInsetsSent = YES;
_currentSafeAreaInsets = safeAreaInsets;
_currentFrame = frame;
[NSNotificationCenter.defaultCenter postNotificationName:RNCSafeAreaDidChange object:self userInfo:nil];
if (_eventEmitter) {
RNCSafeAreaProviderEventEmitter::OnInsetsChange event = {
.insets =
{
.top = safeAreaInsets.top,
.left = safeAreaInsets.left,
.bottom = safeAreaInsets.bottom,
.right = safeAreaInsets.right,
},
.frame =
{
.x = frame.origin.x,
.y = frame.origin.y,
.width = frame.size.width,
.height = frame.size.height,
},
};
std::static_pointer_cast<RNCSafeAreaProviderEventEmitter const>(_eventEmitter)->onInsetsChange(event);
}
}
- (void)layoutSubviews
{
[super layoutSubviews];
[self invalidateSafeAreaInsets];
}
#pragma mark - RCTComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
return concreteComponentDescriptorProvider<RNCSafeAreaProviderComponentDescriptor>();
}
- (void)prepareForRecycle
{
[super prepareForRecycle];
_currentSafeAreaInsets = UIEdgeInsetsZero;
_currentFrame = CGRectZero;
_initialInsetsSent = NO;
[NSNotificationCenter.defaultCenter removeObserver:self];
_registeredNotifications = NO;
}
@end
Class<RCTComponentViewProtocol> RNCSafeAreaProviderCls(void)
{
return RNCSafeAreaProviderComponentView.class;
}

View File

@@ -0,0 +1,15 @@
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
#import <React/RCTViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
@interface RNCSafeAreaViewComponentView : RCTViewComponentView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,175 @@
#import "RNCSafeAreaViewComponentView.h"
#import <react/renderer/components/safeareacontext/EventEmitters.h>
#import <react/renderer/components/safeareacontext/Props.h>
#import <react/renderer/components/safeareacontext/RCTComponentViewHelpers.h>
#import <react/renderer/components/safeareacontext/RNCSafeAreaViewComponentDescriptor.h>
#import <react/renderer/components/safeareacontext/RNCSafeAreaViewShadowNode.h>
#import <React/RCTConversions.h>
#import <React/RCTFabricComponentsPlugins.h>
#import "RNCSafeAreaProviderComponentView.h"
#import "RNCSafeAreaUtils.h"
using namespace facebook::react;
@interface RNCSafeAreaViewComponentView () <RCTRNCSafeAreaViewViewProtocol>
@end
@implementation RNCSafeAreaViewComponentView {
RNCSafeAreaViewShadowNode::ConcreteState::Shared _state;
UIEdgeInsets _currentSafeAreaInsets;
__weak UIView *_Nullable _providerView;
}
// Needed because of this: https://github.com/facebook/react-native/pull/37274
+ (void)load
{
[super load];
}
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const RNCSafeAreaViewProps>();
_props = defaultProps;
}
return self;
}
- (NSString *)description
{
NSString *superDescription = [super description];
// Cutting the last `>` character.
if (superDescription.length > 0 && [superDescription characterAtIndex:superDescription.length - 1] == '>') {
superDescription = [superDescription substringToIndex:superDescription.length - 1];
}
#if TARGET_OS_IPHONE
NSString *providerViewSafeAreaInsetsString = NSStringFromUIEdgeInsets(_providerView.safeAreaInsets);
NSString *currentSafeAreaInsetsString = NSStringFromUIEdgeInsets(_currentSafeAreaInsets);
#elif TARGET_OS_OSX
NSString *providerViewSafeAreaInsetsString = [NSString stringWithFormat:@"{%f,%f,%f,%f}",
_providerView.safeAreaInsets.top,
_providerView.safeAreaInsets.left,
_providerView.safeAreaInsets.bottom,
_providerView.safeAreaInsets.right];
NSString *currentSafeAreaInsetsString = [NSString stringWithFormat:@"{%f,%f,%f,%f}",
_currentSafeAreaInsets.top,
_currentSafeAreaInsets.left,
_currentSafeAreaInsets.bottom,
_currentSafeAreaInsets.right];
#endif
return [NSString stringWithFormat:@"%@; RNCSafeAreaInsets = %@; appliedRNCSafeAreaInsets = %@>",
superDescription,
providerViewSafeAreaInsetsString,
currentSafeAreaInsetsString];
}
- (void)didMoveToWindow
{
UIView *previousProviderView = _providerView;
_providerView = [self findNearestProvider];
[self updateStateIfNecessary];
if (previousProviderView != _providerView) {
[NSNotificationCenter.defaultCenter removeObserver:self name:RNCSafeAreaDidChange object:previousProviderView];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(safeAreaProviderInsetsDidChange:)
name:RNCSafeAreaDidChange
object:_providerView];
}
}
- (void)safeAreaProviderInsetsDidChange:(NSNotification *)notification
{
[self updateStateIfNecessary];
}
- (void)updateStateIfNecessary
{
if (_providerView == nil) {
return;
}
#if TARGET_OS_IPHONE
UIEdgeInsets safeAreaInsets = _providerView.safeAreaInsets;
if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale())) {
return;
}
#elif TARGET_OS_OSX
NSEdgeInsets safeAreaInsets = _providerView.safeAreaInsets;
if (NSEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale())) {
return;
}
#endif
_currentSafeAreaInsets = safeAreaInsets;
[self updateState];
}
- (UIView *)findNearestProvider
{
UIView *current = self.superview;
while (current != nil) {
if ([current isKindOfClass:RNCSafeAreaProviderComponentView.class]) {
return current;
}
current = current.superview;
}
return self;
}
- (void)updateState
{
if (!_state) {
return;
}
_state->updateState(
[=](RNCSafeAreaViewShadowNode::ConcreteState::Data const &oldData)
-> RNCSafeAreaViewShadowNode::ConcreteState::SharedData {
auto newData = oldData;
newData.insets = RCTEdgeInsetsFromUIEdgeInsets(_currentSafeAreaInsets);
return std::make_shared<RNCSafeAreaViewShadowNode::ConcreteState::Data const>(newData);
});
}
#pragma mark - RCTComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
return concreteComponentDescriptorProvider<RNCSafeAreaViewComponentDescriptor>();
}
- (void)updateState:(State::Shared const &)state oldState:(State::Shared const &)oldState
{
_state = std::static_pointer_cast<RNCSafeAreaViewShadowNode::ConcreteState const>(state);
}
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask
{
[super finalizeUpdates:updateMask];
[self updateStateIfNecessary];
}
- (void)prepareForRecycle
{
[super prepareForRecycle];
[NSNotificationCenter.defaultCenter removeObserver:self];
_state.reset();
_providerView = nil;
_currentSafeAreaInsets = UIEdgeInsetsZero;
}
@end
Class<RCTComponentViewProtocol> RNCSafeAreaViewCls(void)
{
return RNCSafeAreaViewComponentView.class;
}

View File

@@ -0,0 +1,12 @@
#import <Foundation/Foundation.h>
#import <React/RCTEventDispatcherProtocol.h>
@interface RNCOnInsetsChangeEvent : NSObject <RCTEvent>
- (instancetype)initWithEventName:(NSString *)eventName
reactTag:(NSNumber *)reactTag
insets:(UIEdgeInsets)insets
frame:(CGRect)frame
coalescingKey:(uint16_t)coalescingKey NS_DESIGNATED_INITIALIZER;
@end

View File

@@ -0,0 +1,79 @@
#import "RNCOnInsetsChangeEvent.h"
#import <React/RCTAssert.h>
@implementation RNCOnInsetsChangeEvent {
UIEdgeInsets _insets;
CGRect _frame;
uint16_t _coalescingKey;
}
@synthesize eventName = _eventName;
@synthesize viewTag = _viewTag;
- (instancetype)initWithEventName:(NSString *)eventName
reactTag:(NSNumber *)reactTag
insets:(UIEdgeInsets)insets
frame:(CGRect)frame
coalescingKey:(uint16_t)coalescingKey
{
RCTAssertParam(reactTag);
if ((self = [super init])) {
_eventName = [eventName copy];
_viewTag = reactTag;
_frame = frame;
_insets = insets;
_coalescingKey = coalescingKey;
}
return self;
}
RCT_NOT_IMPLEMENTED(-(instancetype)init)
- (uint16_t)coalescingKey
{
return _coalescingKey;
}
- (NSDictionary *)body
{
NSDictionary *body = @{
@"insets" : @{
@"top" : @(_insets.top),
@"right" : @(_insets.right),
@"bottom" : @(_insets.bottom),
@"left" : @(_insets.left),
},
@"frame" : @{
@"x" : @(_frame.origin.x),
@"y" : @(_frame.origin.y),
@"width" : @(_frame.size.width),
@"height" : @(_frame.size.height),
},
};
return body;
}
- (BOOL)canCoalesce
{
return YES;
}
- (RNCOnInsetsChangeEvent *)coalesceWithEvent:(RNCOnInsetsChangeEvent *)newEvent
{
return newEvent;
}
+ (NSString *)moduleDotMethod
{
return @"RCTEventEmitter.receiveEvent";
}
- (NSArray *)arguments
{
return @[ self.viewTag, RCTNormalizeInputEventName(self.eventName), [self body] ];
}
@end

View File

@@ -0,0 +1,9 @@
#import <React/RCTBridgeModule.h>
NS_ASSUME_NONNULL_BEGIN
@interface RNCSafeAreaContext : NSObject <RCTBridgeModule>
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,85 @@
#import "RNCSafeAreaContext.h"
#import <React/RCTUtils.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
#ifdef RCT_NEW_ARCH_ENABLED
#import <safeareacontext/safeareacontext.h>
#endif
#ifdef RCT_NEW_ARCH_ENABLED
using namespace facebook::react;
@interface RNCSafeAreaContext () <NativeSafeAreaContextSpec>
@end
#endif
@implementation RNCSafeAreaContext
RCT_EXPORT_MODULE()
+ (BOOL)requiresMainQueueSetup
{
return YES;
}
- (NSDictionary *)constantsToExport
{
return [self getConstants];
}
- (NSDictionary *)getConstants
{
__block NSDictionary *constants;
RCTUnsafeExecuteOnMainQueueSync(^{
#if TARGET_OS_IPHONE
UIWindow *window = RCTKeyWindow();
#elif TARGET_OS_OSX
NSWindow *window = RCTKeyWindow();
#endif
if (window == nil) {
constants = @{@"initialWindowMetrics" : [NSNull null]};
return;
}
#if TARGET_OS_IPHONE
UIEdgeInsets safeAreaInsets = window.safeAreaInsets;
#elif TARGET_OS_OSX
NSEdgeInsets safeAreaInsets = NSEdgeInsetsZero;
#endif
constants = @{
@"initialWindowMetrics" : @{
@"insets" : @{
@"top" : @(safeAreaInsets.top),
@"right" : @(safeAreaInsets.right),
@"bottom" : @(safeAreaInsets.bottom),
@"left" : @(safeAreaInsets.left),
},
@"frame" : @{
@"x" : @(window.frame.origin.x),
@"y" : @(window.frame.origin.y),
@"width" : @(window.frame.size.width),
@"height" : @(window.frame.size.height),
},
}
};
});
return constants;
}
#ifdef RCT_NEW_ARCH_ENABLED
- (std::shared_ptr<TurboModule>)getTurboModule:(const ObjCTurboModule::InitParams &)params
{
return std::make_shared<NativeSafeAreaContextSpecJSI>(params);
}
#endif
@end

View File

@@ -0,0 +1,23 @@
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTView.h>
NS_ASSUME_NONNULL_BEGIN
@interface RNCSafeAreaProvider : RCTView
- (instancetype)initWithEventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher NS_DESIGNATED_INITIALIZER;
// NOTE: currently these event props are only declared so we can export the
// event names to JS - we don't call the blocks directly because events
// need to be coalesced before sending, for performance reasons.
@property (nonatomic, copy) RCTBubblingEventBlock onInsetsChange;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,115 @@
#import "RNCSafeAreaProvider.h"
#import <React/RCTBridge.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUIManager.h>
#import <React/RCTUIManagerObserverCoordinator.h>
#import "RNCOnInsetsChangeEvent.h"
#import "RNCSafeAreaUtils.h"
@interface RNCSafeAreaProvider () <RCTUIManagerObserver>
@end
@implementation RNCSafeAreaProvider {
id<RCTEventDispatcherProtocol> _eventDispatcher;
UIEdgeInsets _currentSafeAreaInsets;
CGRect _currentFrame;
BOOL _initialInsetsSent;
}
- (instancetype)initWithEventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher
{
RCTAssertParam(eventDispatcher);
if ((self = [super initWithFrame:CGRectZero])) {
_eventDispatcher = eventDispatcher;
#if !TARGET_OS_TV && !TARGET_OS_OSX
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(invalidateSafeAreaInsets)
name:UIKeyboardDidShowNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(invalidateSafeAreaInsets)
name:UIKeyboardDidHideNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(invalidateSafeAreaInsets)
name:UIKeyboardDidChangeFrameNotification
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(invalidateSafeAreaInsets)
name:UIWindowDidBecomeVisibleNotification
object:nil];
#endif
}
return self;
}
- (void)safeAreaInsetsDidChange
{
[self invalidateSafeAreaInsets];
}
- (void)invalidateSafeAreaInsets
{
// This gets called before the view size is set by react-native so
// make sure to wait so we don't set wrong insets to JS.
if (CGSizeEqualToSize(self.frame.size, CGSizeZero)) {
return;
}
#if TARGET_OS_IPHONE
UIEdgeInsets safeAreaInsets = self.safeAreaInsets;
#elif TARGET_OS_OSX
NSEdgeInsets safeAreaInsets;
if (@available(macOS 11.0, *)) {
safeAreaInsets = self.safeAreaInsets;
} else {
safeAreaInsets = NSEdgeInsetsZero;
}
#endif
CGRect frame = [self convertRect:self.bounds toView:RNCParentViewController(self).view];
if (_initialInsetsSent &&
#if TARGET_OS_IPHONE
UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale()) &&
#elif TARGET_OS_OSX
NSEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale()) &&
#endif
CGRectEqualToRect(frame, _currentFrame)) {
return;
}
_initialInsetsSent = YES;
_currentSafeAreaInsets = safeAreaInsets;
_currentFrame = frame;
[NSNotificationCenter.defaultCenter postNotificationName:RNCSafeAreaDidChange object:self userInfo:nil];
RNCOnInsetsChangeEvent *onInsetsChangeEvent = [[RNCOnInsetsChangeEvent alloc] initWithEventName:@"onInsetsChange"
reactTag:self.reactTag
insets:safeAreaInsets
frame:frame
coalescingKey:0];
[_eventDispatcher sendEvent:onInsetsChangeEvent];
}
- (void)layoutSubviews
{
[super layoutSubviews];
[self invalidateSafeAreaInsets];
}
RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
- (void)dealloc
{
[_eventDispatcher.bridge.uiManager.observerCoordinator removeObserver:self];
}
@end

View File

@@ -0,0 +1,9 @@
#import <React/RCTViewManager.h>
NS_ASSUME_NONNULL_BEGIN
@interface RNCSafeAreaProviderManager : RCTViewManager
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,20 @@
#import "RNCSafeAreaProviderManager.h"
#import "RNCSafeAreaProvider.h"
@implementation RNCSafeAreaProviderManager
RCT_EXPORT_MODULE(RNCSafeAreaProvider)
RCT_EXPORT_VIEW_PROPERTY(onInsetsChange, RCTDirectEventBlock)
#if TARGET_OS_IPHONE
- (UIView *)view
#elif TARGET_OS_OSX
- (NSView *)view
#endif
{
return [[RNCSafeAreaProvider alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
}
@end

View File

@@ -0,0 +1,9 @@
#import <React/RCTShadowView.h>
NS_ASSUME_NONNULL_BEGIN
@interface RNCSafeAreaShadowView : RCTShadowView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,194 @@
#import "RNCSafeAreaShadowView.h"
#import <React/RCTAssert.h>
#include <math.h>
#import "RNCSafeAreaViewEdgeMode.h"
#import "RNCSafeAreaViewEdges.h"
#import "RNCSafeAreaViewLocalData.h"
#import "RNCSafeAreaViewMode.h"
// From RCTShadowView.m
typedef NS_ENUM(unsigned int, meta_prop_t) {
META_PROP_LEFT,
META_PROP_TOP,
META_PROP_RIGHT,
META_PROP_BOTTOM,
META_PROP_HORIZONTAL,
META_PROP_VERTICAL,
META_PROP_ALL,
META_PROP_COUNT,
};
@implementation RNCSafeAreaShadowView {
RNCSafeAreaViewLocalData *_localData;
bool _needsUpdate;
YGValue _paddingMetaProps[META_PROP_COUNT];
YGValue _marginMetaProps[META_PROP_COUNT];
}
- (instancetype)init
{
self = [super init];
if (self) {
_needsUpdate = false;
for (unsigned int ii = 0; ii < META_PROP_COUNT; ii++) {
_paddingMetaProps[ii] = YGValueUndefined;
_marginMetaProps[ii] = YGValueUndefined;
}
}
return self;
}
- (void)extractEdges:(YGValue[])_metaProps
top:(CGFloat *)top
right:(CGFloat *)right
bottom:(CGFloat *)bottom
left:(CGFloat *)left
{
if (_metaProps[META_PROP_ALL].unit == YGUnitPoint) {
*top = _metaProps[META_PROP_ALL].value;
*right = _metaProps[META_PROP_ALL].value;
*bottom = _metaProps[META_PROP_ALL].value;
*left = _metaProps[META_PROP_ALL].value;
}
if (_metaProps[META_PROP_HORIZONTAL].unit == YGUnitPoint) {
*right = _metaProps[META_PROP_HORIZONTAL].value;
*left = _metaProps[META_PROP_HORIZONTAL].value;
}
if (_metaProps[META_PROP_VERTICAL].unit == YGUnitPoint) {
*top = _metaProps[META_PROP_VERTICAL].value;
*bottom = _metaProps[META_PROP_VERTICAL].value;
}
if (_metaProps[META_PROP_TOP].unit == YGUnitPoint) {
*top = _metaProps[META_PROP_TOP].value;
}
if (_metaProps[META_PROP_RIGHT].unit == YGUnitPoint) {
*right = _metaProps[META_PROP_RIGHT].value;
}
if (_metaProps[META_PROP_BOTTOM].unit == YGUnitPoint) {
*bottom = _metaProps[META_PROP_BOTTOM].value;
}
if (_metaProps[META_PROP_LEFT].unit == YGUnitPoint) {
*left = _metaProps[META_PROP_LEFT].value;
}
}
- (void)resetInsetsForMode:(RNCSafeAreaViewMode)mode
{
if (mode == RNCSafeAreaViewModePadding) {
super.paddingTop = _paddingMetaProps[META_PROP_TOP];
super.paddingRight = _paddingMetaProps[META_PROP_RIGHT];
super.paddingBottom = _paddingMetaProps[META_PROP_BOTTOM];
super.paddingLeft = _paddingMetaProps[META_PROP_LEFT];
} else if (mode == RNCSafeAreaViewModeMargin) {
super.marginTop = _marginMetaProps[META_PROP_TOP];
super.marginRight = _marginMetaProps[META_PROP_RIGHT];
super.marginBottom = _marginMetaProps[META_PROP_BOTTOM];
super.marginLeft = _marginMetaProps[META_PROP_LEFT];
}
}
- (void)updateInsets
{
if (_localData == nil) {
return;
}
UIEdgeInsets insets = _localData.insets;
RNCSafeAreaViewMode mode = _localData.mode;
RNCSafeAreaViewEdges edges = _localData.edges;
CGFloat top = 0;
CGFloat right = 0;
CGFloat bottom = 0;
CGFloat left = 0;
if (mode == RNCSafeAreaViewModePadding) {
[self extractEdges:_paddingMetaProps top:&top right:&right bottom:&bottom left:&left];
super.paddingTop = (YGValue){[self getEdgeValue:edges.top insetValue:insets.top edgeValue:top], YGUnitPoint};
super.paddingRight =
(YGValue){[self getEdgeValue:edges.right insetValue:insets.right edgeValue:right], YGUnitPoint};
super.paddingBottom =
(YGValue){[self getEdgeValue:edges.bottom insetValue:insets.bottom edgeValue:bottom], YGUnitPoint};
super.paddingLeft = (YGValue){[self getEdgeValue:edges.left insetValue:insets.left edgeValue:left], YGUnitPoint};
} else if (mode == RNCSafeAreaViewModeMargin) {
[self extractEdges:_marginMetaProps top:&top right:&right bottom:&bottom left:&left];
super.marginTop = (YGValue){[self getEdgeValue:edges.top insetValue:insets.top edgeValue:top], YGUnitPoint};
super.marginRight = (YGValue){[self getEdgeValue:edges.right insetValue:insets.right edgeValue:right], YGUnitPoint};
super.marginBottom =
(YGValue){[self getEdgeValue:edges.bottom insetValue:insets.bottom edgeValue:bottom], YGUnitPoint};
super.marginLeft = (YGValue){[self getEdgeValue:edges.left insetValue:insets.left edgeValue:left], YGUnitPoint};
}
}
- (CGFloat)getEdgeValue:(RNCSafeAreaViewEdgeMode)edgeMode insetValue:(CGFloat)insetValue edgeValue:(CGFloat)edgeValue
{
if (edgeMode == RNCSafeAreaViewEdgeModeOff) {
return edgeValue;
} else if (edgeMode == RNCSafeAreaViewEdgeModeMaximum) {
return MAX(insetValue, edgeValue);
} else {
return insetValue + edgeValue;
}
}
- (void)didSetProps:(NSArray<NSString *> *)changedProps
{
if (_needsUpdate) {
_needsUpdate = false;
[self updateInsets];
}
[super didSetProps:changedProps];
}
- (void)setLocalData:(RNCSafeAreaViewLocalData *)localData
{
RCTAssert(
[localData isKindOfClass:[RNCSafeAreaViewLocalData class]],
@"Local data object for `RCTRNCSafeAreaShadowView` must be `RCTRNCSafeAreaViewLocalData` instance.");
if (_localData != nil && _localData.mode != localData.mode) {
[self resetInsetsForMode:_localData.mode];
}
_localData = localData;
_needsUpdate = false;
[self updateInsets];
if (_localData.mode == RNCSafeAreaViewModePadding) {
[super didSetProps:@[ @"paddingTop", @"paddingRight", @"paddingBottom", @"paddingLeft" ]];
} else {
[super didSetProps:@[ @"marginTop", @"marginRight", @"marginBottom", @"marginLeft" ]];
}
}
#define SHADOW_VIEW_MARGIN_PADDING_PROP(edge, metaProp) \
-(void)setPadding##edge : (YGValue)value \
{ \
[super setPadding##edge:value]; \
_needsUpdate = true; \
_paddingMetaProps[META_PROP_##metaProp] = value; \
} \
-(void)setMargin##edge : (YGValue)value \
{ \
[super setMargin##edge:value]; \
_needsUpdate = true; \
_marginMetaProps[META_PROP_##metaProp] = value; \
}
SHADOW_VIEW_MARGIN_PADDING_PROP(, ALL);
SHADOW_VIEW_MARGIN_PADDING_PROP(Vertical, VERTICAL);
SHADOW_VIEW_MARGIN_PADDING_PROP(Horizontal, HORIZONTAL);
SHADOW_VIEW_MARGIN_PADDING_PROP(Top, TOP);
SHADOW_VIEW_MARGIN_PADDING_PROP(Right, RIGHT);
SHADOW_VIEW_MARGIN_PADDING_PROP(Bottom, BOTTOM);
SHADOW_VIEW_MARGIN_PADDING_PROP(Left, LEFT);
@end

View File

@@ -0,0 +1,23 @@
#import <React/RCTDefines.h>
#import <React/RCTView.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
typedef NSView UIView;
#endif
extern NSString *const RNCSafeAreaDidChange;
RCT_EXTERN BOOL
#if TARGET_OS_IPHONE
UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIEdgeInsets insets2, CGFloat threshold);
#elif TARGET_OS_OSX
NSEdgeInsetsEqualToEdgeInsetsWithThreshold(NSEdgeInsets insets1, NSEdgeInsets insets2, CGFloat threshold);
#endif
#if TARGET_OS_IPHONE
RCT_EXTERN UIViewController *RNCParentViewController(UIView *view);
#elif TARGET_OS_OSX
RCT_EXTERN NSViewController *RNCParentViewController(NSView *view);
#endif

View File

@@ -0,0 +1,41 @@
#import "RNCSafeAreaUtils.h"
#import <React/RCTUIManager.h>
NSString *const RNCSafeAreaDidChange = @"RNCSafeAreaDidChange";
#if TARGET_OS_IPHONE
BOOL UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIEdgeInsets insets2, CGFloat threshold)
#elif TARGET_OS_OSX
BOOL NSEdgeInsetsEqualToEdgeInsetsWithThreshold(NSEdgeInsets insets1, NSEdgeInsets insets2, CGFloat threshold)
#endif
{
return ABS(insets1.left - insets2.left) <= threshold && ABS(insets1.right - insets2.right) <= threshold &&
ABS(insets1.top - insets2.top) <= threshold && ABS(insets1.bottom - insets2.bottom) <= threshold;
}
#if TARGET_OS_IPHONE
UIViewController *RNCParentViewController(UIView *view)
{
UIResponder *responder = view.nextResponder;
while (responder != nil) {
if ([responder isKindOfClass:[UIViewController class]]) {
return (UIViewController *)responder;
}
responder = responder.nextResponder;
}
return nil;
}
#elif TARGET_OS_OSX
NSViewController *RNCParentViewController(NSView *view)
{
NSResponder *responder = view.nextResponder;
while (responder != nil) {
if ([responder isKindOfClass:[NSViewController class]]) {
return (NSViewController *)responder;
}
responder = responder.nextResponder;
}
return nil;
}
#endif

View File

@@ -0,0 +1,25 @@
#import <React/RCTBridge.h>
#import <React/RCTView.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
#import "RNCSafeAreaViewEdges.h"
#import "RNCSafeAreaViewMode.h"
NS_ASSUME_NONNULL_BEGIN
@class RNCSafeAreaView;
@interface RNCSafeAreaView : RCTView
- (instancetype)initWithBridge:(RCTBridge *)bridge;
@property (nonatomic, assign) RNCSafeAreaViewMode mode;
@property (nonatomic, assign) RNCSafeAreaViewEdges edges;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,168 @@
#import "RNCSafeAreaView.h"
#import <React/RCTBridge.h>
#import <React/RCTUIManager.h>
#import "RNCSafeAreaProvider.h"
#import "RNCSafeAreaUtils.h"
#import "RNCSafeAreaViewEdges.h"
#import "RNCSafeAreaViewLocalData.h"
#import "RNCSafeAreaViewMode.h"
@implementation RNCSafeAreaView {
__weak RCTBridge *_bridge;
#if TARGET_OS_IPHONE
UIEdgeInsets _currentSafeAreaInsets;
#elif TARGET_OS_OSX
NSEdgeInsets _currentSafeAreaInsets;
#endif
RNCSafeAreaViewMode _mode;
RNCSafeAreaViewEdges _edges;
__weak RNCSafeAreaProvider *_Nullable _providerView;
}
- (instancetype)initWithBridge:(RCTBridge *)bridge
{
if (self = [super initWithFrame:CGRectZero]) {
_bridge = bridge;
// Defaults
_mode = RNCSafeAreaViewModePadding;
_edges = RNCSafeAreaViewEdgesMake(
RNCSafeAreaViewEdgeModeOff, RNCSafeAreaViewEdgeModeOff, RNCSafeAreaViewEdgeModeOff, RNCSafeAreaViewEdgeModeOff);
}
return self;
}
RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
- (NSString *)description
{
NSString *superDescription = [super description];
// Cutting the last `>` character.
if (superDescription.length > 0 && [superDescription characterAtIndex:superDescription.length - 1] == '>') {
superDescription = [superDescription substringToIndex:superDescription.length - 1];
}
#if TARGET_OS_IPHONE
NSString *providerViewSafeAreaInsetsString = NSStringFromUIEdgeInsets(_providerView.safeAreaInsets);
NSString *currentSafeAreaInsetsString = NSStringFromUIEdgeInsets(_currentSafeAreaInsets);
#elif TARGET_OS_OSX
NSString *providerViewSafeAreaInsetsString;
NSString *currentSafeAreaInsetsString;
if (@available(macOS 11.0, *)) {
providerViewSafeAreaInsetsString = [NSString stringWithFormat:@"{%f,%f,%f,%f}",
_providerView.safeAreaInsets.top,
_providerView.safeAreaInsets.left,
_providerView.safeAreaInsets.bottom,
_providerView.safeAreaInsets.right];
currentSafeAreaInsetsString = [NSString stringWithFormat:@"{%f,%f,%f,%f}",
_currentSafeAreaInsets.top,
_currentSafeAreaInsets.left,
_currentSafeAreaInsets.bottom,
_currentSafeAreaInsets.right];
} else {
providerViewSafeAreaInsetsString = @"{0.0,0.0,0.0,0.0}";
currentSafeAreaInsetsString = @"{0.0,0.0,0.0,0.0}";
}
#endif
return [NSString stringWithFormat:@"%@; RNCSafeAreaInsets = %@; appliedRNCSafeAreaInsets = %@>",
superDescription,
providerViewSafeAreaInsetsString,
currentSafeAreaInsetsString];
}
- (void)didMoveToWindow
{
#if TARGET_OS_IPHONE
UIView *previousProviderView = _providerView;
#elif TARGET_OS_OSX
NSView *previousProviderView = _providerView;
#endif
_providerView = [self findNearestProvider];
[self invalidateSafeAreaInsets];
if (previousProviderView != _providerView) {
if (previousProviderView != nil) {
[NSNotificationCenter.defaultCenter removeObserver:self name:RNCSafeAreaDidChange object:previousProviderView];
}
if (_providerView != nil) {
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(safeAreaProviderInsetsDidChange:)
name:RNCSafeAreaDidChange
object:_providerView];
}
}
}
- (void)safeAreaProviderInsetsDidChange:(NSNotification *)notification
{
[self invalidateSafeAreaInsets];
}
- (void)invalidateSafeAreaInsets
{
if (_providerView == nil) {
return;
}
#if TARGET_OS_IPHONE
UIEdgeInsets safeAreaInsets = _providerView.safeAreaInsets;
if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale())) {
return;
}
#elif TARGET_OS_OSX
NSEdgeInsets safeAreaInsets = _providerView.safeAreaInsets;
if (NSEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale())) {
return;
}
#endif
_currentSafeAreaInsets = safeAreaInsets;
[self updateLocalData];
}
- (nullable RNCSafeAreaProvider *)findNearestProvider
{
#if TARGET_OS_IPHONE
UIView *current = self.reactSuperview;
#elif TARGET_OS_OSX
NSView *current = self.reactSuperview;
#endif
while (current != nil) {
if ([current isKindOfClass:RNCSafeAreaProvider.class]) {
return (RNCSafeAreaProvider *)current;
}
current = current.reactSuperview;
}
return nil;
}
- (void)updateLocalData
{
if (_providerView == nil) {
return;
}
RNCSafeAreaViewLocalData *localData = [[RNCSafeAreaViewLocalData alloc] initWithInsets:_currentSafeAreaInsets
mode:_mode
edges:_edges];
[_bridge.uiManager setLocalData:localData forView:self];
}
- (void)setMode:(RNCSafeAreaViewMode)mode
{
_mode = mode;
[self updateLocalData];
}
- (void)setEdges:(RNCSafeAreaViewEdges)edges
{
_edges = edges;
[self updateLocalData];
}
@end

View File

@@ -0,0 +1,12 @@
#import <Foundation/Foundation.h>
#import <React/RCTConvert.h>
typedef NS_ENUM(NSInteger, RNCSafeAreaViewEdgeMode) {
RNCSafeAreaViewEdgeModeOff,
RNCSafeAreaViewEdgeModeAdditive,
RNCSafeAreaViewEdgeModeMaximum
};
@interface RCTConvert (RNCSafeAreaViewEdgeMode)
+ (RNCSafeAreaViewEdgeMode)RNCSafeAreaViewEdgeMode:(nullable id)json;
@end

View File

@@ -0,0 +1,16 @@
#import "RNCSafeAreaViewEdgeMode.h"
#import <React/RCTConvert.h>
@implementation RCTConvert (RNCSafeAreaViewEdgeMode)
RCT_ENUM_CONVERTER(
RNCSafeAreaViewEdgeMode,
(@{
@"off" : @(RNCSafeAreaViewEdgeModeOff),
@"additive" : @(RNCSafeAreaViewEdgeModeAdditive),
@"maximum" : @(RNCSafeAreaViewEdgeModeMaximum),
}),
RNCSafeAreaViewEdgeModeOff,
integerValue);
@end

View File

@@ -0,0 +1,15 @@
#import <Foundation/Foundation.h>
#import "RNCSafeAreaViewEdgeMode.h"
typedef struct RNCSafeAreaViewEdges {
RNCSafeAreaViewEdgeMode top;
RNCSafeAreaViewEdgeMode right;
RNCSafeAreaViewEdgeMode bottom;
RNCSafeAreaViewEdgeMode left;
} RNCSafeAreaViewEdges;
RNCSafeAreaViewEdges RNCSafeAreaViewEdgesMake(
RNCSafeAreaViewEdgeMode top,
RNCSafeAreaViewEdgeMode right,
RNCSafeAreaViewEdgeMode bottom,
RNCSafeAreaViewEdgeMode left);

View File

@@ -0,0 +1,36 @@
#import "RNCSafeAreaViewEdges.h"
#import <React/RCTConvert.h>
#import "RNCSafeAreaViewEdgeMode.h"
RNCSafeAreaViewEdges RNCSafeAreaViewEdgesMake(
RNCSafeAreaViewEdgeMode top,
RNCSafeAreaViewEdgeMode right,
RNCSafeAreaViewEdgeMode bottom,
RNCSafeAreaViewEdgeMode left)
{
RNCSafeAreaViewEdges edges;
edges.top = top;
edges.left = left;
edges.bottom = bottom;
edges.right = right;
return edges;
}
RNCSafeAreaViewEdges RNCSafeAreaViewEdgesMakeString(NSString *top, NSString *right, NSString *bottom, NSString *left)
{
RNCSafeAreaViewEdges edges;
edges.top = [RCTConvert RNCSafeAreaViewEdgeMode:top];
edges.right = [RCTConvert RNCSafeAreaViewEdgeMode:right];
edges.bottom = [RCTConvert RNCSafeAreaViewEdgeMode:bottom];
edges.left = [RCTConvert RNCSafeAreaViewEdgeMode:left];
return edges;
}
@implementation RCTConvert (RNCSafeAreaViewEdges)
RCT_CUSTOM_CONVERTER(
RNCSafeAreaViewEdges,
RNCSafeAreaViewEdges,
RNCSafeAreaViewEdgesMakeString(json[@"top"], json[@"right"], json[@"bottom"], json[@"left"]))
@end

View File

@@ -0,0 +1,29 @@
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
#import "RNCSafeAreaViewEdges.h"
#import "RNCSafeAreaViewMode.h"
NS_ASSUME_NONNULL_BEGIN
@interface RNCSafeAreaViewLocalData : NSObject
#if TARGET_OS_IPHONE
- (instancetype)initWithInsets:(UIEdgeInsets)insets mode:(RNCSafeAreaViewMode)mode edges:(RNCSafeAreaViewEdges)edges;
@property (atomic, readonly) UIEdgeInsets insets;
#elif TARGET_OS_OSX
- (instancetype)initWithInsets:(NSEdgeInsets)insets mode:(RNCSafeAreaViewMode)mode edges:(RNCSafeAreaViewEdges)edges;
@property (atomic, readonly) NSEdgeInsets insets;
#endif
@property (atomic, readonly) RNCSafeAreaViewMode mode;
@property (atomic, readonly) RNCSafeAreaViewEdges edges;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,20 @@
#import "RNCSafeAreaViewLocalData.h"
@implementation RNCSafeAreaViewLocalData
#if TARGET_OS_IPHONE
- (instancetype)initWithInsets:(UIEdgeInsets)insets mode:(RNCSafeAreaViewMode)mode edges:(RNCSafeAreaViewEdges)edges
#elif TARGET_OS_OSX
- (instancetype)initWithInsets:(NSEdgeInsets)insets mode:(RNCSafeAreaViewMode)mode edges:(RNCSafeAreaViewEdges)edges
#endif
{
if (self = [super init]) {
_insets = insets;
_mode = mode;
_edges = edges;
}
return self;
}
@end

View File

@@ -0,0 +1,9 @@
#import <React/RCTViewManager.h>
NS_ASSUME_NONNULL_BEGIN
@interface RNCSafeAreaViewManager : RCTViewManager
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,29 @@
#import "RNCSafeAreaViewManager.h"
#import "RNCSafeAreaShadowView.h"
#import "RNCSafeAreaView.h"
#import "RNCSafeAreaViewEdges.h"
#import "RNCSafeAreaViewMode.h"
@implementation RNCSafeAreaViewManager
RCT_EXPORT_MODULE(RNCSafeAreaView)
#if TARGET_OS_IPHONE
- (UIView *)view
#elif TARGET_OS_OSX
- (NSView *)view
#endif
{
return [[RNCSafeAreaView alloc] initWithBridge:self.bridge];
}
- (RNCSafeAreaShadowView *)shadowView
{
return [RNCSafeAreaShadowView new];
}
RCT_EXPORT_VIEW_PROPERTY(mode, RNCSafeAreaViewMode)
RCT_EXPORT_VIEW_PROPERTY(edges, RNCSafeAreaViewEdges)
@end

View File

@@ -0,0 +1,7 @@
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, RNCSafeAreaViewMode) {
RNCSafeAreaViewModePadding,
RNCSafeAreaViewModeMargin,
RNCSafeAreaViewModeBorder,
};

View File

@@ -0,0 +1,15 @@
#import "RNCSafeAreaViewMode.h"
#import <React/RCTConvert.h>
@implementation RCTConvert (RNCSafeAreaView)
RCT_MULTI_ENUM_CONVERTER(
RNCSafeAreaViewMode,
(@{
@"padding" : @(RNCSafeAreaViewModePadding),
@"margin" : @(RNCSafeAreaViewModeMargin),
}),
RNCSafeAreaViewModePadding,
integerValue);
@end

View File

@@ -0,0 +1,358 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
0C7844E127C02CEE001807FB /* RNCSafeAreaViewLocalData.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844D227C02CEE001807FB /* RNCSafeAreaViewLocalData.m */; };
0C7844E227C02CEE001807FB /* RNCSafeAreaViewMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844D327C02CEE001807FB /* RNCSafeAreaViewMode.m */; };
0C7844E327C02CEE001807FB /* RNCSafeAreaShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844D527C02CEE001807FB /* RNCSafeAreaShadowView.m */; };
0C7844E427C02CEE001807FB /* RNCSafeAreaProviderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844D627C02CEE001807FB /* RNCSafeAreaProviderManager.m */; };
0C7844E527C02CEE001807FB /* RNCSafeAreaViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844D927C02CEE001807FB /* RNCSafeAreaViewManager.m */; };
0C7844E627C02CEE001807FB /* RNCSafeAreaViewEdges.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844DE27C02CEE001807FB /* RNCSafeAreaViewEdges.m */; };
0C7844E727C02CEE001807FB /* RNCSafeAreaUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844DF27C02CEE001807FB /* RNCSafeAreaUtils.m */; };
0C7844E827C02CEE001807FB /* RNCSafeAreaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844E027C02CEE001807FB /* RNCSafeAreaView.m */; };
0C7844EF27C02D03001807FB /* RNCSafeAreaContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844EA27C02D03001807FB /* RNCSafeAreaContext.mm */; };
0C7844F027C02D03001807FB /* RNCSafeAreaProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C7844ED27C02D03001807FB /* RNCSafeAreaProvider.m */; };
AA53A9EE2A321C01009AB3B2 /* RNCSafeAreaViewEdgeModes.m in Sources */ = {isa = PBXBuildFile; fileRef = AA53A9ED2A321C01009AB3B2 /* RNCSafeAreaViewEdgeModes.m */; };
C923EDBC220C2C1A00D3100F /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C923EDBB220C2C1A00D3100F /* SystemConfiguration.framework */; };
D697AA982D6F1D0A009C6433 /* RNCChangeEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = D697AA972D6F1D08009C6433 /* RNCChangeEvent.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
58B511D91A9E6C8500147676 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0C7844D227C02CEE001807FB /* RNCSafeAreaViewLocalData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaViewLocalData.m; sourceTree = "<group>"; };
0C7844D327C02CEE001807FB /* RNCSafeAreaViewMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaViewMode.m; sourceTree = "<group>"; };
0C7844D427C02CEE001807FB /* RNCSafeAreaViewLocalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaViewLocalData.h; sourceTree = "<group>"; };
0C7844D527C02CEE001807FB /* RNCSafeAreaShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaShadowView.m; sourceTree = "<group>"; };
0C7844D627C02CEE001807FB /* RNCSafeAreaProviderManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaProviderManager.m; sourceTree = "<group>"; };
0C7844D727C02CEE001807FB /* RNCSafeAreaShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaShadowView.h; sourceTree = "<group>"; };
0C7844D827C02CEE001807FB /* RNCSafeAreaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaView.h; sourceTree = "<group>"; };
0C7844D927C02CEE001807FB /* RNCSafeAreaViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaViewManager.m; sourceTree = "<group>"; };
0C7844DA27C02CEE001807FB /* RNCSafeAreaViewEdges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaViewEdges.h; sourceTree = "<group>"; };
0C7844DB27C02CEE001807FB /* RNCSafeAreaUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaUtils.h; sourceTree = "<group>"; };
0C7844DC27C02CEE001807FB /* RNCSafeAreaViewMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaViewMode.h; sourceTree = "<group>"; };
0C7844DD27C02CEE001807FB /* RNCSafeAreaViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaViewManager.h; sourceTree = "<group>"; };
0C7844DE27C02CEE001807FB /* RNCSafeAreaViewEdges.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaViewEdges.m; sourceTree = "<group>"; };
0C7844DF27C02CEE001807FB /* RNCSafeAreaUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaUtils.m; sourceTree = "<group>"; };
0C7844E027C02CEE001807FB /* RNCSafeAreaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaView.m; sourceTree = "<group>"; };
0C7844E927C02D03001807FB /* RNCSafeAreaContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaContext.h; sourceTree = "<group>"; };
0C7844EA27C02D03001807FB /* RNCSafeAreaContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RNCSafeAreaContext.mm; sourceTree = "<group>"; };
0C7844EB27C02D03001807FB /* RNCSafeAreaProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaProvider.h; sourceTree = "<group>"; };
0C7844EC27C02D03001807FB /* RNCSafeAreaProviderManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaProviderManager.h; sourceTree = "<group>"; };
0C7844ED27C02D03001807FB /* RNCSafeAreaProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaProvider.m; sourceTree = "<group>"; };
0C7844EE27C02D03001807FB /* Fabric */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Fabric; sourceTree = "<group>"; };
134814201AA4EA6300B7C361 /* libRNCSafeAreaContext.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNCSafeAreaContext.a; sourceTree = BUILT_PRODUCTS_DIR; };
AA53A9EC2A321C01009AB3B2 /* RNCSafeAreaViewEdgeModes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNCSafeAreaViewEdgeModes.h; sourceTree = "<group>"; };
AA53A9ED2A321C01009AB3B2 /* RNCSafeAreaViewEdgeModes.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNCSafeAreaViewEdgeModes.m; sourceTree = "<group>"; };
C923EDBB220C2C1A00D3100F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
D697AA962D6F1CE5009C6433 /* RNCChangeEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNCChangeEvent.h; sourceTree = "<group>"; };
D697AA972D6F1D08009C6433 /* RNCChangeEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNCChangeEvent.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
58B511D81A9E6C8500147676 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C923EDBC220C2C1A00D3100F /* SystemConfiguration.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
134814211AA4EA7D00B7C361 /* Products */ = {
isa = PBXGroup;
children = (
134814201AA4EA6300B7C361 /* libRNCSafeAreaContext.a */,
);
name = Products;
sourceTree = "<group>";
};
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
D697AA972D6F1D08009C6433 /* RNCChangeEvent.m */,
D697AA962D6F1CE5009C6433 /* RNCChangeEvent.h */,
AA53A9EC2A321C01009AB3B2 /* RNCSafeAreaViewEdgeModes.h */,
AA53A9ED2A321C01009AB3B2 /* RNCSafeAreaViewEdgeModes.m */,
0C7844EE27C02D03001807FB /* Fabric */,
0C7844E927C02D03001807FB /* RNCSafeAreaContext.h */,
0C7844EA27C02D03001807FB /* RNCSafeAreaContext.mm */,
0C7844EB27C02D03001807FB /* RNCSafeAreaProvider.h */,
0C7844ED27C02D03001807FB /* RNCSafeAreaProvider.m */,
0C7844EC27C02D03001807FB /* RNCSafeAreaProviderManager.h */,
0C7844D627C02CEE001807FB /* RNCSafeAreaProviderManager.m */,
0C7844D727C02CEE001807FB /* RNCSafeAreaShadowView.h */,
0C7844D527C02CEE001807FB /* RNCSafeAreaShadowView.m */,
0C7844DB27C02CEE001807FB /* RNCSafeAreaUtils.h */,
0C7844DF27C02CEE001807FB /* RNCSafeAreaUtils.m */,
0C7844D827C02CEE001807FB /* RNCSafeAreaView.h */,
0C7844E027C02CEE001807FB /* RNCSafeAreaView.m */,
0C7844DA27C02CEE001807FB /* RNCSafeAreaViewEdges.h */,
0C7844DE27C02CEE001807FB /* RNCSafeAreaViewEdges.m */,
0C7844D427C02CEE001807FB /* RNCSafeAreaViewLocalData.h */,
0C7844D227C02CEE001807FB /* RNCSafeAreaViewLocalData.m */,
0C7844DD27C02CEE001807FB /* RNCSafeAreaViewManager.h */,
0C7844D927C02CEE001807FB /* RNCSafeAreaViewManager.m */,
0C7844DC27C02CEE001807FB /* RNCSafeAreaViewMode.h */,
0C7844D327C02CEE001807FB /* RNCSafeAreaViewMode.m */,
134814211AA4EA7D00B7C361 /* Products */,
C923EDBA220C2C1A00D3100F /* Frameworks */,
);
sourceTree = "<group>";
};
C923EDBA220C2C1A00D3100F /* Frameworks */ = {
isa = PBXGroup;
children = (
C923EDBB220C2C1A00D3100F /* SystemConfiguration.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
58B511DA1A9E6C8500147676 /* RNCSafeAreaContext */ = {
isa = PBXNativeTarget;
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCSafeAreaContext" */;
buildPhases = (
58B511D71A9E6C8500147676 /* Sources */,
58B511D81A9E6C8500147676 /* Frameworks */,
58B511D91A9E6C8500147676 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = RNCSafeAreaContext;
productName = RCTDataManager;
productReference = 134814201AA4EA6300B7C361 /* libRNCSafeAreaContext.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
58B511D31A9E6C8500147676 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1030;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
58B511DA1A9E6C8500147676 = {
CreatedOnToolsVersion = 6.1.1;
};
};
};
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNSafeAreaContext" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 58B511D21A9E6C8500147676;
productRefGroup = 58B511D21A9E6C8500147676;
projectDirPath = "";
projectRoot = "";
targets = (
58B511DA1A9E6C8500147676 /* RNCSafeAreaContext */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
58B511D71A9E6C8500147676 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AA53A9EE2A321C01009AB3B2 /* RNCSafeAreaViewEdgeModes.m in Sources */,
0C7844E427C02CEE001807FB /* RNCSafeAreaProviderManager.m in Sources */,
0C7844E727C02CEE001807FB /* RNCSafeAreaUtils.m in Sources */,
0C7844E827C02CEE001807FB /* RNCSafeAreaView.m in Sources */,
0C7844E627C02CEE001807FB /* RNCSafeAreaViewEdges.m in Sources */,
0C7844E527C02CEE001807FB /* RNCSafeAreaViewManager.m in Sources */,
D697AA982D6F1D0A009C6433 /* RNCChangeEvent.m in Sources */,
0C7844EF27C02D03001807FB /* RNCSafeAreaContext.mm in Sources */,
0C7844E127C02CEE001807FB /* RNCSafeAreaViewLocalData.m in Sources */,
0C7844E227C02CEE001807FB /* RNCSafeAreaViewMode.m in Sources */,
0C7844F027C02D03001807FB /* RNCSafeAreaProvider.m in Sources */,
0C7844E327C02CEE001807FB /* RNCSafeAreaShadowView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
58B511ED1A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
58B511EE1A9E6C8500147676 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
58B511F01A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RNCSafeAreaContext;
SKIP_INSTALL = YES;
};
name = Debug;
};
58B511F11A9E6C8500147676 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RNCSafeAreaContext;
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNSafeAreaContext" */ = {
isa = XCConfigurationList;
buildConfigurations = (
58B511ED1A9E6C8500147676 /* Debug */,
58B511EE1A9E6C8500147676 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCSafeAreaContext" */ = {
isa = XCConfigurationList;
buildConfigurations = (
58B511F01A9E6C8500147676 /* Debug */,
58B511F11A9E6C8500147676 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
}