react-native-config 1.5.8 → 1.5.10

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.
@@ -9,7 +9,14 @@ buildscript {
9
9
  }
10
10
  }
11
11
 
12
+ def isNewArchitectureEnabled() {
13
+ return project.hasProperty("newArchEnabled") && (project.newArchEnabled == "true" || project.newArchEnabled == true)
14
+ }
15
+
12
16
  apply plugin: 'com.android.library'
17
+ if (isNewArchitectureEnabled()) {
18
+ apply plugin: 'com.facebook.react'
19
+ }
13
20
 
14
21
  def safeExtGet(prop, fallback) {
15
22
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
@@ -44,12 +51,23 @@ android {
44
51
  targetSdkVersion rootProject.ext.targetSdkVersion
45
52
  versionCode 1
46
53
  versionName "1.0"
54
+
55
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
56
+
57
+ ndk {
58
+ abiFilters(*reactNativeArchitectures())
59
+ }
47
60
  }
48
61
  lintOptions {
49
62
  abortOnError false
50
63
  }
51
64
  }
52
65
 
66
+ def reactNativeArchitectures() {
67
+ def value = project.getProperties().get("reactNativeArchitectures")
68
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
69
+ }
70
+
53
71
  repositories {
54
72
  mavenCentral()
55
73
  }
package/index.js CHANGED
@@ -3,35 +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;
37
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-config",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
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"
@@ -4,7 +4,8 @@ import { TurboModuleRegistry } from 'react-native';
4
4
  export interface Spec extends TurboModule {
5
5
  // Synchronous getters (supported on Windows TurboModules)
6
6
  getAll(): { [key: string]: string };
7
- get(key: string): string;
7
+ // it's overriding react-native method, so we're not using it
8
+ // get(key: string): string;
8
9
  // Optional Composition info hook
9
10
  compositionInfo?(): string;
10
11
  }
@@ -1,13 +0,0 @@
1
- # Minimal stub CMakeLists for missing codegen outputs.
2
- # This defines the react_codegen_RNCConfigModule target so native builds
3
- # that expect generated code can link against a placeholder library.
4
- cmake_minimum_required(VERSION 3.4.1)
5
-
6
- # Create a small static library with a trivial source file so CMake has a target to link.
7
- add_library(react_codegen_RNCConfigModule STATIC "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
8
-
9
- # Expose the current source dir (if other CMake code expects include dirs)
10
- target_include_directories(react_codegen_RNCConfigModule PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
11
-
12
- # Prevent warnings when linked against: set an empty interface
13
- target_compile_definitions(react_codegen_RNCConfigModule INTERFACE "REACT_NATIVE_CONFIG_STUB")
@@ -1,2 +0,0 @@
1
- // Auto-generated stub file to satisfy CMake when real codegen output is not present.
2
- extern "C" void __react_native_config_codegen_stub() {}