2019-10-16 20:03:47 +03:00
|
|
|
/*
|
2018-09-12 01:27:47 +03:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2018-04-11 02:37:06 +03:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
#import <React/RCTPrimitives.h>
|
|
|
|
#import <React/RCTSurfacePresenterStub.h>
|
2020-01-30 21:09:06 +03:00
|
|
|
#import <React/RCTSurfaceStage.h>
|
2020-04-27 21:33:01 +03:00
|
|
|
#import <ReactCommon/RuntimeExecutor.h>
|
2019-04-13 01:10:40 +03:00
|
|
|
#import <react/utils/ContextContainer.h>
|
2018-04-11 02:37:06 +03:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
@class RCTFabricSurface;
|
2019-08-15 21:27:29 +03:00
|
|
|
@class RCTImageLoader;
|
2019-08-08 17:13:22 +03:00
|
|
|
@class RCTMountingManager;
|
2018-04-11 02:37:06 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Coordinates presenting of React Native Surfaces and represents application
|
|
|
|
* facing interface of running React Native core.
|
|
|
|
*/
|
2019-08-08 17:13:22 +03:00
|
|
|
@interface RCTSurfacePresenter : NSObject
|
2018-04-11 02:37:06 +03:00
|
|
|
|
2019-10-25 03:43:08 +03:00
|
|
|
- (instancetype)initWithContextContainer:(facebook::react::ContextContainer::Shared)contextContainer
|
|
|
|
runtimeExecutor:(facebook::react::RuntimeExecutor)runtimeExecutor;
|
2018-04-11 02:37:06 +03:00
|
|
|
|
2019-10-25 03:43:08 +03:00
|
|
|
@property (nonatomic) facebook::react::ContextContainer::Shared contextContainer;
|
|
|
|
@property (nonatomic) facebook::react::RuntimeExecutor runtimeExecutor;
|
2018-11-26 09:15:00 +03:00
|
|
|
|
2019-10-25 03:43:08 +03:00
|
|
|
/*
|
|
|
|
* Suspends/resumes all surfaces associated with the presenter.
|
|
|
|
* Suspending is a process or gracefull stopping all surfaces and destroying all underlying infrastructure
|
|
|
|
* with a future possibility of recreating the infrastructure and restarting the surfaces from scratch.
|
|
|
|
* Suspending is usually a part of a bundle reloading process.
|
|
|
|
* Can be called on any thread.
|
|
|
|
*/
|
|
|
|
- (BOOL)suspend;
|
|
|
|
- (BOOL)resume;
|
|
|
|
|
2018-04-11 02:37:06 +03:00
|
|
|
@end
|
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
@interface RCTSurfacePresenter (Surface) <RCTSurfacePresenterStub>
|
2018-04-11 02:37:06 +03:00
|
|
|
|
|
|
|
/**
|
2018-12-22 04:57:32 +03:00
|
|
|
* Surface uses these methods to register itself in the Presenter.
|
2018-04-11 02:37:06 +03:00
|
|
|
*/
|
2019-08-08 17:13:22 +03:00
|
|
|
- (void)registerSurface:(RCTFabricSurface *)surface;
|
|
|
|
- (void)unregisterSurface:(RCTFabricSurface *)surface;
|
2019-09-12 07:26:07 +03:00
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
- (void)setProps:(NSDictionary *)props surface:(RCTFabricSurface *)surface;
|
2018-09-26 20:01:42 +03:00
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
- (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
|
2018-04-11 02:37:06 +03:00
|
|
|
|
2018-05-09 08:56:27 +03:00
|
|
|
/**
|
|
|
|
* Measures the Surface with given constraints.
|
|
|
|
*/
|
|
|
|
- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize
|
|
|
|
maximumSize:(CGSize)maximumSize
|
2019-08-08 17:13:22 +03:00
|
|
|
surface:(RCTFabricSurface *)surface;
|
2018-05-09 08:56:27 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets `minimumSize` and `maximumSize` layout constraints for the Surface.
|
|
|
|
*/
|
2019-08-08 17:13:22 +03:00
|
|
|
- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize surface:(RCTFabricSurface *)surface;
|
2018-06-15 06:39:44 +03:00
|
|
|
|
2019-02-25 23:22:24 +03:00
|
|
|
- (BOOL)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag props:(NSDictionary *)props;
|
|
|
|
|
2020-01-30 21:09:06 +03:00
|
|
|
- (BOOL)synchronouslyWaitSurface:(RCTFabricSurface *)surface timeout:(NSTimeInterval)timeout;
|
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
- (void)addObserver:(id<RCTSurfacePresenterObserver>)observer;
|
2019-03-08 04:34:41 +03:00
|
|
|
|
2019-08-08 17:13:22 +03:00
|
|
|
- (void)removeObserver:(id<RCTSurfacePresenterObserver>)observer;
|
2019-03-08 04:34:41 +03:00
|
|
|
|
2018-04-11 02:37:06 +03:00
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|