Tôi có Chế độ xem bản địa iOS là chế độ xem UIView với chế độ xem bản đồ và UIView. Bản đồ có một sự kiện được gọi là 'regionDidChangeAnimated', tôi muốn gửi sự kiện đến React Native. Nhưng reactTag không đúng.Phản hồi sự kiện Native Native bản địa iOS gửi phản hồi đúng cáchTag
- (UIView *)view
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIView *frameView = [[UIView alloc] initWithFrame:screenRect];
CGRect frameRect = frameView.bounds;
MAMapView *mapView;
mapView = [[MAMapView alloc] initWithFrame:frameRect];
self.mapview = mapView;
mapView.delegate = self;
[frameView addSubview:mapView];
RCTFixedPin* pin = [[RCTFixedPin alloc] initWithFrame:CGRectMake(0, 0, screenRect.size.width, 260)];
pin.userInteractionEnabled = NO;
[frameView addSubview:pin];
return frameView;
}
- (void)mapView:(MAMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
if (self.dragging) {
self.dragging = NO;
}
MACoordinateRegion region = mapView.region;
NSDictionary *event = @{
***@"target": ,***
@"region": @{
@"latitude": @(region.center.latitude),
@"longitude": @(region.center.longitude),
@"latitudeDelta": @(region.span.latitudeDelta),
@"longitudeDelta": @(region.span.longitudeDelta),
}
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event];
}