Skip to content

Commit 1730949

Browse files
cortinicofacebook-github-bot
authored andcommitted
Expose scheduler through FabricUIManager
Summary: Allows to access `react::renderer::Scheduler` given `FabricUIManager` from Java side. Changelog: [Added] Added `FabricUIManager` binding with FBJNI Reviewed By: javache Differential Revision: D35313399 fbshipit-source-id: 54e7adcceae40368c2735ddfc8a083f87b08dc5e
1 parent e51e19e commit 1730949

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class Binding : public jni::HybridClass<Binding>,
4343

4444
static void registerNatives();
4545

46+
std::shared_ptr<Scheduler> getScheduler();
47+
4648
private:
4749
void setConstraints(
4850
jint surfaceId,
@@ -133,7 +135,6 @@ class Binding : public jni::HybridClass<Binding>,
133135
std::shared_ptr<FabricMountingManager> mountingManager_;
134136
std::shared_ptr<Scheduler> scheduler_;
135137

136-
std::shared_ptr<Scheduler> getScheduler();
137138
std::shared_ptr<FabricMountingManager> verifyMountingManager(
138139
std::string const &locationHint);
139140

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#include "JFabricUIManager.h"
9+
10+
namespace facebook::react {
11+
12+
Binding *JFabricUIManager::getBinding() {
13+
static const auto bindingField =
14+
javaClassStatic()->getField<Binding::javaobject>("mBinding");
15+
16+
return getFieldValue(bindingField)->cthis();
17+
}
18+
} // namespace facebook::react
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#pragma once
9+
10+
#include <fbjni/fbjni.h>
11+
#include "Binding.h"
12+
13+
using namespace facebook::jni;
14+
15+
namespace facebook::react {
16+
17+
class JFabricUIManager : public JavaClass<JFabricUIManager> {
18+
public:
19+
static constexpr auto kJavaDescriptor =
20+
"Lcom/facebook/react/fabric/FabricUIManager;";
21+
22+
Binding *getBinding();
23+
};
24+
25+
} // namespace facebook::react

0 commit comments

Comments
 (0)