-
-
Notifications
You must be signed in to change notification settings - Fork 937
Expand file tree
/
Copy pathRNMBXModelsComponentView.mm
More file actions
72 lines (52 loc) · 1.79 KB
/
RNMBXModelsComponentView.mm
File metadata and controls
72 lines (52 loc) · 1.79 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
70
71
72
#ifdef RCT_NEW_ARCH_ENABLED
#import "RNMBXModelsComponentView.h"
#import <React/RCTConversions.h>
#import <React/RCTFabricComponentsPlugins.h>
#import <react/renderer/components/rnmapbox_maps_specs/ComponentDescriptors.h>
#import <react/renderer/components/rnmapbox_maps_specs/EventEmitters.h>
#import <react/renderer/components/rnmapbox_maps_specs/Props.h>
#import <react/renderer/components/rnmapbox_maps_specs/RCTComponentViewHelpers.h>
#import "rnmapbox_maps-Swift.pre.h"
#import "RNMBXFabricPropConvert.h"
// TODO: use generated RNMBXModelsEventEmitter, but need 0.73+ for dynamic support
using namespace facebook::react;
@implementation RNMBXModelsComponentView {
RNMBXModels *_view;
}
// Needed because of this: https://github.com/facebook/react-native/pull/37274
+ (void)load
{
[super load];
}
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const RNMBXModelsProps>();
_props = defaultProps;
_view = [[RNMBXModels alloc] init];
[self prepareView];
self.contentView = _view;
}
return self;
}
- (void)prepareView
{
}
#pragma mark - RCTComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
return concreteComponentDescriptorProvider<RNMBXModelsComponentDescriptor>();
}
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
{
const auto &oldViewProps = static_cast<const RNMBXModelsProps &>(*oldProps);
const auto &newViewProps = static_cast<const RNMBXModelsProps &>(*props);
RNMBX_OPTIONAL_PROP_NSDictionary(models);
[super updateProps:props oldProps:oldProps];
}
@end
Class<RCTComponentViewProtocol> RNMBXModelsCls(void)
{
return RNMBXModelsComponentView.class;
}
#endif // RCT_NEW_ARCH_ENABLED