React-native-config: Can not get value in export const

Created on 5 Jan 2018  路  2Comments  路  Source: luggit/react-native-config

Hi team,
I export function

import Config from 'react-native-config';

export const AuthenticateService = {
  login(data) {
    console.log('Config.API_VERSION', Config.API_VERSION);
 }
};

=> Config.API_VERSION return undefined

BUT if I render in View it returns value.

How I can get value Config.API_VERSION in AuthenticateService
Can you help?
Thanks

Most helpful comment

I had the same problem.

For iOS, ReactNativeConfig.xcodeproj needs to be manually added to Libraries and libReactNativeConfig.a added to Build Phases -> Link Binary With Libraries.

This is because react-native link doesn't work well.

All 2 comments

Hello,
Do you add the line on android/app/build.gradle file as explain in Extra step for Android ?

I had the same problem.

For iOS, ReactNativeConfig.xcodeproj needs to be manually added to Libraries and libReactNativeConfig.a added to Build Phases -> Link Binary With Libraries.

This is because react-native link doesn't work well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sunweiyang picture sunweiyang  路  4Comments

francisrod01 picture francisrod01  路  3Comments

kidnapkin picture kidnapkin  路  3Comments

Husnain-Asharf picture Husnain-Asharf  路  3Comments

NachtRitter picture NachtRitter  路  4Comments