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

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

    You can use react-native-device-info

    And you can get app version for both iOS and Android by calling following method.

    const version = DeviceInfo.getVersion();
    
    // iOS: "1.0"
    // Android: "1.0"
    

    Hope this will help.

提交回复
热议问题