Skip to content

Commit 7403e1e

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Reach public ReactCommon modules through umbrellas from Android platform headers
Summary: Android headers exported through prefab (`react/fabric/*`, `JReadableMapBuffer.h`, and `DefaultComponentsRegistry.h`, which app `OnLoad.cpp` files include) included fine-grained headers of public ReactCommon modules, which trip the modules' public guard under `RN_STRICT_API` in any app or library including them. Switch them to the module umbrellas (`<React/RendererCore.h>`, `<React/ComponentRegistry.h>`, `<React/Debug.h>`, `<React/MapBuffer.h>`). "For frameworks" includes stay direct, since umbrellas do not re-export them: `ComponentFactory.h` keeps `<react/renderer/componentregistry/ComponentDescriptorFactory.h>` for `ComponentRegistryFactory`. To keep that framework-tier header out of app code, `DefaultComponentsRegistry.h` now forward-declares `ComponentFactory` (it only takes it by pointer) and `DefaultComponentsRegistry.cpp` includes it. The guards are inert without `RN_STRICT_API`. Changelog: [Internal] Differential Revision: D123610673
1 parent 73f4204 commit 7403e1e

9 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎packages/react-native/ReactAndroid/src/main/jni/react/fabric/AndroidEventBeat.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/renderer/core/EventBeat.h>
10+
#include <React/RendererCore.h>
1111

1212
#include "EventBeatManager.h"
1313

‎packages/react-native/ReactAndroid/src/main/jni/react/fabric/ComponentFactory.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
#pragma once
99

10+
#include <React/ComponentRegistry.h>
1011
#include <fbjni/fbjni.h>
1112
#include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
12-
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
1313

1414
namespace facebook::react {
1515

‎packages/react-native/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
10+
#include <React/ComponentRegistry.h>
1111

1212
namespace facebook::react::CoreComponentsRegistry {
1313

‎packages/react-native/ReactAndroid/src/main/jni/react/fabric/EventEmitterWrapper.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
#pragma once
99

10+
#include <React/RendererCore.h>
1011
#include <fbjni/fbjni.h>
1112
#include <react/jni/ReadableNativeMap.h>
12-
#include <react/renderer/core/EventEmitter.h>
1313

1414
namespace facebook::react {
1515

‎packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include <mutex>
1111
#include <unordered_map>
1212

13+
#include <React/RendererCore.h>
1314
#include <fbjni/fbjni.h>
1415
#include <react/fabric/JFabricUIManager.h>
15-
#include <react/renderer/core/Props.h>
1616
#include <react/renderer/uimanager/primitives.h>
1717

1818
namespace facebook::react {

‎packages/react-native/ReactAndroid/src/main/jni/react/fabric/StateWrapperImpl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
#pragma once
99

10+
#include <React/RendererCore.h>
1011
#include <fbjni/fbjni.h>
1112
#include <react/common/mapbuffer/JReadableMapBuffer.h>
1213
#include <react/jni/ReadableNativeMap.h>
13-
#include <react/renderer/core/State.h>
1414
#include <react/uimanager/StateWrapper.h>
1515

1616
namespace facebook::react {

‎packages/react-native/ReactAndroid/src/main/jni/react/mapbuffer/react/common/mapbuffer/JReadableMapBuffer.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
#pragma once
99

10+
#include <React/Debug.h>
11+
#include <React/MapBuffer.h>
1012
#include <fbjni/fbjni.h>
11-
#include <react/debug/react_native_assert.h>
12-
#include <react/renderer/mapbuffer/MapBuffer.h>
1313

1414
#include <fbjni/ByteBuffer.h>
1515

‎packages/react-native/ReactAndroid/src/main/jni/react/newarchdefaults/DefaultComponentsRegistry.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <CoreComponentsRegistry.h>
1111
#include <fbjni/fbjni.h>
1212
#include <react/debug/react_native_assert.h>
13+
#include <react/fabric/ComponentFactory.h>
1314
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
1415
#include <react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h>
1516

‎packages/react-native/ReactAndroid/src/main/jni/react/newarchdefaults/DefaultComponentsRegistry.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
#pragma once
99

10+
#include <React/ComponentRegistry.h>
11+
#include <React/RendererCore.h>
1012
#include <fbjni/fbjni.h>
11-
#include <react/fabric/ComponentFactory.h>
12-
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
13-
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
14-
#include <react/renderer/core/ConcreteComponentDescriptor.h>
1513

1614
namespace facebook::react {
1715

16+
class ComponentFactory;
17+
1818
class DefaultComponentsRegistry : public facebook::jni::JavaClass<DefaultComponentsRegistry> {
1919
public:
2020
constexpr static auto kJavaDescriptor = "Lcom/facebook/react/defaults/DefaultComponentsRegistry;";

0 commit comments

Comments
 (0)