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

后端 未结 8 1128
故里飘歌
故里飘歌 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:22

    I've successfully used the React Native Device Info component to get the build details as specified in the Gradle config.

    Once installed you can use:

    DeviceInfo.getVersion()
    

    To output the version, and:

    DeviceInfo.getBuildNumber()
    

    To get the build number.

提交回复
热议问题