Complete the code to import the DeviceInfo module from 'react-native-device-info'.
import [1] from 'react-native-device-info';
The correct import is DeviceInfo from the package react-native-device-info.
Complete the code to get the device's unique ID using DeviceInfo.
const uniqueId = DeviceInfo.[1]();The method getUniqueId() returns the unique device ID.
Fix the error in the code to trigger a light haptic feedback using React Native's Haptics API.
import { Haptics } from 'react-native'; Haptics.[1]();
The correct method is impactLightAsync() to trigger light haptic feedback asynchronously.
Fill both blanks to create a function that vibrates the device for 500 milliseconds using React Native's Vibration API.
import { Vibration } from 'react-native'; function vibrateDevice() { Vibration.[1]([2]); }
The vibrate method is used with a number argument for milliseconds. So Vibration.vibrate(500) vibrates for 500 ms.
Fill all three blanks to create a dictionary comprehension that maps device info keys to their values only if the value is a non-empty string.
const deviceInfo = {
[1]: DeviceInfo.[2](),
[3]: DeviceInfo.getSystemVersion()
};
const filteredInfo = Object.fromEntries(
Object.entries(deviceInfo).filter(([key, value]) => value [3] '')
);We map deviceName to getDeviceName() and filter entries where value is not equal to empty string using !==.