Device Information for React Native.
If you are upgrading from v2 to v3, check the guide out: https://github.com/react-native-community/react-native-device-info/wiki/V2-to-V3-Migration-Guide
For those upgrading to v4, follow the v2 to v3 guide first, then follow this: https://github.com/react-native-community/react-native-device-info/wiki/V3-to-V4-Migration-Guide
Using npm:
npm install --save react-native-device-info
or using yarn:
yarn add react-native-device-info
⚠️ If you are on React Native > 0.47, you must use version 0.11.0 of this library or higher
This module defaults to AndroidX you should configure your library versions similar to this in your android/build.gradle
file's "ext" block
If you need non-AndroidX you will need to use the jetifier package in reverse mode, documentation available with that package.
react-native link react-native-device-info
(or using rnpm
for versions of React Native < 0.27)
rnpm link react-native-device-info
For iOS users using Pods
You still need to run pod install
after running the above link command inside your IOS
folder.
import DeviceInfo from 'react-native-device-info';
// or ES6+ destructured imports
import { getUniqueId, getManufacturer } from 'react-native-device-info';
Note that many APIs are platform-specific. If there is no implementation for a platform, then the "default" return values you will receive are "unknown"
for string, -1
for number, and false
for boolean. Arrays and Objects will be empty ([]
and {}
respectively).
Most APIs return a Promise but also have a corresponding API with Sync
on the end that operates synchronously. For example, you may prefer to call isCameraPresentSync()
during your app bootstrap to avoid async calls during the first parts of app startup.
Method | Return Type | iOS | Android | Windows | Web |
---|---|---|---|---|---|
getAndroidId() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getApiLevel() | Promise<number> |
❌ | ✅ | ❌ | ❌ |
getApplicationName() | string |
✅ | ✅ | ✅ | ❌ |
getAvailableLocationProviders() | Promise<Object> |
✅ | ✅ | ❌ | ❌ |
getBaseOs() | Promise<string> |
❌ | ✅ | ❌ | ✅ |
getBuildId() | Promise<string> |
✅ | ✅ | ❌ | ❌ |
getBatteryLevel() | Promise<number> |
✅ | ✅ | ✅ | ✅ |
getBootloader() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getBrand() | string |
✅ | ✅ | ✅ | ❌ |
getBuildNumber() | string |
✅ | ✅ | ✅ | ❌ |
getBundleId() | string |
✅ | ✅ | ✅ | ❌ |
isCameraPresent() | Promise<boolean> |
❌ | ✅ | ✅ | ✅ |
getCarrier() | Promise<string> |
✅ | ✅ | ❌ | ❌ |
getCodename() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getDevice() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getDeviceId() | string |
✅ | ✅ | ✅ | ❌ |
getDeviceType() | string |
✅ | ✅ | ❌ | ❌ |
getDisplay() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getDeviceName() | Promise<string> |
✅ | ✅ | ✅ | ❌ |
getDeviceToken() | Promise<string> |
✅ | ❌ | ❌ | ❌ |
getFirstInstallTime() | Promise<number> |
❌ | ✅ | ✅ | ❌ |
getFingerprint() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getFontScale() | Promise<number> |
✅ | ✅ | ❌ | ❌ |
getFreeDiskStorage() | Promise<number> |
✅ | ✅ | ❌ | ✅ |
getHardware() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getHost() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getIpAddress() | Promise<string> |
✅ | ✅ | ✅ | ❌ |
getIncremental() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getInstallerPackageName() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getInstallReferrer() | Promise<string> |
❌ | ✅ | ❌ | ✅ |
getInstanceId() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getLastUpdateTime() | Promise<number> |
❌ | ✅ | ❌ | ❌ |
getMacAddress() | Promise<string> |
✅ | ✅ | ❌ | ❌ |
getManufacturer() | Promise<string> |
✅ | ✅ | ✅ | ❌ |
getMaxMemory() | Promise<number> |
❌ | ✅ | ✅ | ✅ |
getModel() | string |
✅ | ✅ | ✅ | ❌ |
getPhoneNumber() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getPowerState() | Promise<object> |
✅ | ✅ | ❌ | ✅ |
getProduct() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getPreviewSdkInt() | Promise<number> |
❌ | ✅ | ❌ | ❌ |
getReadableVersion() | string |
✅ | ✅ | ✅ | ❌ |
getSerialNumber() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getSecurityPatch() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getSystemAvailableFeatures() | Promise<string[]> |
❌ | ✅ | ❌ | ❌ |
getSystemName() | string |
✅ | ✅ | ✅ | ❌ |
getSystemVersion() | string |
✅ | ✅ | ✅ | ❌ |
getTags() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getType() | Promise<string> |
❌ | ✅ | ❌ | ❌ |
getTotalDiskCapacity() | Promise<number> |
✅ | ✅ | ❌ | ✅ |
getTotalMemory() | Promise<number> |
✅ | ✅ | ❌ | ✅ |
getUniqueId() | string |
✅ | ✅ | ✅ | ❌ |
getUsedMemory() | Promise<number> |
✅ | ✅ | ❌ | ✅ |
getUserAgent() | Promise<string> |
✅ | ✅ | ❌ | ✅ |
getVersion() | string |
✅ | ✅ | ✅ | ❌ |
hasNotch() | boolean |
✅ | ✅ | ✅ | ❌ |
hasSystemFeature() | Promise<boolean> |
❌ | ✅ | ❌ | ❌ |
isAirplaneMode() | Promise<boolean> |
❌ | ✅ | ❌ | ✅ |
isBatteryCharging() | Promise<boolean> |
✅ | ✅ | ❌ | ✅ |
isEmulator() | Promise<boolean> |
✅ | ✅ | ✅ | ❌ |
isLandscape() | Promise<boolean> |
✅ | ✅ | ✅ | ❌ |
isLocationEnabled() | Promise<boolean> |
✅ | ✅ | ❌ | ✅ |
isHeadphonesConnected() | Promise<boolean> |
✅ | ✅ | ❌ | ❌ |
isPinOrFingerprintSet() | Promise<boolean> |
✅ | ✅ | ✅ | ❌ |
isTablet() | boolean |
✅ | ✅ | ✅ | ❌ |
supported32BitAbis() | Promise<string[]> |
❌ | ✅ | ❌ | ❌ |
supported64BitAbis() | Promise<string[]> |
❌ | ✅ | ❌ | ❌ |
supportedAbis() | Promise<string[]> |
✅ | ✅ | ❌ | ❌ |
syncUniqueId() | Promise<string> |
✅ | ❌ | ❌ | ❌ |
Gets the API level.
DeviceInfo.getApiLevel().then(apiLevel => {
// iOS: ?
// Android: 25
// Windows: ?
});
See API Levels
Gets the ANDROID_ID. See API documentation for appropriate use.
DeviceInfo.getAndroidId().then(androidId => {
// androidId here
});
Gets the application name.
let appName = DeviceInfo.getApplicationName();
// AwesomeApp
The base OS build the product is based on.
DeviceInfo.getBaseOs().then(baseOs => {
// "Windows", "Android" etc
});
Gets the battery level of the device as a float comprised between 0 and 1.
DeviceInfo.getBatteryLevel().then(batteryLevel => {
// 0.759999
});
To be able to get actual battery level enable battery monitoring mode for application. Add this code:
[UIDevice currentDevice].batteryMonitoringEnabled = true;
to AppDelegate.m application:didFinishLaunchingWithOptions:
Returns -1 on the iOS Simulator
The system bootloader version number.
DeviceInfo.getBootloader().then(bootloader => {
// "mw8998-002.0069.00"
});
Gets the device brand.
let brand = DeviceInfo.getBrand();
// iOS: "Apple"
// Android: "xiaomi"
// Windows: ?
Gets the application build number.
let buildNumber = DeviceInfo.getBuildNumber();
// iOS: "89"
// Android: "4"
// Windows: ?
Gets the application bundle identifier.
let bundleId = DeviceInfo.getBundleId();
// "com.example.AwesomeApp"
Tells if the device have any camera now.
DeviceInfo.isCameraPresent()
.then(isCameraPresent => {
// true or false
})
.catch(cameraAccessException => {
// is thrown if a camera device could not be queried or opened by the CameraManager on Android
});
- Hot add/remove of camera is supported.
- Returns the status of the physical presence of the camera. If camera present but your app don't have permissions to use it, isCameraPresent will still return the true
Gets the carrier name (network operator).
DeviceInfo.getCarrier().then(carrier => {
// "SOFTBANK"
});
The current development codename, or the string "REL" if this is a release build.
DeviceInfo.getCodename().then(codename => {
// "REL"
});
The name of the industrial design.
DeviceInfo.getDevice().then(device => {
// "walleye"
});
Gets the device ID.
let deviceId = DeviceInfo.getDeviceId();
// iOS: "iPhone7,2"
// Android: "goldfish"
// Windows: ?
A build ID string meant for displaying to the user.
DeviceInfo.getDisplay().then(display => {
// "OPM2.171026.006.G1"
});
Gets the device name.
DeviceInfo.getDeviceName().then(deviceName => {
// iOS: "Becca's iPhone 6"
// Android: ?
// Windows: ?
});
This used to require the android.permission.BLUETOOTH but the new implementation in v3 does not need it. You may remove that from your AndroidManifest.xml if you had it for this API.
Gets the device token (see DeviceCheck). Only available for iOS 11.0+ on real devices. This will reject the promise when getDeviceToken is not supported, be careful with exception handling.
DeviceInfo.getDeviceToken().then(deviceToken => {
// iOS: "a2Jqsd0kanz..."
});
Gets the time at which the app was first installed, in milliseconds.
DeviceInfo.getFirstInstallTime().then(firstInstallTime => {
// Android: 1517681764528
});
A string that uniquely identifies this build.
DeviceInfo.getFingerprint().then(fingerprint => {
// "google/walleye/walleye:8.1.0/OPM2.171026.006.G1/4820017:user/release-keys"
});
Gets the device font scale. The font scale is the ratio of the current system font to the "normal" font size, so if normal text is 10pt and the system font is currently 15pt, the font scale would be 1.5 This can be used to determine if accessability settings has been changed for the device; you may want to re-layout certain views if the font scale is significantly larger ( > 2.0 )
In iOS App Extensions this call always returns 1.0, see #625.
DeviceInfo.getFontScale().then(fontScale => {
// 1.2
});
Gets available storage size, in bytes.
DeviceInfo.getFreeDiskStorage().then(freeDiskStorage => {
// Android: 17179869184
// iOS: 17179869184
});
From [developer.android.com](https://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()):
Return the primary shared/external storage directory.
Note: don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.
The name of the hardware (from the kernel command line or /proc).
DeviceInfo.getHardware().then(hardware => {
// "walleye"
};
Hostname
DeviceInfo.getHost().then(host => {
// "wprd10.hot.corp.google.com"
});
Deprecated Gets the device current IP address. (of wifi only) Switch to @react-native-community/netinfo or react-native-network-info
DeviceInfo.getIpAddress().then(ip => {
// "92.168.32.44"
});
Support for iOS was added in 0.22.0
The internal value used by the underlying source control to represent this build.
DeviceInfo.getIncremental().then(incremental => {
// "4820017"
});
The internal value used by the underlying source control to represent this build.
DeviceInfo.getInstallerPackageName().then(installerPackageName => {
// Play Store: "com.android.vending"
// Amazon: "com.amazon.venezia"
// Samsung App Store: "com.sec.android.app.samsungapps"
// Developer, iOS: "unknown"
});
Gets the referrer string upon application installation.
DeviceInfo.getInstallReferrer().then(installReferrer => {
// If the app was installed from https://play.google.com/store/apps/details?id=com.myapp&referrer=my_install_referrer
// the result will be "my_install_referrer"
});
Gets the application instance ID.
DeviceInfo.getInstanceId().then(instanceId => {
// Android: ?
});
Gets the time at which the app was last updated, in milliseconds.
DeviceInfo.getLastUpdateTime().then(lastUpdateTime => {
// Android: 1517681764992
});
Gets the network adapter MAC address.
DeviceInfo.getMacAddress().then(mac => {
// "E5:12:D8:E5:69:97"
});
iOS: This method always return "02:00:00:00:00:00" as retrieving the MAC address is disabled since iOS 7
Gets the device manufacturer.
DeviceInfo.getManufacturer().then(manufacturer => {
// iOS: "Apple"
// Android: "Google"
// Windows: ?
});
Returns the maximum amount of memory that the VM will attempt to use, in bytes.
DeviceInfo.getMaxMemory().then(maxMemory => {
// 402653183
});
Gets the device model.
iOS warning: The list with device names is maintained by the community and could lag new devices. It is recommended to use getDeviceId()
since it's more reliable and always up-to-date with new iOS devices. We do accept pull requests that add new iOS devices to the list with device names.
let model = DeviceInfo.getModel();
// iOS: ?
// Android: ?
// Windows: ?
Gets the device phone number.
DeviceInfo.getPhoneNumber().then(phoneNumber => {
// Android: null return: no permission, empty string: unprogrammed or empty SIM1, e.g. "+15555215558": normal return value
});
This can return
undefined
in certain cases and should not be relied on. SO entry on the subject.
Gets the power state of the device including the battery level, whether it is plugged in, and if the system is currently operating in low power mode. Displays a warning on iOS if battery monitoring not enabled, or if attempted on an emulator (where monitoring is not possible)
DeviceInfo.getPowerState().then(state => {
// {
// batteryLevel: 0.759999,
// batteryState: 'unplugged',
// lowPowerMode: false,
// }
});
The name of the overall product.
DeviceInfo.getProduct().then(product => {
// "walleye"
});
The developer preview revision of a prerelease SDK.
DeviceInfo.getPreviewSdkInt().then(previewSdkInt => {
// 0
});
Gets the application human readable version (same as getVersion() + '.' + getBuildNumber())
let readableVersion = DeviceInfo.getReadableVersion();
// iOS: 1.0.1.32
// Android: 1.0.1.234
// Windows: ?
Gets the device serial number. Will be 'unknown' in almost all cases [unless you have a privileged app and you know what you're doing](https://developer.android.com/reference/android/os/Build.html#getSerial()).
DeviceInfo.getSerialNumber().then(serialNumber => {
// iOS: unknown
// Android: ? (maybe a serial number, if your app is privileged)
// Windows: unknown
});
The user-visible security patch level.
DeviceInfo.getSecurityPatch().then(securityPatch => {
// "2018-07-05"
});
Gets the device OS name.
let systemName = DeviceInfo.getSystemName();
// iOS: "iOS" on newer iOS devices "iPhone OS" on older devices, including older iPad's.
// Android: "Android"
// Windows: ?
Gets the device OS version.
let systemVersion = DeviceInfo.getSystemVersion();
// iOS: "11.0"
// Android: "7.1.1"
// Windows: ?
Gets build number of the operating system.
DeviceInfo.getBuildId().then(buildId => {
// iOS: "12A269"
// tvOS: not available
// Android: "13D15"
// Windows: not available
});
Comma-separated tags describing the build.
DeviceInfo.getTags().then(tags => {
// "release-keys, unsigned, debug",
});
The type of build.
DeviceInfo.getType().then(type => {
// "user", "eng"
});
Gets full disk storage size, in bytes.
DeviceInfo.getTotalDiskCapacity().then(capacity => {
// Android: 17179869184
// iOS: 17179869184
});
Gets the device total memory, in bytes.
DeviceInfo.getTotalMemory().then(totalMemory => {
// 1995018240
});
This is a constant and may be referenced directly
Gets the device unique ID.
On Android it is currently identical to getAndroidId()
in this module.
On iOS it uses the DeviceUID
uid identifier.
On Windows it uses Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation.id
.
let uniqueId = DeviceInfo.getUniqueId();
// iOS: "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9"
// Android: "dd96dec43fb81c97"
// Windows: ?
- iOS: This is
IDFV
or a random string if IDFV is unavaliable. Once UID is generated it is stored in iOS Keychain and NSUserDefaults. So it would stay the same even if you delete the app or reset IDFV. You can carefully consider it a persistent, cross-install unique ID. It can be changed only in case someone manually override values in Keychain/NSUserDefaults or if Apple would change Keychain and NSUserDefaults implementations. Beware: The IDFV is calculated using your bundle identifier and thus will be different in app extensions.- android: Prior to Oreo, this id (ANDROID_ID) will always be the same once you set up your phone.
This method is intended for iOS.
This synchronizes uniqueId with IDFV
or sets new a random string.
On iOS it uses the DeviceUID
uid identifier.
On other platforms it just call getUniqueId()
in this module.
DeviceInfo.syncUniqueId().then(uniqueId => {
// iOS: "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9"
// Android: "dd96dec43fb81c97"
// Windows: ?
});
- If user moved or restored data from one iOS device to second iOS device then he will have two different devices with same
uniqueId
in Keychain/NSUserDefaults. User can callsyncUniqueId()
on new iOS device. That will update hisuniqueId
fromIDFV
or a random string.
Gets the app memory usage, in bytes.
DeviceInfo.getUsedMemory().then(usedMemory => {
// 23452345
});
Gets the device User Agent.
DeviceInfo.getUserAgent().then(userAgent => {
// iOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143"
// tvOS: not available
// Android: ?
// Windows: ?
});
Gets the application version.
let version = DeviceInfo.getVersion();
// iOS: "1.0"
// Android: "1.0"
// Windows: ?
Tells if the device is in Airplane Mode.
DeviceInfo.isAirplaneMode().then(airplaneModeOn => {
// false
});
- This only works if the remote debugger is disabled.
Tells if the battery is currently charging.
DeviceInfo.isBatteryCharging().then(isCharging => {
// true or false
});
Tells if the application is running in an emulator.
DeviceInfo.isEmulator().then(isEmulator => {
// false
});
Tells if a PIN number or a fingerprint was set for the device.
DeviceInfo.isPinOrFingerprintSet().then(isPinOrFingerprintSet => {
if (!isPinOrFingerprintSet) {
// ...
}
});
Tells if the device is a tablet.
let isTablet = DeviceInfo.isTablet();
// true
Tells if the device is currently in landscape mode.
DeviceInfo.isLandscape().then(isLandscape => {
// true
});
Tells if the device has a notch.
let hasNotch = DeviceInfo.hasNotch();
// true
Returns the device's type as a string, which will be one of:
Handset
Tablet
Tv
unknown
let type = DeviceInfo.getDeviceType();
// 'Handset'
An ordered list of 32 bit ABIs supported by this device.
DeviceInfo.supported32BitAbis().then(abis => {
// ["armeabi-v7a", "armeabi"]
});
An ordered list of 64 bit ABIs supported by this device.
DeviceInfo.supported64BitAbis().then(abis => {
// ["arm64-v8a"]
});
Returns a list of supported processor architecture version
DeviceInfo.supportedAbis().then(abis => {
// [ "arm64 v8", "Intel x86-64h Haswell", "arm64-v8a", "armeabi-v7a", "armeabi" ]
});
Tells if the device has a specific system feature.
DeviceInfo.hasSystemFeature('amazon.hardware.fire_tv').then(hasFeature => {
// true or false
});
Returns a list of available system features on Android.
DeviceInfo.getSystemAvailableFeatures().then(features => {
// ["android.software.backup", "android.hardware.screen.landscape", "android.hardware.wifi", ...]
});
Tells if the device has location services turned off at the device-level (NOT related to app-specific permissions)
DeviceInfo.isLocationEnabled().then(enabled => {
// true or false
});
Tells if the device is connected to wired headset or bluetooth headphones
DeviceInfo.isHeadphonesConnected().then(enabled => {
// true or false
})
Returns an object of platform-specfic location providers/servcies, with boolean
value whether or not they are currently available.
NOTE: This function requires access to the Location permission on Android
DeviceInfo.getAvailableLocationProviders().then(providers => {
// {
// gps: true
// network: true
// passive: true
// }
});
DeviceInfo.getAvailableLocationProviders().then(providers => {
// {
// headingAvailable: false
// isRangingAvailable: false
// locationServicesEnabled: true
// significantLocationChangeMonitoringAvailable: true
// }
});
Currently iOS & Android only (web support for battery/charging-related APIs).
Fired when the battery level changes; sent no more frequently than once per minute.
import { useBatteryLevel } from 'react-native-device-info'
const batteryLevel = useBatteryLevel(); // 0.759999
<Text>{ batteryLevel }</Text>
import { NativeEventEmitter, NativeModules } from 'react-native';
const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo);
deviceInfoEmitter.addListener('RNDeviceInfo_batteryLevelDidChange', level => {
// 0.759999
});
Fired when the battery drops is considered low
Platform | Percentage |
---|---|
iOS | 20 |
Android | 15 |
Web | 20 |
import { useBatteryLevelIsLow } from 'react-native-device-info'
const batteryLevelIsLow = useBatteryLevelIsLow(); // 0.19
<Text>{ batteryLevelIsLow }</Text>
import { NativeEventEmitter, NativeModules } from 'react-native';
const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo);
deviceInfoEmitter.addListener('RNDeviceInfo_batteryLevelIsLow', level => {
// 0.19
});
Fired when the battery state changes, for example when the device enters charging mode or is unplugged.
import { usePowerState } from 'react-native-device-info'
const powerState = usePowerState(); // 'charging'
<Text>{ powerState }</Text>
import { NativeEventEmitter, NativeModules } from 'react-native'
const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo)
deviceInfoEmitter.addListener('RNDeviceInfo_powerStateDidChange', { batteryState } => {
// 'charging'
});
Gets the time at which the app was first installed, in milliseconds.
import { usePowerState } from 'react-native-device-info';
const { loading, result } = useFirstInstallTime(); // { loading: true, result: 1517681764528}
<Text>{loading ? 'loading...' : result}</Text>;
Gets the device name.
import { useDeviceName } from 'react-native-device-info';
const { loading, result } = useDeviceName(); // { loading: true, result: "Becca's iPhone 6"}
<Text>{loading ? 'loading...' : result}</Text>;
Tells if the device has a specific system feature.
import { useHasSystemFeature } from 'react-native-device-info';
const { loading, result } = useHasSystemFeature('amazon.hardware.fire_tv'); // { loading: true, result: false }
<Text>{loading ? 'loading...' : result}</Text>;
Get whether the application is running in an emulator.
import { useIsEmulator } from 'react-native-device-info';
const { loading, result } = useIsEmulator(); // { loading: true, result: false }
<Text>{loading ? 'loading...' : result}</Text>;
=======
If you need to check for device type from the native side, you can use the following:
import com.learnium.resolver.DeviceTypeResolver
...
deviceTypeResolver = new DeviceTypeResolver(context);
...
//Check if the device is a Tablet:
if(deviceTypeResolver.isTablet){
...
}else{
...
}
When installing or using react-native-device-info
, you may encounter the following problems:
See the CHANGELOG.md.
Please see the contributing guide
.
As a courtesy to developers, this library was made compatible in v0.21.6 with react-native-dom and react-native-web by providing an empty polyfill in order to avoid breaking builds.
Only getUserAgent() will return a correct value. All other API methods will return an "empty" value of its documented return type: 0
for numbers, ''
for strings, false
for booleans.