RCTSurfaceHostingView.h
2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
#import <React/RCTSurfaceSizeMeasureMode.h>
#import <React/RCTSurfaceStage.h>
@class RCTBridge;
@class RCTSurface;
typedef UIView *(^RCTSurfaceHostingViewActivityIndicatorViewFactory)();
NS_ASSUME_NONNULL_BEGIN
/**
* UIView subclass which providers interoperability between UIKit and
* Surface regarding layout and life-cycle.
* This class can be used as easy-to-use general purpose integration point
* of ReactNative-powered experiences in UIKit based apps.
*/
@interface RCTSurfaceHostingView : UIView
/**
* Designated initializer.
* Instanciates a view with given Surface object.
* Note: The view retains the surface object.
*/
- (instancetype)initWithSurface:(RCTSurface *)surface NS_DESIGNATED_INITIALIZER;
/**
* Convenience initializer.
* Instanciates a Surface object with given `bridge`, `moduleName`, and
* `initialProperties`, and then use it to instanciate a view.
*/
- (instancetype)initWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties;
/**
* Surface object which is currently using to power the view.
* Read-only.
*/
@property (nonatomic, strong, readonly) RCTSurface *surface;
/**
* Size measure mode which are defining relationship between UIKit and ReactNative
* layout approaches.
* Defaults to `RCTSurfaceSizeMeasureModeWidthAtMost | RCTSurfaceSizeMeasureModeHeightAtMost`.
*/
@property (nonatomic, assign) RCTSurfaceSizeMeasureMode sizeMeasureMode;
/**
* Activity indicator factory.
* A hosting view may use this block to instantiate and display custom activity
* (loading) indicator (aka "spinner") when it needed.
* Defaults to `nil` (no activity indicator).
*/
@property (nonatomic, copy, nullable) RCTSurfaceHostingViewActivityIndicatorViewFactory activityIndicatorViewFactory;
@end
NS_ASSUME_NONNULL_END