Skip to content

Commit 55382e6

Browse files
protikbiswas100Protik Biswasluancurti
authored
fixing android build (#845)
Co-authored-by: Protik Biswas <[email protected]> Co-authored-by: luancurti <[email protected]>
1 parent 127c5cc commit 55382e6

File tree

4 files changed

+4
-46
lines changed

4 files changed

+4
-46
lines changed

android/build/generated/source/codegen/jni/CMakeLists.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

android/build/generated/source/codegen/jni/empty.cpp

Lines changed: 0 additions & 2 deletions
This file was deleted.

index.js

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,8 @@
33
// Bridge to:
44
// Android: buildConfigField vars set in build.gradle, and exported via ReactConfig
55
// iOS: config vars set in xcconfig and exposed via RNCConfig.m
6-
import { NativeModules, TurboModuleRegistry, Platform } from 'react-native';
6+
import { NativeModules } from 'react-native';
77

8-
// New-arch TurboModule name should match native module name
9-
const TM_NAME = 'RNCConfigModule';
8+
export const Config = NativeModules.RNCConfigModule || {}
109

11-
function getTurboModule() {
12-
try {
13-
if (TurboModuleRegistry?.get) {
14-
return TurboModuleRegistry.get(TM_NAME);
15-
}
16-
} catch (_) {}
17-
return null;
18-
}
19-
20-
const Turbo = getTurboModule();
21-
const Paper = NativeModules?.RNCConfigModule;
22-
23-
let config = {};
24-
if (Turbo) {
25-
// Prefer TM sync getAll when available to return a plain object
26-
if (typeof Turbo.getAll === 'function') {
27-
try { config = Turbo.getAll() || {}; } catch (_) { config = {}; }
28-
} else {
29-
config = Turbo;
30-
}
31-
} else if (Paper) {
32-
config = Paper;
33-
}
34-
35-
export const Config = config;
3610
export default Config;
37-

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-config",
3-
"version": "1.5.8",
3+
"version": "1.5.9",
44
"description": "Expose config variables to React Native apps",
55
"keywords": [
66
"env",
@@ -42,7 +42,7 @@
4242
"@types/jest": "^29.5.12"
4343
},
4444
"dependencies": {
45-
"@babel/core": "^7.25.2",
45+
"@babel/core": "^7.25.2",
4646
"@babel/preset-env": "^7.25.0",
4747
"@babel/preset-react": "^7.24.7",
4848
"babel-jest": "^29.7.0"

0 commit comments

Comments
 (0)