1+ /***
2+ to: ios/RNMBX/generated/<%= Name %> .mm
3+ ***/
14#import <React /RCTBridge.h >
25#import <React /RCTUIManager.h >
36#import <React /RCTUIManagerUtils.h >
47
5- #import " RNMBXLocationComponentModule.h"
8+ #import "<%= Name %> .h"
9+
10+ #import "<%= ComponentName %> ComponentView.h"
611#ifdef RCT_NEW_ARCH_ENABLED
7- #import " RNMBXLocationComponentView .h"
12+ #import "<%= ComponentName %> ComponentView .h"
813#endif // RCT_NEW_ARCH_ENABLED
914
1015#import "rnmapbox_maps-Swift.pre.h"
1116
12- @class RNMBXLocation;
13-
14- @implementation RNMBXLocationComponentModule
17+ @implementation <%= Name %>
1518
1619RCT_EXPORT_MODULE();
1720
@@ -32,39 +35,39 @@ - (dispatch_queue_t)methodQueue
3235- (std::shared_ptr<facebook::react::TurboModule >)getTurboModule:
3336 (const facebook::react::ObjCTurboModule::InitParams & )params
3437{
35- return std::make_shared<facebook::react::NativeRNMBXLocationModuleSpecJSI >(params);
38+ return std::make_shared<facebook::react::Native < % = Name % >ModuleSpecJSI >(params);
3639}
3740#endif // RCT_NEW_ARCH_ENABLED
3841
39- - (void )withLocation : (nonnull NSNumber *)viewRef block : (void (^)(RNMBXLocation *))block reject : (RCTPromiseRejectBlock)reject methodName : (NSString *)methodName
42+ - (void)with <%= Name %> :(nonnull NSNumber*)viewRef block:(void (^)(<%= ComponentName %> *))block reject:(RCTPromiseRejectBlock)reject methodName:(NSString *)methodName
4043{
4144#ifdef RCT_NEW_ARCH_ENABLED
4245 [self.viewRegistry_DEPRECATED addUIBlock:^(RCTViewRegistry *viewRegistry) {
43- RNMBXLocationComponentView *componentView = [self .viewRegistry_DEPRECATED viewForReactTag: viewRef];
44- RNMBXLocation *view = componentView.contentView ;
46+ <%= ComponentName %> ComponentView *componentView = [self.viewRegistry_DEPRECATED viewForReactTag:viewRef];
47+ <%= ComponentName %> *view = componentView.contentView;
4548
4649#else
4750 [self.bridge.uiManager
4851 addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView * > *viewRegistry) {
49- RNMBXLocation *view = [uiManager viewForReactTag: viewRef];
52+ <%= ComponentName %> *view = [uiManager viewForReactTag:viewRef];
5053#endif // RCT_NEW_ARCH_ENABLED
5154 if (view != nil) {
52- block (view);
55+ block(view);
5356 } else {
5457 reject(methodName, [NSString stringWithFormat:@"Unknown reactTag: %@", viewRef], nil);
5558 }
5659 }];
5760}
5861
59- # if false
60- RCT_EXPORT_METHOD (someMethod :(nonnull NSNumber *)viewRef
62+ <% module . spec . properties . forEach ( function ( property ) { % >
63+ RCT_EXPORT_METHOD (< %= property . name % > : (nonnull NSNumber * )viewRef
6164 resolve: (RCTPromiseResolveBlock)resolve
6265 reject: (RCTPromiseRejectBlock)reject)
6366{
64- [self withLocation : viewRef block: ^(RNMBXCamera *view) {
65- [RNMBXLocationManager someMethod : view resolve: resolve reject: reject];
66- } reject: reject methodName: @" someMethod " ];
67+ [self with < %= Name % > : viewRef block: ^ (< %= ComponentName % > * view) {
68+ [< %= ComponentName % > < %= property . name % > : view resolve: resolve reject: reject];
69+ } reject: reject methodName: @" <%= property.name %> " ];
6770}
68- # endif
71+ < % }) %>
6972
7073@end
0 commit comments