@@ -66,6 +66,23 @@ - (void)dealloc {
66
66
}
67
67
}
68
68
69
+ /* *
70
+ * Ensures that the touch handler is properly set up for the marker
71
+ * This method checks if the touch handler exists and creates it if it doesn't
72
+ * The touch handler is responsible for processing tap events on the marker
73
+ */
74
+ - (void )ensureTouchHandler {
75
+ if (!_inner.touchHandler ) {
76
+ _inner.touchHandler = [self ](NMFOverlay* overlay) -> BOOL {
77
+ if (self.emitter ) {
78
+ self.emitter ->onTapOverlay ({});
79
+ return YES ;
80
+ }
81
+ return NO ;
82
+ };
83
+ }
84
+ }
85
+
69
86
- (void )setImage : (facebook::react::RNCNaverMapMarkerImageStruct)image {
70
87
_image = image;
71
88
// If subview exists for custom marker, then skip image
@@ -85,6 +102,7 @@ - (void)setImage:(facebook::react::RNCNaverMapMarkerImageStruct)image {
85
102
self.inner .alpha = 1 ;
86
103
self.inner .iconImage = image;
87
104
self->_imageCanceller = nil ;
105
+ [self ensureTouchHandler ]; // Re-ensure touch handler after image is set
88
106
});
89
107
});
90
108
}
@@ -111,6 +129,7 @@ - (void)insertReactSubview:(UIView*)subview atIndex:(NSInteger)atIndex {
111
129
dispatch_async (dispatch_get_main_queue (), [self , subview]() {
112
130
self.inner .alpha = 1 ;
113
131
self.inner .iconImage = [NMFOverlayImage overlayImageWithImage: [self captureView: subview]];
132
+ [self ensureTouchHandler ]; // Re-ensure touch handler after custom marker image is set
114
133
});
115
134
}
116
135
@@ -210,6 +229,9 @@ - (void)updateProps:(Props::Shared const&)props oldProps:(Props::Shared const&)o
210
229
}
211
230
212
231
[super updateProps: props oldProps: oldProps];
232
+
233
+ // Ensure touch handler is properly set after marker properties are updated
234
+ [self ensureTouchHandler ];
213
235
}
214
236
215
237
Class <RCTComponentViewProtocol> RNCNaverMapMarkerCls (void ) {
0 commit comments