as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
Skip to main content
useKeplerWindowDimensionsV2 use this hook instead which updates the dimensions based on root tag to handle multiple interactive component and multiple instances
You can get the application window’s width and height using the following code:
React Native for Vega applications can get the dimensions for all application component windows using the following code:
DisplayMetrics Type:
If your React Native for Vega application only has a single application component, you can just rely on Dimensions.get('window'). If you have more than one application component you will need to use Dimensions.get('windows') and identify the dimensions for the particular component you are interested in. When there is more than one Vega app component, Dimensions.get(‘window’) returns dimensions for the first component created in the app process. If you are targeting foldable devices or devices which can change the screen size or app window size, you can use the event listener available in the Dimensions module as shown in the following example.

Example Vega

Reference

Methods

addEventListener()

Add an event handler. Supported events:
  • change: Fires when a property within the Dimensions object changes. The argument to the event handler is a DimensionsValue type object.

get()

Initial dimensions are set before runApplication is called so they should be available before any other require’s are run, but may be updated later. Example: const {height, width} = Dimensions.get('window'); Vega example:
Parameters:

Type Definitions

DimensionsValue

Properties:

ScaledSize

Properties:
最后修改于 2026年11月12日