Skip to main content
Version: 3.x

Taro.onWindowResize(callback)

Listens on the window size change event.

Reference

Type​

(callback: Callback) => void

Parameters​

Callback​

The callback function for the window size change event.

(result: CallbackResult) => void
PropertyType
resultCallbackResult

CallbackResult​

PropertyType
sizeSize

Size​

PropertyTypeDescription
windowHeightnumberNew window width (in px)
windowWidthnumberNew window height (in px)

API Support​

APIWeChat Mini-ProgramH5React Native
Taro.onWindowResize✔️✔️✔️