You can make simple custom module to get that value from iOS native side.
Here is the custom module named RNConfig
RNConfig.h
#import <Foundation/Foundation.h>
#import "React/RCTBridgeModule.h"
@interface RNConfig : NSObject<RCTBridgeModule>
@end
RNConfig.m
#import "RNConfig.h"
@implementation RNConfig
RCT_EXPORT_MODULE();
- (NSDictionary *)constantsToExport
{
NSString* platform_name = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"PlatformName"];
return @{ @"PlatformName": platform_name };
}
@end
With React Native you can use that module by following code snippets.
const { RNConfig } = require('NativeModules');
let platformName = RNConfig.PlatformName;
This module could be used when you have multiple targets on iOS side.
So On React Native side, you have many config values according to every targets.
config/index.js
import { targetA } from './targetA';
import { targetB } from './targetB';
const variables = {
targetA,
targetB
};
const { RNConfig } = require('NativeModules');
export default variables[RNConfig.PlatformName];
If your iOS target name is targetA or targetB then you can use the specific configuration setting on React Native side by getting iOS platform name like above.
Anyway, you can get any types of configuration values on iOS side by changing the RNConfig.m file.