Nil*_*lVS 5 javascript native reactjs react-native
我想在我的应用程序中显示 Android 版本(如 8.0、9.0...)。现在我正在使用:Platform.Version但这会返回 API 版本 (24, 25 ...)。
我想要一个比仅仅创建映射更优雅的选项,并且不需要在每次有新的 android 版本时重新发布。有没有办法在没有外部库的情况下做到这一点?
你可以使用这个库,
import DeviceInfo from "react-native-device-info";
DeviceInfo.getSystemVersion()
Run Code Online (Sandbox Code Playgroud)
除了版本之外,它还有很多方法可以方便地获取设备特定信息。
编辑:它是getSystemVersion()
你可以 :
import { Platform } from 'react-native';
const OsVer = Platform.constants['Release'];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8084 次 |
| 最近记录: |