Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Device attributes, etc? #74

Closed
jaygarcia opened this issue Feb 16, 2015 · 10 comments
Closed

Query Device attributes, etc? #74

jaygarcia opened this issue Feb 16, 2015 · 10 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jaygarcia
Copy link
Contributor

Hi,

How does one query Device attributes like screen dimensions via the JS bridge?

@vjeux
Copy link
Contributor

vjeux commented 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
Copy link
Contributor

sahrens commented 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!

On Feb 16, 2015, at 10:30 AM, Christopher Chedeau notifications@github.com wrote:

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


Reply to this email directly or view it on GitHub.

@jaygarcia
Copy link
Contributor Author

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
Copy link

I think some sort of access to the device screen size and capabilities is badly needed.

@chirag04
Copy link
Contributor

+1

@brentvatne
Copy link
Collaborator

@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?

@ide
Copy link
Contributor

ide commented Apr 28, 2015

There is also https://github.com/pjjanak/react-native-viewport for viewport sizes.

@stefalda
Copy link

@brentvatne I didn't know about those methods, but I think they'd be enough for now.
Thank you for the clarification.

@chirag04
Copy link
Contributor

@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
Copy link
Collaborator

@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.

harrykiselev pushed a commit to harrykiselev/react-native that referenced this issue Aug 5, 2015
Added cursor pointer to none active thread items
@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants