Skip to content

Commit 2116a0e

Browse files
committed
Removed a check that is no longer needed
We've had some issue with monorepos when resolving the codegen config on Android in other libraries, and found that due to versions no longer in use we could now remove the version test in `react-native-config.js` and always return the component descriptor etc. (The monorepo issue was with using `require.main.require` which will resolve to the calling script and not the module) For reference, here is the same PR in @react-native-community/slider: callstack/react-native-slider#657
1 parent 2c827b1 commit 2116a0e

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

react-native.config.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
1-
let supportsCodegenConfig = false;
2-
try {
3-
const rnCliAndroidVersion = require.main.require(
4-
'@react-native-community/cli-platform-android/package.json',
5-
).version;
6-
const [major] = rnCliAndroidVersion.split('.');
7-
supportsCodegenConfig = major >= 9;
8-
} catch (e) {
9-
// ignore
10-
}
11-
121
module.exports = {
132
dependency: {
143
platforms: {
15-
android: supportsCodegenConfig
16-
? {
17-
libraryName: 'safeareacontext',
18-
componentDescriptors: [
19-
'RNCSafeAreaProviderComponentDescriptor',
20-
'RNCSafeAreaViewComponentDescriptor',
21-
],
22-
cmakeListsPath: 'src/main/jni/CMakeLists.txt',
23-
}
24-
: {},
4+
android: {
5+
libraryName: 'safeareacontext',
6+
componentDescriptors: [
7+
'RNCSafeAreaProviderComponentDescriptor',
8+
'RNCSafeAreaViewComponentDescriptor',
9+
],
10+
cmakeListsPath: 'src/main/jni/CMakeLists.txt',
11+
},
2512
macos: null,
2613
windows: null,
2714
},

0 commit comments

Comments
 (0)