-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable are UNDEFINED on IOS #788
Comments
hey, did you find a way to make it work? |
I think I am seeing this as well |
I have the same issue |
Solved mine, please clean and build on XCode |
I've been having this issue for weeks, still no solution in sight. |
Hi @Antholife You are importing in the wrong way it should be |
Hi, I've already tried both, which is not the problem, and it's valid. And some people have the same problem
|
Same issue here "react-native-config": "^1.5.1" |
Not sure if this was a long-running user error on my part, or something changed in react-native-config, but I determined that the shell script I was using to generate .env files during builds was running after the part of the xcode build that looks for the files. I ended up moving this process from a Build Phase into a pre-build action and my issue was resolved. |
Could you please tell us what you have changed explicitly? Like what is the section of the shell script that loaded up the vars?
…________________________________
From: Justin Counts ***@***.***>
Sent: Monday, February 26, 2024 8:12:42 PM
To: lugg/react-native-config ***@***.***>
Cc: Iliescu Dan Cristian ***@***.***>; Comment ***@***.***>
Subject: Re: [lugg/react-native-config] Variable are UNDEFINED on IOS (Issue #788)
Not sure if this was a long-running user error on my part, or something changed in react-native-config, but I determined that the shell script I was using to generate .env files during builds was running after the part of the xcode build that looks for the files.
I ended up moving this process from a Build Phase into a pre-build action and my issue was resolved.
—
Reply to this email directly, view it on GitHub<#788 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ATGPWAUE5VUQCSATJWXCA5DYVTGBVAVCNFSM6AAAAABBPZLOXKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRUHAYTMNJSGQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
The Shell Script was invoked as part of a However these scripts were running after Pod were compiled, the .env file was generated after react-native-config's build process looked for it., I instead invoke the script in a Pre-Build Action |
i solved the promblem by this issue on stackoverflow |
Is works for me, this is my RN version
At first, I was encounter the same issue undefined in ios. It works after I "Clean Build Folder". It could be cache issue. Is better try following :
Hope it works for you! |
Why? Temporary workarounds:
|
I use:
When I log my variables they are undefined, I've come to find you because I haven't been able to solve the problem for a few days.
I don't use EXPO.
My .env:
API_ENDPOINT=DEVELOPMENT_PHYSICAL
My react-native.config.d.ts:
declare module "react-native-config" {
export interface NativeConfig {
API_ENDPOINT:
| "DEVELOPMENT"
| "DEVELOPMENT_PHYSICAL"
| "PRODUCTION"
| undefined;
}
export const Config: NativeConfig;
export default Config;
}`
In my file:
import { Config } from "react-native-config";
const { API_ENDPOINT } = Config;
console.log(Config.API_ENDPOINT);
console.log(API_ENDPOINT);
LOG undefined
LOG undefined
The text was updated successfully, but these errors were encountered: