Device Info
Nano framework has inbuilt deviceInfo
module that uses react-native-device-info.
Reading Info from deviceInfo:
All the methods like onPress
, onLongPress
, onStart
and onEnd
in framework has access to moduleParams parameter that has all the available modules, you can use device info module from it like below.
For example, below is the code to find the device id and using getDeviceId
from deviceInfo
module.
const buttonPress = {
component: NANO.BUTTON,
value: 'CLICK TO GET DEVICE ID',
onPress: ({ moduleParams }) => {
console.log(moduleParams["deviceInfo"].getDeviceId());
}
};
const screen = {
name: 'HomeScreen',
screen: {
h1: [buttonPress],
}
};
You can use all the device info methods like getBundleId
, getCodename
, getDevice
and getDeviceName
. Check the documentation here react-native-device-info for complete available methods and their usage.