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 12 13 NS_ASSUME_NONNULL_BEGIN 14 15 @interface RCTConvert (RNSScreen) 16 17 + (RNSScreenStackPresentation)RNSScreenStackPresentation:(id)json; 18 + (RNSScreenStackAnimation)RNSScreenStackAnimation:(id)json; 19 20 #if !TARGET_OS_TV 21 + (RNSStatusBarStyle)RNSStatusBarStyle:(id)json; 22 + (UIStatusBarAnimation)UIStatusBarAnimation:(id)json; 23 + (UIInterfaceOrientationMask)UIInterfaceOrientationMask:(id)json; 24 #endif 25 26 @end 27 28 @class RNSScreenView; 29 30 @interface RNSScreen : UIViewController <RNScreensViewControllerDelegate> 31 32 - (instancetype)initWithView:(UIView *)view; 33 - (UIViewController *)findChildVCForConfigAndTrait:(RNSWindowTrait)trait includingModals:(BOOL)includingModals; 34 - (void)notifyFinishTransitioning; 35 - (RNSScreenView *)screenView; 36 #ifdef RCT_NEW_ARCH_ENABLED 37 - (void)setViewToSnapshot:(UIView *)snapshot; 38 - (void)resetViewToScreen; 39 #endif 40 41 @end 42 43 @interface RNSScreenView : 44 #ifdef RCT_NEW_ARCH_ENABLED 45 RCTViewComponentView 46 #else 47 RCTView 48 #endif 49 50 @property (nonatomic) BOOL fullScreenSwipeEnabled; 51 @property (nonatomic) BOOL gestureEnabled; 52 @property (nonatomic) BOOL hasStatusBarHiddenSet; 53 @property (nonatomic) BOOL hasStatusBarStyleSet; 54 @property (nonatomic) BOOL hasStatusBarAnimationSet; 55 @property (nonatomic) BOOL hasHomeIndicatorHiddenSet; 56 @property (nonatomic) BOOL hasOrientationSet; 57 @property (nonatomic) RNSScreenStackAnimation stackAnimation; 58 @property (nonatomic) RNSScreenStackPresentation stackPresentation; 59 @property (nonatomic) RNSScreenSwipeDirection swipeDirection; 60 @property (nonatomic) RNSScreenReplaceAnimation replaceAnimation; 61 62 @property (nonatomic, retain) NSNumber *transitionDuration; 63 @property (nonatomic, readonly) BOOL dismissed; 64 @property (nonatomic) BOOL hideKeyboardOnSwipe; 65 @property (nonatomic) BOOL customAnimationOnSwipe; 66 @property (nonatomic) BOOL preventNativeDismiss; 67 @property (nonatomic, retain) RNSScreen *controller; 68 @property (nonatomic, copy) NSDictionary *gestureResponseDistance; 69 @property (nonatomic) int activityState; 70 @property (weak, nonatomic) UIView<RNSScreenContainerDelegate> *reactSuperview; 71 72 #if !TARGET_OS_TV 73 @property (nonatomic) RNSStatusBarStyle statusBarStyle; 74 @property (nonatomic) UIStatusBarAnimation statusBarAnimation; 75 @property (nonatomic) UIInterfaceOrientationMask screenOrientation; 76 @property (nonatomic) BOOL statusBarHidden; 77 @property (nonatomic) BOOL homeIndicatorHidden; 78 79 // Props controlling UISheetPresentationController 80 @property (nonatomic) RNSScreenDetentType sheetAllowedDetents; 81 @property (nonatomic) RNSScreenDetentType sheetLargestUndimmedDetent; 82 @property (nonatomic) BOOL sheetGrabberVisible; 83 @property (nonatomic) CGFloat sheetCornerRadius; 84 @property (nonatomic) BOOL sheetExpandsWhenScrolledToEdge; 85 #endif // !TARGET_OS_TV 86 87 #ifdef RCT_NEW_ARCH_ENABLED 88 // we recreate the behavior of `reactSetFrame` on new architecture 89 @property (nonatomic) facebook::react::LayoutMetrics oldLayoutMetrics; 90 @property (nonatomic) facebook::react::LayoutMetrics newLayoutMetrics; 91 @property (weak, nonatomic) UIView *config; 92 #else 93 @property (nonatomic, copy) RCTDirectEventBlock onAppear; 94 @property (nonatomic, copy) RCTDirectEventBlock onDisappear; 95 @property (nonatomic, copy) RCTDirectEventBlock onDismissed; 96 @property (nonatomic, copy) RCTDirectEventBlock onWillAppear; 97 @property (nonatomic, copy) RCTDirectEventBlock onWillDisappear; 98 @property (nonatomic, copy) RCTDirectEventBlock onNativeDismissCancelled; 99 @property (nonatomic, copy) RCTDirectEventBlock onTransitionProgress; 100 #endif // RCT_NEW_ARCH_ENABLED 101 102 - (void)notifyFinishTransitioning; 103 104 #ifdef RCT_NEW_ARCH_ENABLED 105 - (void)notifyWillAppear; 106 - (void)notifyWillDisappear; 107 - (void)notifyAppear; 108 - (void)notifyDisappear; 109 - (void)updateBounds; 110 - (void)notifyDismissedWithCount:(int)dismissCount; 111 #endif 112 113 - (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingForward:(BOOL)goingForward; 114 - (void)notifyDismissCancelledWithDismissCount:(int)dismissCount; 115 - (BOOL)isModal; 116 117 @end 118 119 @interface UIView (RNSScreen) 120 - (UIViewController *)parentViewController; 121 @end 122 123 @interface RNSScreenManager : RCTViewManager 124 125 @end 126 127 NS_ASSUME_NONNULL_END 128