How to get a versionName in react-native app on Android?

后端 未结 8 1005
故里飘歌
故里飘歌 2020-12-25 09:55

I\'ve made a timestamped versionName in build.gradle like 20150707.1125. I want to show the version of the package in react-native app in about window. How I could get vers

相关标签:
8条回答
  • 2020-12-25 10:24

    If you want the version number in your package.json, you can also do:

    var pkg = require('./package.json');
    console.log(pkg.version);
    
    0 讨论(0)
  • 2020-12-25 10:26

    I used the following snippet to extract version info using package.json:

    import PackageJson from '../../../package'    // where package is the package.json file
    
    console.log('version', PackageJson.version)  
    

    Hope it helps.

    0 讨论(0)
提交回复
热议问题