React Native Device Info is commonly used to fetch hardware, OS, and application-related details from a user's device such as model, system version, brand, and unique identifiers.
In React Native, device information is typically accessed using a third-party library that bridges native APIs to JavaScript. One of the most widely used libraries is react-native-device-info.
// Importing DeviceInfo library
import DeviceInfo from 'react-native-device-info';
// Fetch device model
const model = DeviceInfo.getModel();
// Fetch system name
const systemName = DeviceInfo.getSystemName();
console.log(model, systemName);
The console will log the device model (e.g., iPhone 14, Pixel 7) along with the operating system name such as iOS or Android.
Since this is a web browser, we can't access native mobile hardware directly. However, the simulator below mimics how the react-native-device-info API works. Click the buttons to fetch "Device" info!
?️ API Simulator Control Panel:
// How we are simulating these calls in this browser:
const isTablet = window.innerWidth > 768;
const systemName = navigator.platform;
console.log("Is Tablet:", isTablet);
console.log("System:", systemName);
react-native-device-info in a sample app