-1

I am a beginner in ReactNative. I have an app where I am defining the Version number using a Text tag. Is there any way we can get this dynamically through the bundle?

Any help would be appreciated. Thank you in advance!

curveball
  • 4,320
  • 15
  • 39
  • 49
pree
  • 239
  • 1
  • 3
  • 12

1 Answers1

0

When you say through bundle, do you mean from your package.json?

If so I would recommend that you use node.js to script your build process, grab the package data from there, and write it to an environment file or a js/ts file you could include in your application and reference to store your version.

Chris
  • 470
  • 1
  • 4
  • 15
  • Thanks for the help. I was suggested to include my data in Info.plist.But I am not sure how can I do that @Chris – pree Aug 24 '18 at 17:45
  • If using Create React Native App that almost certainly would require you to eject your application or use a third party library. Check out this answer on how to access CFBundleVersion https://stackoverflow.com/questions/35640125/how-to-read-info-plist-at-run-time-in-react-native-ios-app – Chris Aug 24 '18 at 17:50
  • Thanks @Chris ,That is exactly what i was looking for – pree Aug 24 '18 at 18:06