Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

react-native-dotenv with multiple enviorments only runs local env in react native using typescript

$
0
0

i'm trying to expo start my react native with typescript app on 3 different environments-development, local and testing. but when i run APP_ENV=testing expo start or APP_ENV=development expo start it always runs on local environment.i tried using APP_ENV=testing expo r -c or APP_ENV=development expo r -cand yarn start --reset-cache and react-native-clean-project and non of those helped.in the root of my project i have a folder named "environments" with 4 files- ".env.local", ".env.development", ".env.testing" and "types.d.ts". this is the code containd in my "babel.config.js"-

 api.cache(true); return {   presets: ["babel-preset-expo"],   plugins: ["react-native-reanimated/plugin",     ["module:react-native-dotenv",       {         moduleName: "react-native-dotenv",         path: "./environments/.env",         blacklist: null,         whitelist: null,         safe: false,         allowUndefined: true,       },     ],   ], };};

this is the code containd in types.d.ts file from environments folder- declare module "react-native-dotenv" { export const API_BASE_URL: string; }

i also added the following "typesRootes": ["./environments/types"] to "tsconfig.json"

im really not sure how to solve this, any help will be much appreciated.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>