react-nativereact-native-device-info

React native target Samsung Galaxy S7


My styling is broken on Samsung Galaxy S7 - I am using react-native-device-info is there a way I can target the Samsung S7 so I can conditionally set the styling?

When I try and use DeviceInfo.getDeviceId() and my emulator it gives me Ùnknown

import DeviceInfo from "react-native-device-info";
DeviceInfo.getDeviceId() //unknown

Any ideas?


Solution

  • With the code below you will get the get the name of the cellphone, in your case, Samsumg Galaxy S7:

    import DeviceInfo from "react-native-device-info";
    DeviceInfo.getModel()
    

    Please thumbs up if my answer is correct, waiting for your feedback :).