Skip to content

Commit 18ec27a

Browse files
author
Riccardo Cipolleschi
committed
[Fabric Component] Create the Native ViewManager
1 parent 66bdf85 commit 18ec27a

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#import <MapKit/MapKit.h>
2+
#import <React/RCTViewManager.h>
3+
4+
@interface RNTMapManager : RCTViewManager
5+
@end
6+
7+
@implementation RNTMapManager
8+
9+
RCT_EXPORT_MODULE(MapView)
10+
RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL)
11+
12+
- (UIView *)view
13+
{
14+
return [[MKMapView alloc] init];
15+
}
16+
17+
@end

RUN.md

+26
Original file line numberDiff line numberDiff line change
@@ -667,3 +667,29 @@ If successfull, you should see something like this:
667667
[Codegen] Generated schema: /var/folders/b7/5gvyd0914t15w42kwy1k_l600000gn/T/MapView0PSxcQ/schema.json
668668
[Codegen] Generated artifacts: /Users/cipolleschi/rn-test/RNNewArchitectureApp/AwesomeApp/ios/build/generated/ios/react/renderer/components/MapView
669669
```
670+
671+
### [[Fabric Component] Create the Native ViewManager]()
672+
Steps:
673+
* Go to the `MapView` folder
674+
* Create a new folder and name it `ios`
675+
* Create a new file called `RNTMapManager.mm`
676+
* Paste the following code:
677+
```objective-c
678+
#import <MapKit/MapKit.h>
679+
#import <React/RCTViewManager.h>
680+
681+
@interface RNTMapManager : RCTViewManager
682+
@end
683+
684+
@implementation RNTMapManager
685+
686+
RCT_EXPORT_MODULE(MapView)
687+
RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL)
688+
689+
- (UIView *)view
690+
{
691+
return [[MKMapView alloc] init];
692+
}
693+
694+
@end
695+
```

0 commit comments

Comments
 (0)