react-native-config 1.5.7 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +2 -28
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -3,34 +3,8 @@
3
3
  // Bridge to:
4
4
  // Android: buildConfigField vars set in build.gradle, and exported via ReactConfig
5
5
  // 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';
7
7
 
8
- // New-arch TurboModule name should match native module name
9
- const TM_NAME = 'RNCConfigModule';
8
+ export const Config = NativeModules.RNCConfigModule || {}
10
9
 
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;
36
10
  export default Config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-config",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "Expose config variables to React Native apps",
5
5
  "keywords": [
6
6
  "env",
@@ -42,7 +42,7 @@
42
42
  "@types/jest": "^29.5.12"
43
43
  },
44
44
  "dependencies": {
45
- "@babel/core": "^7.25.2",
45
+ "@babel/core": "^7.25.2",
46
46
  "@babel/preset-env": "^7.25.0",
47
47
  "@babel/preset-react": "^7.24.7",
48
48
  "babel-jest": "^29.7.0"