You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're actually re-thinking how this works because it's usually not the right thing to simply grab the screen dimensions (not robust to device rotation, in-call notification bar, etc). We definitely need to provide a solution soon though!
@chirag04@stefalda - What capabilities did you have in mind? In terms of screen size, what information do you want to have access to beyond the width/height and pixel ratio?
width/height are currently available with require('Dimensions').get('window') which returns {width: x, height: y} and pixel ratio which you can access directly with the PixelRatio module or require('Dimensions').get('window').scale.
So I think this issue is more about being able to watch the device for events that might change the dimensions eg rotation: #426. We can watch for changes in status bar size using react-native-status-bar-size. What else am I missing?
@chirag04 - check out the Viewport module that @ide mentioned above, it seems like a good alternative 😄
I'm going to close this issue, let's create a new one when we have some specific attributes that we want to be able to query for so we can handle those on a case-by-case basis.
Activity
vjeux commentedon Feb 16, 2015
There's a Dimensions module that's not exposed yet. We're working on getting our synchronization in order to be able to expose it
sahrens commentedon Feb 16, 2015
We're actually re-thinking how this works because it's usually not the right thing to simply grab the screen dimensions (not robust to device rotation, in-call notification bar, etc). We definitely need to provide a solution soon though!
jaygarcia commentedon Feb 23, 2015
Thanks guys. I imagine people are going to want to do query the device as they are used to doing this with HTML5 apps :)
stefalda commentedon Mar 29, 2015
I think some sort of access to the device screen size and capabilities is badly needed.
chirag04 commentedon Apr 27, 2015
+1
brentvatne commentedon Apr 28, 2015
@chirag04 @stefalda - What capabilities did you have in mind? In terms of screen size, what information do you want to have access to beyond the width/height and pixel ratio?
width/height are currently available with
require('Dimensions').get('window')which returns{width: x, height: y}and pixel ratio which you can access directly with thePixelRatiomodule orrequire('Dimensions').get('window').scale.So I think this issue is more about being able to watch the device for events that might change the dimensions eg rotation: #426. We can watch for changes in status bar size using react-native-status-bar-size. What else am I missing?
ide commentedon Apr 28, 2015
There is also https://github.com/pjjanak/react-native-viewport for viewport sizes.
stefalda commentedon Apr 28, 2015
@brentvatne I didn't know about those methods, but I think they'd be enough for now.
Thank you for the clarification.
chirag04 commentedon Apr 28, 2015
@brentvatne We only need width/height and pixel ratio and for now we are using
Dimensions.But as i read in github issues, dimensions is going to go and is a bad practice. Documented component/module for this would be helpful.
brentvatne commentedon Apr 28, 2015
@chirag04 - check out the Viewport module that @ide mentioned above, it seems like a good alternative 😄
I'm going to close this issue, let's create a new one when we have some specific attributes that we want to be able to query for so we can handle those on a case-by-case basis.