Skip to content

Commit

Permalink
Expose UIManager from Scheduler (#33545)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #33545

Exposes `UIManager` instance for access from third-party modules.

Changelog: [Changed] Exposes `UIManager` instance for third-party access.

Reviewed By: javache

Differential Revision: D35314058

fbshipit-source-id: 1922c2afc37b105b153a82f45e5bac9c0b0cdfae
  • Loading branch information
cortinico authored and facebook-github-bot committed Apr 26, 2022
1 parent 614aa86 commit 54db5f2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions React/Fabric/RCTScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#import <react/renderer/mounting/MountingCoordinator.h>
#import <react/renderer/scheduler/SchedulerToolbox.h>
#import <react/renderer/scheduler/SurfaceHandler.h>
#import <react/renderer/uimanager/UIManager.h>
#import <react/utils/ContextContainer.h>

NS_ASSUME_NONNULL_BEGIN
Expand Down Expand Up @@ -48,6 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface RCTScheduler : NSObject

@property (atomic, weak, nullable) id<RCTSchedulerDelegate> delegate;
@property (readonly) std::shared_ptr<facebook::react::UIManager> const uiManager;

- (instancetype)initWithToolbox:(facebook::react::SchedulerToolbox)toolbox;

Expand Down
5 changes: 5 additions & 0 deletions React/Fabric/RCTScheduler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,9 @@ - (void)removeEventListener:(std::shared_ptr<EventListener> const &)listener
return _scheduler->removeEventListener(listener);
}

- (std::shared_ptr<facebook::react::UIManager> const)uiManager
{
return _scheduler->getUIManager();
}

@end
4 changes: 4 additions & 0 deletions ReactCommon/react/renderer/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ ContextContainer::Shared Scheduler::getContextContainer() const {
return contextContainer_;
}

std::shared_ptr<UIManager> Scheduler::getUIManager() const {
return uiManager_;
}

void Scheduler::addEventListener(
const std::shared_ptr<EventListener const> &listener) {
if (eventDispatcher_->has_value()) {
Expand Down
3 changes: 3 additions & 0 deletions ReactCommon/react/renderer/scheduler/Scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class Scheduler final : public UIManagerDelegate {
#pragma mark - ContextContainer
ContextContainer::Shared getContextContainer() const;

#pragma mark - UIManager
std::shared_ptr<UIManager> getUIManager() const;

#pragma mark - Event listeners
void addEventListener(const std::shared_ptr<EventListener const> &listener);
void removeEventListener(
Expand Down

0 comments on commit 54db5f2

Please sign in to comment.