File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
packages/react-native/ReactCommon/react/renderer/uimanager Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -690,4 +690,19 @@ void UIManager::animationTick() const {
690
690
}
691
691
}
692
692
693
+ void UIManager::synchronouslyUpdateViewOnUIThread (
694
+ Tag tag,
695
+ const folly::dynamic& props) {
696
+ std::shared_lock lock (synchronousViewUpdateCallbackMutex_);
697
+ if (synchronousViewUpdateCallback_) {
698
+ synchronousViewUpdateCallback_ (tag, props);
699
+ }
700
+ }
701
+
702
+ void UIManager::setSynchronousViewUpdateCallback (
703
+ SynchronousViewUpdateCallback&& callback) {
704
+ std::unique_lock lock (synchronousViewUpdateCallbackMutex_);
705
+ synchronousViewUpdateCallback_ = std::move (callback);
706
+ }
707
+
693
708
} // namespace facebook::react
Original file line number Diff line number Diff line change @@ -204,6 +204,14 @@ class UIManager final : public ShadowTreeDelegate {
204
204
void updateShadowTree (
205
205
const std::unordered_map<Tag, folly::dynamic>& tagToProps);
206
206
207
+ using SynchronousViewUpdateCallback =
208
+ std::function<void (Tag, const folly::dynamic&)>;
209
+
210
+ void synchronouslyUpdateViewOnUIThread (Tag tag, const folly::dynamic& props);
211
+
212
+ void setSynchronousViewUpdateCallback (
213
+ SynchronousViewUpdateCallback&& callback);
214
+
207
215
private:
208
216
friend class UIManagerBinding ;
209
217
friend class Scheduler ;
@@ -242,6 +250,9 @@ class UIManager final : public ShadowTreeDelegate {
242
250
lazyShadowTreeRevisionConsistencyManager_;
243
251
std::unique_ptr<LatestShadowTreeRevisionProvider>
244
252
latestShadowTreeRevisionProvider_;
253
+
254
+ std::shared_mutex synchronousViewUpdateCallbackMutex_;
255
+ SynchronousViewUpdateCallback synchronousViewUpdateCallback_{nullptr };
245
256
};
246
257
247
258
} // namespace facebook::react
You can’t perform that action at this time.
0 commit comments