UNPKG

5.13 kBtext/x-cView Raw
1#import <React/RCTComponent.h>
2#import <React/RCTViewManager.h>
3
4#import "RNSEnums.h"
5#import "RNSScreenContainer.h"
6
7#if RCT_NEW_ARCH_ENABLED
8#import <React/RCTViewComponentView.h>
9#else
10#import <React/RCTView.h>
11#endif // RCT_NEW_ARCH_ENABLED
12
13NS_ASSUME_NONNULL_BEGIN
14
15#ifdef RCT_NEW_ARCH_ENABLED
16namespace react = facebook::react;
17#endif // RCT_NEW_ARCH_ENABLED
18
19@interface RCTConvert (RNSScreen)
20
21+ (RNSScreenStackPresentation)RNSScreenStackPresentation:(id)json;
22+ (RNSScreenStackAnimation)RNSScreenStackAnimation:(id)json;
23
24#if !TARGET_OS_TV
25+ (RNSStatusBarStyle)RNSStatusBarStyle:(id)json;
26+ (UIStatusBarAnimation)UIStatusBarAnimation:(id)json;
27+ (UIInterfaceOrientationMask)UIInterfaceOrientationMask:(id)json;
28#endif
29
30@end
31
32@class RNSScreenView;
33
34@interface RNSScreen : UIViewController <RNSViewControllerDelegate>
35
36- (instancetype)initWithView:(UIView *)view;
37- (UIViewController *)findChildVCForConfigAndTrait:(RNSWindowTrait)trait includingModals:(BOOL)includingModals;
38- (BOOL)hasNestedStack;
39- (void)calculateAndNotifyHeaderHeightChangeIsModal:(BOOL)isModal;
40- (void)notifyFinishTransitioning;
41- (RNSScreenView *)screenView;
42#ifdef RCT_NEW_ARCH_ENABLED
43- (void)setViewToSnapshot:(UIView *)snapshot;
44- (CGFloat)calculateHeaderHeightIsModal:(BOOL)isModal;
45#endif
46
47@end
48
49@class RNSScreenStackHeaderConfig;
50
51@interface RNSScreenView :
52#ifdef RCT_NEW_ARCH_ENABLED
53 RCTViewComponentView
54#else
55 RCTView
56#endif
57
58@property (nonatomic) BOOL fullScreenSwipeEnabled;
59@property (nonatomic) BOOL gestureEnabled;
60@property (nonatomic) BOOL hasStatusBarHiddenSet;
61@property (nonatomic) BOOL hasStatusBarStyleSet;
62@property (nonatomic) BOOL hasStatusBarAnimationSet;
63@property (nonatomic) BOOL hasHomeIndicatorHiddenSet;
64@property (nonatomic) BOOL hasOrientationSet;
65@property (nonatomic) RNSScreenStackAnimation stackAnimation;
66@property (nonatomic) RNSScreenStackPresentation stackPresentation;
67@property (nonatomic) RNSScreenSwipeDirection swipeDirection;
68@property (nonatomic) RNSScreenReplaceAnimation replaceAnimation;
69
70@property (nonatomic, retain) NSNumber *transitionDuration;
71@property (nonatomic, readonly) BOOL dismissed;
72@property (nonatomic) BOOL hideKeyboardOnSwipe;
73@property (nonatomic) BOOL customAnimationOnSwipe;
74@property (nonatomic) BOOL preventNativeDismiss;
75@property (nonatomic, retain) RNSScreen *controller;
76@property (nonatomic, copy) NSDictionary *gestureResponseDistance;
77@property (nonatomic) int activityState;
78@property (weak, nonatomic) UIView<RNSScreenContainerDelegate> *reactSuperview;
79
80#if !TARGET_OS_TV
81@property (nonatomic) RNSStatusBarStyle statusBarStyle;
82@property (nonatomic) UIStatusBarAnimation statusBarAnimation;
83@property (nonatomic) UIInterfaceOrientationMask screenOrientation;
84@property (nonatomic) BOOL statusBarHidden;
85@property (nonatomic) BOOL homeIndicatorHidden;
86
87// Props controlling UISheetPresentationController
88@property (nonatomic) RNSScreenDetentType sheetAllowedDetents;
89@property (nonatomic) RNSScreenDetentType sheetLargestUndimmedDetent;
90@property (nonatomic) BOOL sheetGrabberVisible;
91@property (nonatomic) CGFloat sheetCornerRadius;
92@property (nonatomic) BOOL sheetExpandsWhenScrolledToEdge;
93#endif // !TARGET_OS_TV
94
95#ifdef RCT_NEW_ARCH_ENABLED
96// we recreate the behavior of `reactSetFrame` on new architecture
97@property (nonatomic) react::LayoutMetrics oldLayoutMetrics;
98@property (nonatomic) react::LayoutMetrics newLayoutMetrics;
99@property (weak, nonatomic) RNSScreenStackHeaderConfig *config;
100@property (nonatomic, readonly) BOOL hasHeaderConfig;
101#else
102@property (nonatomic, copy) RCTDirectEventBlock onAppear;
103@property (nonatomic, copy) RCTDirectEventBlock onDisappear;
104@property (nonatomic, copy) RCTDirectEventBlock onDismissed;
105@property (nonatomic, copy) RCTDirectEventBlock onHeaderHeightChange;
106@property (nonatomic, copy) RCTDirectEventBlock onWillAppear;
107@property (nonatomic, copy) RCTDirectEventBlock onWillDisappear;
108@property (nonatomic, copy) RCTDirectEventBlock onNativeDismissCancelled;
109@property (nonatomic, copy) RCTDirectEventBlock onTransitionProgress;
110@property (nonatomic, copy) RCTDirectEventBlock onGestureCancel;
111#endif // RCT_NEW_ARCH_ENABLED
112
113- (void)notifyFinishTransitioning;
114- (void)notifyHeaderHeightChange:(double)height;
115
116#ifdef RCT_NEW_ARCH_ENABLED
117- (void)notifyWillAppear;
118- (void)notifyWillDisappear;
119- (void)notifyAppear;
120- (void)notifyDisappear;
121- (void)updateBounds;
122- (void)notifyDismissedWithCount:(int)dismissCount;
123- (instancetype)initWithFrame:(CGRect)frame;
124#else
125- (instancetype)initWithBridge:(RCTBridge *)bridge;
126#endif // RCT_NEW_ARCH_ENABLED
127
128- (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingForward:(BOOL)goingForward;
129- (void)notifyDismissCancelledWithDismissCount:(int)dismissCount;
130- (BOOL)isModal;
131- (BOOL)isPresentedAsNativeModal;
132
133/// Looks for header configuration in instance's `reactSubviews` and returns it. If not present returns `nil`.
134- (RNSScreenStackHeaderConfig *_Nullable)findHeaderConfig;
135
136@end
137
138@interface UIView (RNSScreen)
139- (UIViewController *)parentViewController;
140@end
141
142@interface RNSScreenManager : RCTViewManager
143
144@end
145
146NS_ASSUME_NONNULL_END