Skip to content

Why Use getBoundingClientRect to Get Height Instead of offsetHeight #267

@425765923

Description

@425765923

Platform targeting (iOS/Android)
IOS
Additional context

In utils.js, the default method used to get the web height is getBoundingClientRect, and a timer is set to ensure that the height is correct before stopping further adjustments. However, getBoundingClientRect returns the height relative to the viewport, so if scrolling occurs during the timer interval, it could lead to incorrect height calculations.

So, why not directly use height = ${element}.offsetHeight to ensure that the correct web height is obtained every time?
image

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions