Reputation: 61
I have the next problem - when I build my react-native app into apk file, and then install app into the device, I get wrong data display(something like under a magnifying glass). After a few hours of working, I decide to do alert from demension(of course I did rebuild of apk ) my device height and width. And here is the question! - On my Galaxy S6 with resolution 2000+ x 1500+ I have got 640 x 480! Someone can help with this?
P.S Also I tried to find dependence on PixelRatio
import Dimensions from 'Dimensions';
let {width , height } = Dimensions.get('window');
componentDidMount() {
alert( 'PIXEL_RATIO '+PixelRatio.get() + `WIDTH ${width} HEIGHT ${height}`)
}
Upvotes: 2
Views: 4088
Reputation: 492
I also had the same problem. The get
function of the Dimension
class returning a scaled size of the window. I can get the correct screen size like these:
window = Dimensions.get('window');
width = window.width * window.scale;
height = window.height * window.scale;
Upvotes: 6