Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions android/build/generated/source/codegen/jni/CMakeLists.txt

This file was deleted.

2 changes: 0 additions & 2 deletions android/build/generated/source/codegen/jni/empty.cpp

This file was deleted.

31 changes: 2 additions & 29 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,8 @@
// Bridge to:
// Android: buildConfigField vars set in build.gradle, and exported via ReactConfig
// iOS: config vars set in xcconfig and exposed via RNCConfig.m
import { NativeModules, TurboModuleRegistry, Platform } from 'react-native';
import { NativeModules } from 'react-native';

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

function getTurboModule() {
try {
if (TurboModuleRegistry?.get) {
return TurboModuleRegistry.get(TM_NAME);
}
} catch (_) {}
return null;
}

const Turbo = getTurboModule();
const Paper = NativeModules?.RNCConfigModule;

let config = {};
if (Turbo) {
// Prefer TM sync getAll when available to return a plain object
if (typeof Turbo.getAll === 'function') {
try { config = Turbo.getAll() || {}; } catch (_) { config = {}; }
} else {
config = Turbo;
}
} else if (Paper) {
config = Paper;
}

export const Config = config;
export default Config;

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-config",
"version": "1.5.7",
"version": "1.5.6",
"description": "Expose config variables to React Native apps",
"keywords": [
"env",
Expand Down Expand Up @@ -42,7 +42,7 @@
"@types/jest": "^29.5.12"
},
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.0",
"@babel/preset-react": "^7.24.7",
"babel-jest": "^29.7.0"
Expand Down