Skip to content

Commit

Permalink
Removed a check that is no longer needed
Browse files Browse the repository at this point in the history
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
  • Loading branch information
chrfalch committed Oct 11, 2024
1 parent 2c827b1 commit 2116a0e
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
let supportsCodegenConfig = false;
try {
const rnCliAndroidVersion = require.main.require(
'@react-native-community/cli-platform-android/package.json',
).version;
const [major] = rnCliAndroidVersion.split('.');
supportsCodegenConfig = major >= 9;
} catch (e) {
// ignore
}

module.exports = {
dependency: {
platforms: {
android: supportsCodegenConfig
? {
libraryName: 'safeareacontext',
componentDescriptors: [
'RNCSafeAreaProviderComponentDescriptor',
'RNCSafeAreaViewComponentDescriptor',
],
cmakeListsPath: 'src/main/jni/CMakeLists.txt',
}
: {},
android: {
libraryName: 'safeareacontext',
componentDescriptors: [
'RNCSafeAreaProviderComponentDescriptor',
'RNCSafeAreaViewComponentDescriptor',
],
cmakeListsPath: 'src/main/jni/CMakeLists.txt',
},
macos: null,
windows: null,
},
Expand Down

0 comments on commit 2116a0e

Please sign in to comment.