I’d like to know a device’s PPI so that I can accurately animate an on-screen shape at a velocity specified by the user in centimeters per second.
What is the recommended way of getting PPI? The oft-suggested way of doing this is using PixelRatio.get()
(or Dimensions.get('screen').scale
) and multiplying the return value by 160. But that is giving me imprecise results across different devices. For example:
On iPhone 14 simulator, PixelRatio.get()
returns 3, suggesting a PPI of 480, but actual PPI is 460 (per Apple Store specs)
On iPad Pro (11-inch) simulator, PixelRatio.get()
returns 2, suggesting a PPI of 320, but actual PPI is 264.
Is there a more reliable way to get PPI? Thanks!