diff --git a/React/Base/RCTEventDispatcherProtocol.h b/React/Base/RCTEventDispatcherProtocol.h index 9e80332a007..4125e982944 100644 --- a/React/Base/RCTEventDispatcherProtocol.h +++ b/React/Base/RCTEventDispatcherProtocol.h @@ -102,6 +102,11 @@ typedef NS_ENUM(NSInteger, RCTTextEventType) { key:(NSString *)key eventCount:(NSInteger)eventCount; +/** + * Notify Observers of event + */ +- (void)notifyObserversOfEvent:(id)event; + /** * Send a pre-prepared event object. * diff --git a/React/CoreModules/RCTEventDispatcher.mm b/React/CoreModules/RCTEventDispatcher.mm index ef6a895f12b..f2cf17c947e 100644 --- a/React/CoreModules/RCTEventDispatcher.mm +++ b/React/CoreModules/RCTEventDispatcher.mm @@ -110,7 +110,7 @@ RCT_EXPORT_MODULE() [self sendEvent:event]; } -- (void)sendEvent:(id)event +- (void)notifyObserversOfEvent:(id)event { [_observersLock lock]; @@ -119,6 +119,11 @@ RCT_EXPORT_MODULE() } [_observersLock unlock]; +} + +- (void)sendEvent:(id)event +{ + [self notifyObserversOfEvent:event]; [_eventQueueLock lock]; diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index c67865e1122..e699640940d 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -73,7 +73,7 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol [bridge.eventDispatcher sendEvent:scrollEvent]; } else { NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:scrollEvent, @"event", nil]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTSendEventToLegacyEventDispatcher" + [[NSNotificationCenter defaultCenter] postNotificationName:@"RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED" object:nil userInfo:userInfo]; }