Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native access strings.xml from inside javascript code

Is there a way to access the current values from android/app/src/main/res/values/strings.xml from inside Javascript code? I want to place different endpoint URLs for each build, but I'm failing even to detect the type of build inside react-native code without having to resort to the __DEV__ variable (which can be turned off from the dev menu)

like image 589
pocesar Avatar asked Oct 23 '25 23:10

pocesar


1 Answers

The only way this might be possible would be building a bridge using native modules, https://facebook.github.io/react-native/docs/native-modules-android.html. Essential you can pass strings in JS to the native modules and have native function handle which string to grab and pass back to JS.

like image 154
WilliamC Avatar answered Oct 26 '25 14:10

WilliamC