2024-05-02 15:08:24 +00:00
|
|
|
#import <React/RCTComponent.h>
|
|
|
|
#import <React/RCTViewManager.h>
|
|
|
|
|
2024-10-29 07:36:43 +00:00
|
|
|
#import "RNSEnums.h"
|
2024-05-02 15:08:24 +00:00
|
|
|
#import "RNSScreenContainer.h"
|
|
|
|
|
2024-10-29 07:36:43 +00:00
|
|
|
#if RCT_NEW_ARCH_ENABLED
|
|
|
|
#import <React/RCTViewComponentView.h>
|
|
|
|
#else
|
|
|
|
#import <React/RCTView.h>
|
|
|
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
|
|
namespace react = facebook::react;
|
|
|
|
#endif // RCT_NEW_ARCH_ENABLED
|
2024-05-02 15:08:24 +00:00
|
|
|
|
|
|
|
@interface RCTConvert (RNSScreen)
|
|
|
|
|
|
|
|
+ (RNSScreenStackPresentation)RNSScreenStackPresentation:(id)json;
|
|
|
|
+ (RNSScreenStackAnimation)RNSScreenStackAnimation:(id)json;
|
|
|
|
|
|
|
|
#if !TARGET_OS_TV
|
|
|
|
+ (RNSStatusBarStyle)RNSStatusBarStyle:(id)json;
|
2024-10-29 07:36:43 +00:00
|
|
|
+ (UIStatusBarAnimation)UIStatusBarAnimation:(id)json;
|
2024-05-02 15:08:24 +00:00
|
|
|
+ (UIInterfaceOrientationMask)UIInterfaceOrientationMask:(id)json;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2024-10-29 07:36:43 +00:00
|
|
|
@class RNSScreenView;
|
|
|
|
|
|
|
|
@interface RNSScreen : UIViewController <RNSViewControllerDelegate>
|
2024-05-02 15:08:24 +00:00
|
|
|
|
|
|
|
- (instancetype)initWithView:(UIView *)view;
|
|
|
|
- (UIViewController *)findChildVCForConfigAndTrait:(RNSWindowTrait)trait includingModals:(BOOL)includingModals;
|
2024-10-29 07:36:43 +00:00
|
|
|
- (BOOL)hasNestedStack;
|
|
|
|
- (void)calculateAndNotifyHeaderHeightChangeIsModal:(BOOL)isModal;
|
|
|
|
- (void)notifyFinishTransitioning;
|
|
|
|
- (RNSScreenView *)screenView;
|
|
|
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
|
|
- (void)setViewToSnapshot:(UIView *)snapshot;
|
|
|
|
- (CGFloat)calculateHeaderHeightIsModal:(BOOL)isModal;
|
|
|
|
#endif
|
2024-05-02 15:08:24 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2024-10-29 07:36:43 +00:00
|
|
|
@class RNSScreenStackHeaderConfig;
|
2024-05-02 15:08:24 +00:00
|
|
|
|
2024-10-29 07:36:43 +00:00
|
|
|
@interface RNSScreenView :
|
|
|
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
|
|
RCTViewComponentView
|
|
|
|
#else
|
|
|
|
RCTView
|
|
|
|
#endif
|
2024-05-02 15:08:24 +00:00
|
|
|
|
2024-10-29 07:36:43 +00:00
|
|
|
@property (nonatomic) BOOL fullScreenSwipeEnabled;
|
2024-05-02 15:08:24 +00:00
|
|
|
@property (nonatomic) BOOL gestureEnabled;
|
2024-10-29 07:36:43 +00:00
|
|
|
@property (nonatomic) BOOL hasStatusBarHiddenSet;
|
2024-05-02 15:08:24 +00:00
|
|
|
@property (nonatomic) BOOL hasStatusBarStyleSet;
|
|
|
|
@property (nonatomic) BOOL hasStatusBarAnimationSet;
|
|
|
|
@property (nonatomic) BOOL hasHomeIndicatorHiddenSet;
|
2024-10-29 07:36:43 +00:00
|
|
|
@property (nonatomic) BOOL hasOrientationSet;
|
|
|
|
@property (nonatomic) RNSScreenStackAnimation stackAnimation;
|
|
|
|
@property (nonatomic) RNSScreenStackPresentation stackPresentation;
|
|
|
|
@property (nonatomic) RNSScreenSwipeDirection swipeDirection;
|
|
|
|
@property (nonatomic) RNSScreenReplaceAnimation replaceAnimation;
|
|
|
|
|
2024-05-02 15:08:24 +00:00
|
|
|
@property (nonatomic, retain) NSNumber *transitionDuration;
|
2024-10-29 07:36:43 +00:00
|
|
|
@property (nonatomic, readonly) BOOL dismissed;
|
|
|
|
@property (nonatomic) BOOL hideKeyboardOnSwipe;
|
|
|
|
@property (nonatomic) BOOL customAnimationOnSwipe;
|
|
|
|
@property (nonatomic) BOOL preventNativeDismiss;
|
|
|
|
@property (nonatomic, retain) RNSScreen *controller;
|
|
|
|
@property (nonatomic, copy) NSDictionary *gestureResponseDistance;
|
|
|
|
@property (nonatomic) int activityState;
|
|
|
|
@property (weak, nonatomic) UIView<RNSScreenContainerDelegate> *reactSuperview;
|
2024-05-02 15:08:24 +00:00
|
|
|
|
|
|
|
#if !TARGET_OS_TV
|
|
|
|
@property (nonatomic) RNSStatusBarStyle statusBarStyle;
|
|
|
|
@property (nonatomic) UIStatusBarAnimation statusBarAnimation;
|
|
|
|
@property (nonatomic) UIInterfaceOrientationMask screenOrientation;
|
2024-10-29 07:36:43 +00:00
|
|
|
@property (nonatomic) BOOL statusBarHidden;
|
2024-05-02 15:08:24 +00:00
|
|
|
@property (nonatomic) BOOL homeIndicatorHidden;
|
2024-10-29 07:36:43 +00:00
|
|
|
|
|
|
|
// Props controlling UISheetPresentationController
|
|
|
|
@property (nonatomic) RNSScreenDetentType sheetAllowedDetents;
|
|
|
|
@property (nonatomic) RNSScreenDetentType sheetLargestUndimmedDetent;
|
|
|
|
@property (nonatomic) BOOL sheetGrabberVisible;
|
|
|
|
@property (nonatomic) CGFloat sheetCornerRadius;
|
|
|
|
@property (nonatomic) BOOL sheetExpandsWhenScrolledToEdge;
|
|
|
|
#endif // !TARGET_OS_TV
|
|
|
|
|
|
|
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
|
|
// we recreate the behavior of `reactSetFrame` on new architecture
|
|
|
|
@property (nonatomic) react::LayoutMetrics oldLayoutMetrics;
|
|
|
|
@property (nonatomic) react::LayoutMetrics newLayoutMetrics;
|
|
|
|
@property (weak, nonatomic) RNSScreenStackHeaderConfig *config;
|
|
|
|
@property (nonatomic, readonly) BOOL hasHeaderConfig;
|
|
|
|
#else
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onAppear;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onDisappear;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onDismissed;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onHeaderHeightChange;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onWillAppear;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onWillDisappear;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onNativeDismissCancelled;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onTransitionProgress;
|
|
|
|
@property (nonatomic, copy) RCTDirectEventBlock onGestureCancel;
|
|
|
|
#endif // RCT_NEW_ARCH_ENABLED
|
2024-05-02 15:08:24 +00:00
|
|
|
|
|
|
|
- (void)notifyFinishTransitioning;
|
2024-10-29 07:36:43 +00:00
|
|
|
- (void)notifyHeaderHeightChange:(double)height;
|
|
|
|
|
|
|
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
|
|
- (void)notifyWillAppear;
|
|
|
|
- (void)notifyWillDisappear;
|
|
|
|
- (void)notifyAppear;
|
|
|
|
- (void)notifyDisappear;
|
|
|
|
- (void)updateBounds;
|
|
|
|
- (void)notifyDismissedWithCount:(int)dismissCount;
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame;
|
|
|
|
#else
|
|
|
|
- (instancetype)initWithBridge:(RCTBridge *)bridge;
|
|
|
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
|
|
|
2024-05-02 15:08:24 +00:00
|
|
|
- (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingForward:(BOOL)goingForward;
|
2024-10-29 07:36:43 +00:00
|
|
|
- (void)notifyDismissCancelledWithDismissCount:(int)dismissCount;
|
|
|
|
- (BOOL)isModal;
|
|
|
|
- (BOOL)isPresentedAsNativeModal;
|
|
|
|
|
|
|
|
/// Looks for header configuration in instance's `reactSubviews` and returns it. If not present returns `nil`.
|
|
|
|
- (RNSScreenStackHeaderConfig *_Nullable)findHeaderConfig;
|
2024-05-02 15:08:24 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface UIView (RNSScreen)
|
|
|
|
- (UIViewController *)parentViewController;
|
|
|
|
@end
|
2024-10-29 07:36:43 +00:00
|
|
|
|
|
|
|
@interface RNSScreenManager : RCTViewManager
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|