From 7b62dc22adce16900ab473deb6400448a46b2999 Mon Sep 17 00:00:00 2001 From: Calvin Freitas Date: Tue, 22 Dec 2015 04:57:45 -0800 Subject: [PATCH] Add example of getting window dimensions to Dimensions docs. Summary: This pull request adds an example to the Dimensions documentations. Specifically, it gives an example of how to get the height and width from the window. I'm submitting this documentation because discovering this information cost me some time and my hope is to save other folks time by having this info right in the docs generated from the comments in this file. Let me know if you need anything else. Closes https://github.com/facebook/react-native/pull/4211 Reviewed By: svcscm Differential Revision: D2719953 Pulled By: androidtrunkagent fb-gh-sync-id: 86d18e3847066211a013a50ce2f2a3e2032f5052 --- Libraries/Utilities/Dimensions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/Utilities/Dimensions.js b/Libraries/Utilities/Dimensions.js index 319aa84622..93e2cc21aa 100644 --- a/Libraries/Utilities/Dimensions.js +++ b/Libraries/Utilities/Dimensions.js @@ -57,6 +57,8 @@ class Dimensions { * than caching the value (for example, using inline styles rather than * setting a value in a `StyleSheet`). * + * Example: `var {height, width} = Dimensions.get('window');` + * * @param {string} dim Name of dimension as defined when calling `set`. * @returns {Object?} Value for the dimension. */