Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 使用expo react native管理环境_Reactjs_React Native_Expo - Fatal编程技术网

Reactjs 使用expo react native管理环境

Reactjs 使用expo react native管理环境,reactjs,react-native,expo,Reactjs,React Native,Expo,我想知道如何通过世博会管理环境 我试图遵循这个,但我有一个错误,在检测模式 我替换了“expo”中的导入常量;通过从“expo Constants”导入常量 environment.js /***************************** * environment.js * path: '/environment.js' (root of your project) ******************************/ import Constants from '

我想知道如何通过世博会管理环境

我试图遵循这个,但我有一个错误,在检测模式

我替换了“expo”中的导入常量;通过从“expo Constants”导入常量

environment.js

/*****************************
 * environment.js
 * path: '/environment.js' (root of your project)
 ******************************/

import Constants from 'expo-constants';

const ENV = {
    dev: {
        apiUrl: 'http://localhost.com/api',
    },
    staging: {
        apiUrl: "https://website.com/api",
    },
    prod: {
        apiUrl: "https://website.com/api",
    }
};

const getEnvVars = (env = Constants.manifest.releaseChannel) => {
    // What is __DEV__ ?
    // This variable is set to true when react-native is running in Dev mode.
    // __DEV__ is true when run locally, but false when published.
    if (__DEV__) {
        return ENV.dev;
    } else if (env === 'staging') {
        return ENV.staging;
    } else if (env === 'prod') {
        return ENV.prod;
    }
};

export default getEnvVars;
当我打开“生产模式”时,我有以下错误:

undefined不是对象(正在评估'j.websiteUrl')


如果我能检查模式,我想我的错误会被修复。

其他模式是否正常工作?其他模式是否正常工作?