Get size of a View in React Native

前端 未结 7 1860
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 15:56

Is it possible to get the size (width and height) of a certain view? For example, I have a view showing the progress:



        
7条回答
  •  庸人自扰
    2020-11-29 16:35

    Here is the code to get the Dimensions of the complete view of the device.

    var windowSize = Dimensions.get("window");

    Use it like this:

    width=windowSize.width,heigth=windowSize.width/0.565

提交回复
热议问题